Created
August 7, 2022 20:44
-
-
Save ugik/ba44adbf7560d35d1925414ba5ac7657 to your computer and use it in GitHub Desktop.
simple Telegram graph
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
dateFrom = '2022-08-05 12:00:00' | |
positionData = getPositionInfo(startDate=timezoneGMT(parser.parse(dateFrom)), exchange='BTCUSDT') | |
file = coin +'.jpg' | |
ax = plt.gca() | |
dateFrom = str(timezoneGMT(parser.parse(dateFrom))) | |
positionData.plot(kind='line',x='date',y=coin[:3],ax=ax, marker='.', \ | |
title= coin[:3] +" since "+dateFrom) | |
plt.savefig(file, bbox_inches='tight') | |
plt.show() | |
plt.close() | |
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_KEY}/sendPhoto" | |
files = {} | |
files["photo"] = open(file, "rb") | |
requests.get(url, params={"chat_id": TELEGRAM_CHAT_ID}, files=files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment