GithubHelp home page GithubHelp logo

moallemi / bonbast Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samadipour/bonbast

0.0 1.0 0.0 332 KB

Get currencies exchange rates for IRR from Bonbast.com

License: MIT License

Shell 9.72% Python 90.28%

bonbast's Introduction

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

  1. Installation
  2. Usage
    1. Command Line
    2. Usage in other programs
    3. Mac Shortcuts
    4. Raycast
  3. Development

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

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.

bonbast

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.

$ bonbast -i 60
# Or
$ python -m bonbast -i 60

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

bonbast_live_simple

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

bonbast_live_currency

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

bonbast_history

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

bonbast_convert

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

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

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 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.

bonbast_raycast

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:

  1. Enable the script command in Raycast.
  2. Copy bonbast.sh file to the Raycast script-commands folder.
  3. Follow the instructions below or read Raycast docs.

raycast-setup


Development

Setup

  1. Clone the repo
  2. Install the dependencies
  3. Run it with python
git clone https://github.com/SamadiPour/bonbast.git
cd bonbast
pip install .
python -m src.bonbast.main

Building the package

  1. Install build dependencies
  2. Build the package
  3. 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

bonbast's People

Contributors

ahbanavi avatar alirezaazadi avatar dozheiny avatar moallemi avatar parsampsh avatar samadipour avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.