Skip to content

Instantly share code, notes, and snippets.

@esmaeelE
Created February 15, 2026 06:39
Show Gist options
  • Select an option

  • Save esmaeelE/9d21a433bba1577b69e2e25891e59eb8 to your computer and use it in GitHub Desktop.

Select an option

Save esmaeelE/9d21a433bba1577b69e2e25891e59eb8 to your computer and use it in GitHub Desktop.
gold price calculatr for Iran
#!/bin/python3
# get price from API
# crontab
# calculate live price
# send with websocket
# Onz: 31.103431g, 999 ayar, 24
# megal: 4.608 gram
# mazane: 1 mesgal 17 705
# seke: 8.133 g, 21.6 ayar, 900/22
# nim: 4.0665, rob: 2.03225
usd = 107000
oz = 3775
# get from API
usd = int(input("usd: "))
oz = int(input("oz: "))
common = usd * oz
# 1 mesgal 17 ayar
mazane = common / 9.5742
seke = common / 4.24927
mesgal = common / 8.999
gram = mesgal / 4.608
print("mazane 18 ayar: ", f"{mazane:,}")
print("seke : ", f"{seke:,}")
print("Mesgal 18 ayar: ", f"{mesgal:,}")
print("Geram 18 ayar: ", f"{gram:,}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment