Skip to content

Instantly share code, notes, and snippets.

@ugik
Created August 7, 2022 20:44
Show Gist options
  • Save ugik/ba44adbf7560d35d1925414ba5ac7657 to your computer and use it in GitHub Desktop.
Save ugik/ba44adbf7560d35d1925414ba5ac7657 to your computer and use it in GitHub Desktop.
simple Telegram graph
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