Last active
August 7, 2022 21:44
-
-
Save ugik/c3001d4b3622cacbe299a3f227e30f37 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def telegram_EMA(sma, back=50, show=False): | |
file = 'EMAs.jpg' | |
ax = sma[-back:].plot(y="BTCUSDT_C", kind="line", color="k", \ | |
linewidth=3, use_index=True, x_compat=True, \ | |
rot=25, linestyle='-', figsize=(6, 5)) | |
sma[-back:].plot(y="EMA20", kind="line", ax=ax, color="y", \ | |
x_compat=True, rot=25, linestyle=':', figsize=(6, 5)) | |
sma[-back:].plot(y="EMA50", kind="line", ax=ax, color="r", \ | |
x_compat=True, rot=25, linestyle=':', figsize=(6, 5)) | |
sma[-back:].plot(y="EMA200", kind="line", ax=ax, color="b", \ | |
x_compat=True, rot=25, linestyle=':', figsize=(6, 5)) | |
plt.savefig(file, bbox_inches='tight') | |
if show: | |
plt.show() | |
plt.close() | |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_KEY}/sendPhoto" | |
files = {} | |
files["photo"] = open(file, "rb") | |
if not show: | |
requests.get(url, params={"chat_id": TELEGRAM_CHAT_ID}, files=files) | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment