Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

종목별 거래량 조회시 investor "연기금등" 데이터 차이.. #115

Closed
WOOJOONSIK opened this issue Apr 2, 2022 · 7 comments
Closed
Assignees
Labels
bug Something isn't working closing-candidate wontfix This will not be worked on

Comments

@WOOJOONSIK
Copy link

  1. 일자별 거래실적 추이 (거래량)
    stock.get_market_trading_volume_by_investor(st_date, st_date, stock_code)

  2. 투자자별 거래실적 추이 (거래량)
    stock.get_market_net_purchases_of_equities_by_ticker(st_date,st_date,"ALL","연기금등")

두 데이터의 "연기금등" 데이터의 차이.

ex) 2022-03-31, 017810 사례
1번함수 ) 매도 5,164, 매수 0 순매수 -5,164
2번함수 ) 매도 32,975 매수 32,975 순매수 0
32,975는 전체 거래량 데이터와 일치.

*. stock.get_market_net_purchases_of_equities_by_ticker(st_date,st_date,"ALL","연기금등")
에서 오류 인듯..

좋은 프로그램 잘 사용하고 있습니다. ^^

@mr-yoo mr-yoo self-assigned this Apr 2, 2022
@mr-yoo
Copy link
Collaborator

mr-yoo commented Apr 2, 2022

.get_market_net_purchases_of_equities_by_ticker는 KRX 웹페이지의 다음 정보를 스크래핑합니다.
어디가 잘못된 것일까요?

image

get_market_trading_volume_by_investor는 다음 데이터를 가져오구요.

  • 웹페이지의 원본 데이터 자체가 조금 이상하긴하네요.
  • 매수 컬럼의 전체 합이 38187이네요

image

@mr-yoo
Copy link
Collaborator

mr-yoo commented Apr 2, 2022

아래 코드로 테스트 했습니다.

from pykrx import stock

st_date = "20220331"
stock_code = "017810"
df = stock.get_market_trading_volume_by_investor(st_date, st_date, stock_code)
print(df)
print("-" * 20)
print(df.iloc[:-1].sum())
df = stock.get_market_net_purchases_of_equities_by_ticker(st_date,st_date,"ALL","연기금등")
print("-" * 20)
print(df.loc['017810'])

@WOOJOONSIK
Copy link
Author

확인 감사.
df = stock.get_market_trading_volume_by_investor(st_date, st_date, stock_code)
의 연기금등 은 5164
df = stock.get_market_net_purchases_of_equities_by_ticker(st_date,st_date,"ALL","연기금등")
의 매도거래량은 32975로 1번 df의 전체 값으로 나옴.

@mr-yoo mr-yoo added the bug Something isn't working label Apr 15, 2022
@mr-yoo
Copy link
Collaborator

mr-yoo commented Apr 18, 2022

이 부분은 KRX 자체의 오류 인것으로 보입니다. 모듈에서 수정하기 어려워 보입니다.

@WOOJOONSIK
Copy link
Author

역산해서 연기금등 데이터를 재 계산하면 사용하고 있습니다.
감사합니다. ^^

@mr-yoo mr-yoo added wontfix This will not be worked on closing-candidate labels Apr 19, 2022
@mr-yoo mr-yoo closed this as completed Apr 19, 2022
@mr-yoo
Copy link
Collaborator

mr-yoo commented Apr 22, 2022

다음은 제가 KRX에 문의를 해서 얻은 받은 답변입니다.

안녕하십니까?
한국거래소에 대한 귀하의 관심에 감사드립니다.
문의하신 내용에 대한 답변은 다음과 같습니다.
1. 이용자께서 2022.3.31 일자 풀무원에 대한 투자자별 거래실적에서 합계의 오류에 대한 사항을 문의하셨습니다.
이는 기관합계 수량인 5,212주를 중복 합산한 결과 38,187주로 계산된 결과입니다. 기관합계의 의미는 금융투자, 보험, 투신, 사모, 은행, 기타금융, 연기금 등을 합산한 소계의 의미입니다. 기관합계 5,212주에 기관합계 하단의 나머지 투자자에 대한 거래량을 합산한 결과인 27,763주를 더한 32,975주가 맞는 수치입니다. 이점 유의해 주시기 바랍니다.
 
2. 한국거래소 정보데이터시스템을 이용해 주셔서 감사합니다.

답변이 조금 이상한 것 같아 제가 해석해 본바로는 다음과 같습니다.

  • 기관합계가 5,212가 추가로 더해진 것이 32,975로 보입니다.
  • 24 + 24 + 5164를 더한 값이 5212인데 이 값을 전체 합에 한 번 더 더한 결과네요.
  • 즉 웹페이지의 숫자가 잘못된 상태입니다.

참고해 주세요.

@WOOJOONSIK
Copy link
Author

감사합니다. ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working closing-candidate wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants