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)