Get currencies exchange rates for IRR from Bonbast.com
Project description
Bonbast
bonbast.com offers accurate and reliable gold prices and IRR exchange rates for businesses. Bonbast is the most accurate and reputable foreign exchange trading data collector of the Iranian market.
I don't alter any of the data in this tool; it all comes from bonbast. The sole purpose of this tool is to offer a different method of obtaining bonbast prices.
Contents
Installation
Brew
brew install samadipour/bonbast/bonbast
or
brew tap samadipour/bonbast
brew update
brew install bonbast
Python
To install this program, you can to use pip:
$ pip install bonbast
# Or
$ python -m pip install bonbast
Then you can use it:
$ bonbast
# Or
$ python -m bonbast
Also, to update the program, you can use pip:
pip install -U bonbast
#or
python -m pip install -U bonbast
Arch Linux (AUR)
To install the package on Arch Linux or any Arch-based distro, you can use any AUR (Arch User Repository) package manager, such as yay or paru:
yay -S python-bonbast
or manually build the package from the AUR source:
git clone https://aur.archlinux.org/python-bonbast.git
cd python-bonbast
makepkg -si
The package is available in the Arch User Repository.
Usage
I tried my best to display the price data in a variety of ways that would be useful in a variety of circumstances.
Command Line
Main mode
This will be the default mode if you run the program without any arguments. It will show the current prices for gold, coins, and the IRR exchange rate in separate tables.
Live
In live mode, the program tries to update the prices in a specified interval. This is useful if you want to keep an eye on the prices.
The website updates the prices every 30 seconds and the default value is 30 seconds as well. You can change this value
by using the -i
or --interval
argument.
Simple
In this mode, the program will show the prices as text in the terminal.
$ bonbast live simple --show-only usd,eur,gbp,cad -i 300
# Or
$ python -m bonbast live simple --show-only usd,eur,gbp,cad -i 300
Currency
In this mode, the program will show the prices in a table. It can only show one currency at a time.
$ bonbast live currency --show-only usd,eur,gbp,cad -i 300
# Or
$ python -m bonbast live currency --show-only usd,eur,gbp,cad -i 300
History
This is useful if you want to see the prices for a specific date. You can use the -d
or --date
argument to specify
the date. The date must be in the format YYYY-MM-DD
or YYYY/MM/DD
. Also, the date needs to be Gregorian.
The date is valid from 2012-10-09 to one day before the current date.
$ bonbast history --date 2020/10/10
# Or
$ python -m bonbast history --date 2020/10/10
Graph
This is useful if you want to see the price of a currency in a specific date range. You can use the --start-date
argument to specify the start date and --end-date
for the end date. The date must be in the format YYYY-MM-DD
or YYYY/MM/DD
. Also, the date needs to be Gregorian.
If start or end date is not specified, the end date will default to today and the start date will be set to 30 days prior to the end date.
The date is valid from 2012-10-09 to one day before the current date.
$ bonbast graph eur
$ bonbast graph eur --start-date 2023-01-02
$ bonbast graph eur --start-date 2023-02-12 --end-date 2023-05-09
# Or
$ python -m bonbast graph eur
Convert
This is useful if you want to convert a value from one currency to Rial or from Rial to another currency.
If you want to convert from a currency to Rial, you need to use -s
or --source
argument to specify the currency you
want to convert from.
$ bonbast convert -s EUR 12.5
# Or
$ python -m bonbast convert -s EUR 12.5
If you want to convert from Rial to another currency, you need to use the -d
or --destination
argument to specify
the currency you want to convert to.
$ bonbast convert -d USD 1837850
# Or
$ python -m bonbast convert -d USD 1837850
You can also use --only-buy
or --only-sell
to specify which price you want to use.
$ bonbast convert -d USD 1837850 --only-buy
$ bonbast convert -d USD 1837850 --only-sell
# Or
$ python -m bonbast convert -d USD 1837850 --only-buy
$ python -m bonbast convert -d USD 1837850 --only-sell
Json Output
It can be useful if you want to use the result of the program in another program. You can also pipe the output in
terminal to another program like JQ
.
$ bonbast export
# Or
$ python -m bonbast export
Pretty Print Json
There is also a way to pretty print the json output. You can use the --pretty
argument to do that. It helps to see the
output in a more readable way.
$ bonbast export --pretty
# Or
$ python -m bonbast export --pretty
List of supported currencies
Flag | Currency | Code |
---|---|---|
🇺🇸 | US Dollar | USD |
🇪🇺 | Euro | EUR |
🇬🇧 | British Pound | GBP |
🇨🇭 | Swiss Franc | CHF |
🇨🇦 | Canadian Dollar | CAD |
🇦🇺 | Australian Dollar | AUD |
🇸🇪 | Swedish Krona | SEK |
🇳🇴 | Norwegian Krone | NOK |
🇷🇺 | Russian Ruble | RUB |
🇹🇭 | Thai Baht | THB |
🇸🇬 | Singapore Dollar | SGD |
🇭🇰 | Hong Kong Dollar | HKD |
🇦🇿 | Azerbaijani Manat | AZN |
🇦🇲 | 10 Armenian Dram | AMD |
🇩🇰 | Danish Krone | DKK |
🇦🇪 | UAE Dirham | AED |
🇯🇵 | 10 Japanese Yen | JPY |
🇹🇷 | Turkish Lira | TRY |
🇨🇳 | Chinese Yuan | CNY |
🇸🇦 | Saudi Riyal | SAR |
🇮🇳 | Indian Rupee | INR |
🇲🇾 | Malaysian Ringgit | MYR |
🇦🇫 | Afghan Afghani | AFN |
🇰🇼 | Kuwaiti Dinar | KWD |
🇮🇶 | 100 Iraqi Dinar | IQD |
🇧🇭 | Bahraini Dinar | BHD |
🇴🇲 | Omani Rial | OMR |
🇶🇦 | Qatari Rial | QAR |
Usage in other programs
There are few ways to use the program in other programs. The best way is to use the json output.
Mac Shortcuts
You can use the json output or the convert function to create a shortcut in Mac. You can use the shortcut to show the currency price as a notification.
Raycast
Raycast is a tool for searching your Mac, launching applications, and controlling your computer, and it is far superior to Spotlight. You can use the json output to create a script command in Raycast. In this way, you can easily access the prices in Raycast.
I included an example script command in the raycast
folder. You can use it to create your own script.
Setup for Raycast
You can use this setup-raycast.sh script to setup the script command in Raycast. Then Follow the instructions in below image or read Raycast docs.
$ chmod +x setup-raycast.sh
$ ./setup-raycast.sh standalone
or
$ ./setup-raycast.sh python
or manually:
- Enable the script command in Raycast.
- Copy bonbast.sh file to the Raycast
script-commands
folder. - Follow the instructions below or read Raycast docs.
Development
Setup
- Clone the repo
- Install the dependencies
- Run it with python
git clone https://github.com/SamadiPour/bonbast.git
cd bonbast
pip install .
python -m src.bonbast.main
Building the package
- Install build dependencies
- Build the package
- install it locally if you want (or you can use
local_install
script)
python -m pip install ".[build]"
python -m build
python -m pip install dist/*.whl
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bonbast-1.0.2.tar.gz
.
File metadata
- Download URL: bonbast-1.0.2.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc00114c00c5c976b1144d65741c30ede003d3b0313942a33298e8d3264597a1 |
|
MD5 | e0ef7bd4f27db6858836edb380f2528a |
|
BLAKE2b-256 | 00f892f0bd7ba91294b5bfd7b4ba4d001bf58258f66fecc72c8f5a260b7ced7f |
File details
Details for the file bonbast-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: bonbast-1.0.2-py3-none-any.whl
- Upload date:
- Size: 21.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5ea674b2bf6cacaa0e0d405056d98c979c35ef1a41bf6e5af3aac7ef8baf16c |
|
MD5 | 080967989e1c4f130a8e028f190044fe |
|
BLAKE2b-256 | 42cc24fe7f6f2c41c9a675e37f771ea329d9723d6168635be1b6cf3c75e9cb25 |