생활
비주얼 스튜디오 코드 오류질문
import pyupbit
import numpy as np
df = pyupbit.get_ohlcv("KRW-BTC,count=7")df['range'] = (df['high'] - df['low']) * 0.5df['target'] = df['open'] + df['range'].shift(1)
df['ror'] = np.where(df['high'] > df['target'], df['close'] / df['target'], 1)
df['hpr'] = df['ror'].cumprod()df['dd'] = (df['hpr'].cummax() - df['hpr']) / df['hpr'].cummax() * 100print("MDD(%): ", df['dd'].max())df.to_excel("dd.xlsx")
위 코드를 실행하면 아래같은 오류가 떠요ㅠㅠ 어떻게 해야 되나요?
TypeError
Traceback (most recent call last):
File "c:/cryptoauto/backtest.py", line 5, in <module>
df['range'] = (df['high'] - df['low']) * 0.5
TypeError: 'NoneType' object is not subscriptable
1개의 답변이 있어요!