Меню

Api конвертер валют python



Currency Converter

A Python currency converter using the European Central Bank data.

Project maintained by alexprengere Hosted on GitHub Pages — Theme by mattgraham

Currency data sources

The default source is the European Central Bank. This is the ECB historical rates for 42 currencies against the Euro since 1999. It can be downloaded here: eurofxref-hist.zip. The converter can use different sources as long as the format is the same.

Installation

You can install directly after cloning:

Or use the Python package:

Command line tool

After installation, you should have currency_converter in your $PATH :

Python API

Create once the currency converter object:

Convert from EUR to USD using the last available rate:

Default target currency is EUR :

You can change the date of the rate:

Fallbacks

Some rates are missing:

But we have a fallback mode for those, using a linear interpolation of the closest known rates, as long as you ask for a date within the currency date bounds:

We also have a fallback mode for dates outside the currency bounds:

Other attributes

  • bounds lets you know the first and last available date for each currency
  • currencies is a set containing all available currencies

Finally, you can use your own currency file, as long as it has the same format (ECB):

Источник

currency.converter 0.5.5

pip install currency.converter Copy PIP instructions

Released: Aug 27, 2010

Navigation

Project links

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

License: GPL

Maintainers

Classifiers

  • Framework
    • Plone
    • Zope2
    • Zope3
  • Programming Language
    • Python
  • Topic
    • Software Development :: Libraries :: Python Modules

Project description

Introduction

Overview

currency.converter package fetches currency rate data from European Central Bank for about recent 3 months. Once the data is fetched, the data is persisted in ZODB in case of whatever difficulty to fetch the data again. There are currency converter page and portlet included in this package and several methods you can use for your own applications.

Log in as a manager and go to the page, “your_portal/@@manage-currency”. By visiting the page, the current currency data will be fetched if possible and automatically persisted.

Features

Site manager can give two different variables in addition to currencies, days and margin.

Days This amout is used to caclulate average of currencies. For example, if you input 10 to this field, 10 recent days are used to calculate average currency rate. This keeps currency rate fluctuation smaller than using everyday plain rate. If nothing or 0 is input there, it doesn’t calculate average, but uses current rate. Margin Margin adds % of rate to the currency rate. 0 is 0 % margin where is no margin.

Источник

CurrencyConverter 0.16.7

pip install CurrencyConverter Copy PIP instructions

Released: Jan 14, 2022

A currency converter using the European Central Bank data.

Navigation

Project links

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

Читайте также:  Свободно конвертируемая валюта российский рубль как свободно конвертируемая валюта

Maintainers

Classifiers

  • Development Status
    • 5 — Production/Stable
  • Programming Language
    • Python :: 2.7
    • Python :: 3
    • Python :: Implementation :: CPython
    • Python :: Implementation :: PyPy

Project description

This is a currency converter that uses historical rates against a reference currency (Euro).

Currency data sources

The default source is the European Central Bank. This is the ECB historical rates for 42 currencies against the Euro since 1999. It can be downloaded here: eurofxref-hist.zip. The converter can use different sources as long as the format is the same.

Note that the currency converter does not query the API in real time, to avoid the overhead of the HTTP request. It uses embedded data in the library, which might not be up to date. If you need the latest data, please refer to the data section.

Installation

You can install directly after cloning:

Or use the Python package:

Command line tool

After installation, you should have currency_converter in your $PATH:

Python API

Create once the currency converter object:

Convert from EUR to USD using the last available rate:

Default target currency is EUR:

You can change the date of the rate:

You can use your own currency file, as long as it has the same format (ECB):

Since the raw data is updated only once a day, it might be better to only download it once a day:

Fallbacks

Some rates are missing:

But we have a fallback mode for those, using a linear interpolation of the closest known rates, as long as you ask for a date within the currency date bounds:

The fallback method can be configured with the fallback_on_missing_rate_method parameter, which currently supports "linear_interpolation" and "last_known" values.

We also have a fallback mode for dates outside the currency bounds:

Источник

py-currency-converter 1.2.0

pip install py-currency-converter Copy PIP instructions

Released: Feb 3, 2020

Python Currency Converter

Navigation

Project links

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

License: MIT License

Maintainers

Classifiers

  • License
    • OSI Approved :: MIT License
  • Operating System
    • OS Independent
  • Programming Language
    • Python :: 3

Project description

This is a currency converter that uses https://www.exchangerate-api.com/ API.

Python Currency Converter

This package help in converting converting the any currency amount to any other(s) currency. This consumes the https://www.exchangerate-api.com/ free REST API.

Installation

You can install directly after cloning:

use the Python package:

$ pip install —user py_currency_converter

Command line tool

After installation, you should have py_currency_converter in your $PATH :

$ currency_converter 1 USD —to SGD 1.00 USD = 1.364903 SGD on 2020-02-02

Python API

Create once the currency converter object:

Convert from SGD to USD, EUR using the last available rate:

Источник

currency-converter-with-rate 1.1.0

pip install currency-converter-with-rate Copy PIP instructions

Читайте также:  Типичные нарушения при проведении операций в валюте

Released: Sep 2, 2021

Currency conversion between any two or to multiple and currency rates based on some parameters

Navigation

Project links

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

License: MIT License

Requires: Python >=3.5

Maintainers

Classifiers

  • Intended Audience
    • Developers
  • License
    • OSI Approved :: MIT License
  • Operating System
    • OS Independent
  • Programming Language
    • Python :: 3
  • Topic
    • Software Development :: Internationalization

Project description

Currency Converter with Rate

This is a simple python package for currency conversion between any two or to multiple currency. Also, to get latest and historical currency exchange rates & crypto exchange rates. This is based on the free API exchangerate.

Features

  • Conversion rate for one or multiple currency

For all or some specific currency:

  • Get latest rates
  • Get historical rates. Historical means on a speficifc date
  • Get timeseries rates, between any two dates
  • Get fluctuation rates, between any two dates

Sources [Currency symbols, Bank sources, Language code formatter, crypto-currencies]

For all currency symbols, language code for locale formatter, bank source codes, crypto-currency codes, check this Symbol & Code Sources

Usage Example

The followings are examples when you will use it as a package:

1. Currency Conversion

  • To convert one currency to another, you may chain method like this
  • If you want only converter option, you may use like this:

The output will be like this:

here, base() and target() is required method. Other available methods you will see in following examples are optional.

You can find all the currency symbols to pass in base() and target() method for conversion in the above source link, under the file named currency-symbols.txt

The following examples are given using main Currency() class

  • Multiple targets: In above example, target currency is only one. If you want to convert to multiple targets, use like following: (send multiple currency code as a list)

Available methods:

  • amount() : By default, base amount is 1.00, you can change it by using amount()
  • places() : for rounding currency value upto specific decimal point. The following example will round to 2 decimal point of the target currency value
  • format_language() : to format the price according to a locale formatter, such as if you want to format currency as United Kingdom’s format.

You can find all language code for locale format, in the above source link, under the file named language-codes-list.txt

  • date() : to convert currency on a rate of a specific date. In this method, date paremeter must be in YYYY-MM-DD format
  • source() : There are 2 different types of source.
  1. Bank source: Currency conversion according to a bank reference. In this case, you have to pass the bank’s code in the source(). You can find all bank source code, in the above source link, under the file named bank_sources.txt
  1. Crypto Currency: Untill now, we are converting physical currency. If you want conversion between two crypto-currency, you have to use source(crypto) for all kind of crypto currency.
Читайте также:  Прогноз рынка валюты 2020

And in both base() and target() method, you have to pass any crypto-currency symbols, instead of physical currency, like following:

The above example convert from bitcoin (BTC) to PAC Protocol (PAC). You can find all crypto-currency symbols, in the above source link, under the file named crypto-currencies.txt

Note: You don’t have to follow any chaining sequence to use or call the optional methods. Just make sure, you call any of them before get() . get() must be last method in the chain.

Such as, you can call places() before amount() , like,

2. Rates

There are 4 types of rates option.

  • 2.1 For latest rate: use latest()
  • 2.2 for historical rate: use historical(«2021-05-24») : here date is required, and format must be YYYY-MM-DD
  • 2.3 for fluctuations rate: use fluctuations(«2021-01-01», «2021-01-03») : here start_date & end_date is required, and both format must be YYYY-MM-DD
  • 2.4 for timeseries rate: use timeseries(«2021-01-01», «2021-01-03») : here start_date & end_date is required, and both format must be YYYY-MM-DD

For all those rates,

  • you may use rates() method of Currency class like following:
  • Or, you may use only Rates class like following:

Based on which type of rates, you want to get, the methods will be different. But all these rate types, have some common available optional methods. These are following:

Note: You don’t have to follow any chaining sequence to use or call the optional methods. Just make sure, you call any of them before get(). Just like explained above examples

The following examples are given using main Currency() class.

2.1 Get Latest Rates

  • To get all latest rates (convert from, by default euro, based on amount 1.00)

The output will be like this:

  • an example with all available optional methods, for single target symbol
  • an example with all available optional methods, for multiple target symbol

2.2 Get Historical Rates

  • an example with all available optional methods, multiple target symbol

as explained above, a date must be passed as a parameter inside historical() in YYYY-MM-DD format. This date indicates that, the rates were for that specific day.

Output will look like following:

2.3 Get Fluctuation Rates

an example with all available optional methods, multiple target symbol

2 required parameters for fluctuations() :

start_date: in YYYY-MM-DD format

end_date: in YYYY-MM-DD format

Output will look like following:

2.4 Get Timeseries Rates

an example with all available optional methods, multiple target symbol

2 required parameters:

start_date: in YYYY-MM-DD format

end_date: in YYYY-MM-DD format

Output will look like following:

If you send wrong parameter/s, in the available methods, or if there is any error in API, you will get an error response like following:

Источник

Adblock
detector