Skip to content

Instantly share code, notes, and snippets.

@ugik
Created August 7, 2022 21:31
Show Gist options
  • Save ugik/f68afb2147fc4884589205debcf84c14 to your computer and use it in GitHub Desktop.
Save ugik/f68afb2147fc4884589205debcf84c14 to your computer and use it in GitHub Desktop.
file = "stats.jpg"
# create your own numerical lists here...
days = [30, 21, 14, 5, 2]
data = [10, 19, 6, 34, 12]
labels = days
plt.xticks(range(len(data)), labels)
plt.xlabel('Days')
plt.ylabel('% Position Gain')
plt.title('Gains Summary')
plt.bar(range(len(data)), data)
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