Open Willstar44 opened 4 years ago
Hi. Not sure how I would make a bot alert.
The actual trading script (deribit_harmonics.py) checks at specified intervals only if there is a current pattern.
def checkHarmonic():
global i, current_idx,current_pat,start,end, sign, price,prices
i = len(prices) - 1
current_idx,current_pat,start,end = peak_detect(prices.values[:i],order=7)
XA = current_pat[1] - current_pat[0]
AB = current_pat[2] - current_pat[1]
BC = current_pat[3] - current_pat[2]
CD = current_pat[4] - current_pat[3]
moves = [ XA , AB , BC , CD ]
# gart = is_gartley(moves,err_allowed)
# butt = is_butterfly(moves,err_allowed)
# bat = is_bat(moves,err_allowed)
# crab = is_crab(moves,err_allowed)
shark = is_shark(moves,err_allowed)
trio = is_trio(moves,err_allowed)
harmonics = np.array([shark,trio])
labels = ['Shark','Trio']
# harmonics = np.array([shark])
# labels = ['Shark']
start = np.array(current_idx).min()
end = np.array(current_idx).max()
price = prices.values[end]
if delta == 0.0:
if np.any(harmonics == 1) or np.any(harmonics == -1):
for j in range (0,len(harmonics)):
if harmonics[j] == 1 or harmonics[j]==-1:
sense = 'Bearish ' if harmonics[j]==-1 else 'Bullish '
label = sense + labels[j]
print(label)
sign = harmonics[j]
date = data.iloc[end].name
trade_dates = np.append(trade_dates,date)
if harmonics[j]==-1:
sell_limit(price)
else:
buy_limit(price)
else:
if delta < 0.0:
sign = -1
else:
sign = 1
walk(price,sign)
This would be amazing with a telegram bot to alert you when there a new one.
is there a setting to edit so you can see only the last patten, it show me the last 100 patterns from the last 3 months