기본 콘텐츠로 건너뛰기

라벨이 변동성인 게시물 표시

[matplotlib]quiver()함수

[stock] 변동성 돌파 전략

변동성 돌파 전략 시가에 매수한 주를 거래일의 현재가가 "시가 + 전일변동폭×0.5를 돌파하는 경우 매도하는 전략 전일변동폭: 전일 고가 - 전일 저가 import numpy as np import pandas as pd import yfinance as yf st=pd.Timestamp(2024, 9,20) et=pd.Timestamp(2024, 9,24) d=yf.download("005930.KS", start=st, end=et) d Open High Low Close Adj Close Volume Date 2024-09-20 63800.0 64700.0 63000.0 63000.0 63000.0 32746056 2024-09-23 62300.0 63500.0 62200.0 62300.0 62300.0 21242594 range_pre=d.High[0]-d.Low[0] range_pre 1700.0 op_present=d.Open[1] op_present 62300.0 sell=op_present+range_pre*0.5 sell sell=op_present+range_pre*0.5 sell profit=(sell-op_present)/op_present*100 profit.round(1) 1.4 위 전략에 의한 매매를 한달 수행한 과정을 기록해 보면 다음과 같습니다. 이를 위해 위 계산과정을 다음의 함수 volatilitStrategy()로 작성하였습니다. ...