Is your feature request related to a problem? Please describe.
Signals / Alerts are currently being sent to email, if AutoTrade can send them to a webhook link it will be great.
Describe the solution you'd like
Whenever a signal comes, AutoTrader must be able to send data in json format to a webhook link.
Data must consist name of strategy, time when signal was generated, candle open high low close OHLCV (V if possible).
If possible make this customizable like we have in tradingview.
We can add or remove like say timeframe can be removed and we can add symbol or dataprovide like yahoo or oanda.
Describe alternatives you've considered
Reference - chartink.com webhooks
JSON data which is not so useful.
{
"stocks": "SEPOWER,ASTEC,EDUCOMP,KSERASERA,IOLCP,GUJAPOLLO,EMCO",
"trigger_prices": "3.75,541.8,2.1,0.2,329.6,166.8,1.25",
"triggered_at": "2:34 pm",
"scan_name": "Short term breakouts",
"scan_url": "short-term-breakouts",
"alert_name": "Alert for Short term breakouts",
"webhook_url": "http://your-web-hook-url.com"
}
Additional context
If webhook is provided, it will be easy to integrate a choice of broker order placement code.
Even webhook can be used to send alerts to telegram channel. See below code where I am sending data to a channel using webhook coming from chartink.
from flask import Flask
from flask import jsonify, make_response, request
import requests
from time import sleep
import config_ab as config
import pandas as pd
from urllib.parse import urlencode, quote_plus
from datetime import datetime
app = Flask(__name__)
def telegram_bot_sendtext(message):
bot_token = '<BOT_TOKEN>'
bot_chatID = '-100<CHANNEL_ID>'
data = {
'text': message,
'chat_id': bot_chatID,
'parse_mode': 'MARKDOWN'
}
encodedData = urlencode(data, quote_via=quote_plus)
url = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?' + encodedData
response = requests.get(url)
return response.json()
@app.route('/')
def hello_world():
return 'Chartink testing!!'
def time_check():
t = datetime.today()
mis_end_time = datetime(t.year, t.month, t.day, 15, 00)
if datetime.now() > mis_end_time:
print("no more intraday trading")
return True
@app.route('/alertsonly', methods=['POST'])
def alertsonly():
if not request.is_json:
return make_response(jsonify({"message": "Request body must be JSON"}), 400)
body = request.get_json()
print(body)
df = pd.DataFrame.from_dict({'symbol': list(body['stocks'].split(
',')), 'price': list(body['trigger_prices'].split(','))})
# print(df)
table = df.to_markdown(index=False, tablefmt="grid")
# print(table)
test = telegram_bot_sendtext(body['alert_name']+'\n'+table)
print(test)
return table
I think implementing code to send json to webhook endpoint can be implemented easily since you have already coded for email.
Is your feature request related to a problem? Please describe. Signals / Alerts are currently being sent to email, if AutoTrade can send them to a webhook link it will be great.
Describe the solution you'd like Whenever a signal comes, AutoTrader must be able to send data in json format to a webhook link. Data must consist name of strategy, time when signal was generated, candle open high low close OHLCV (V if possible).
If possible make this customizable like we have in tradingview. We can add or remove like say timeframe can be removed and we can add symbol or dataprovide like yahoo or oanda.
Describe alternatives you've considered Reference - chartink.com webhooks JSON data which is not so useful.
Additional context If webhook is provided, it will be easy to integrate a choice of broker order placement code. Even webhook can be used to send alerts to telegram channel. See below code where I am sending data to a channel using webhook coming from chartink.
I think implementing code to send json to webhook endpoint can be implemented easily since you have already coded for email.