[Mod] flake8 code quanlity improve

This commit is contained in:
vn.py 2019-11-07 15:33:48 +08:00
parent 65fc733a02
commit 3ed0131b44
3 changed files with 52 additions and 50 deletions

View File

@ -85,7 +85,7 @@ class DataAnalysis:
t = []
o = []
h = []
l = []
l = [] # noqa
c = []
v = []
@ -268,17 +268,19 @@ class DataAnalysis:
down_signal = []
len_data = len(data["close"])
for i in range(1, len_data):
if data.iloc[i]["close"] > data.iloc[i]["boll_up"]and data.iloc[i-1]["close"] < data.iloc[i - 1]["boll_up"]:
if data.iloc[i]["close"] > data.iloc[i]["boll_up"]and data.iloc[i - 1]["close"] < data.iloc[i - 1]["boll_up"]:
up_signal.append(i)
elif data.iloc[i]["close"] < data.iloc[i]["boll_down"] and data.iloc[i-1]["close"] > data.iloc[i - 1]["boll_down"]:
elif data.iloc[i]["close"] < data.iloc[i]["boll_down"] and data.iloc[i - 1]["close"] > data.iloc[i - 1]["boll_down"]:
down_signal.append(i)
fig = plt.figure(figsize=(20, 8))
plt.figure(figsize=(20, 8))
close = data["close"]
plt.plot(close, lw=1)
plt.plot(close, '^', markersize=5, color='r', label='UP signal', markevery=up_signal)
plt.plot(close, 'v', markersize=5, color='g', label='DOWN signal', markevery=down_signal)
plt.plot(close, '^', markersize=5, color='r',
label='UP signal', markevery=up_signal)
plt.plot(close, 'v', markersize=5, color='g',
label='DOWN signal', markevery=down_signal)
plt.plot(data["boll_up"], lw=0.5, color="r")
plt.plot(data["boll_down"], lw=0.5, color="g")
plt.legend()