Expand description

Easy and ready access to the database of The Central Bank of The Republic of Turkey (CBRT).

This crate provides two main separate mechanisms for acquiring data from the database:

  • evds_basic includes functions making most of the web service operations except currency operations with frequency formulas.
  • evds_currency includes structure-based and implemented methods that make totally currency operations.

Useful functions of evds_basic and evds_currency require a number of common elements checking the validity of given inputs and creating appropriate requests formats for the database. These mentioned elements are included in common, date and error modules.

ApiKey, which is a structure in common, gives validity to all functions playing role to make requests for EVDS web services. Therefore, users need to utilize their keys to work with EVDS.

The functions making most of EVDS web service operations are given inside the evds_basic module except currency values with advanced features. In addition, evds_currency has two structures containing required currency requesting elements. It is because the number of the elements are more than enough for using as parameter that these two struct supplies self methods to make only currency operations of EVDS web services.

This crate provides async_mode and sync_mode as a feature. async_mode and sync_mode features should be used with an async and a sync programming respectively. Furthermore, the async_mode feature is enabled by default. One of these two features should be used to work with this crate.

Install

Please, add appropriate one of the blow codes to your Cargo.toml to install the crate.

For async_mode, please add.

[dependencies]
tcmb_evds = "0.1"

For sync_mode, please add.

[dependencies]
tcmb_evds = {version = "0.1", default-features = false, features = ["sync_mode"]}

Usage

For more and other function implementations and details, please go to evds_basic module stage.

    use tcmb_evds::*;


    // assigning required arguments.
    // another data series = "TP.DK.USD.A-TP.DK.USD.S-TP.DK.GBP.A-TP.DK.GBP.S"
    let data_series = "TP.DK.USD.A";

    let date = date::Date::from("13-12-2011")?;
    let date_preference = date::DatePreference::Single(date);

    let api_key = common::ApiKey::from("user_api_key".to_string())?;
    let return_format = common::ReturnFormat::Xml;
    let evds = common::Evds::from(api_key, return_format);


    // get data operation based on given series.
    let currency_data = evds_basic::get_data(data_series, &date_preference, &evds)?;

For more and other function implementations and details, please go to evds_currency module stage.

    use tcmb_evds::*;


    // common elements
    let api_key = common::ApiKey::from("user_api_key".to_string())?;
    let return_format = common::ReturnFormat::Json;
    let evds = common::Evds::from(api_key, return_format);

    let date = date::Date::from("13-12-2011")?;
    let date_preference = date::DatePreference::Single(date);


    // currency series creation
    let exchange_type = evds_currency::ExchangeType::new();

    let currency_code = evds_currency::CurrencyCode::Usd;

    // Ytl mode adds "YTL" to currency series, when it is true.
    let ytl_mode = true;

    let currency_series =
        evds_currency::CurrencySeries::from(
            exchange_type,
            currency_code,
            date_preference,
            ytl_mode
        );


    // get data operation based on created CurrencySeries.
    let currency_data = currency_series.get_data(&evds)?;

Comparison

  • evds_basic

    • Provides most of the EVDS web service operations except currency value with frequency formulas service which is called advanced currency operations in this crate.
    • Users are responsible for ensuring validity of the given series and some data.
    • Less reliable for the currency service operations.
  • evds_currency

    • Specified for operating currency operations.
    • Given series and some data are automatically checked.
    • More reliable for the currency service operations.

User Guide

First of all, please take a look at README.md file before using the crate.

Additional resource for understanding some parameters, learning various data series and details of web services are mentioned in kullanim kilavuzu for Turkish and user guide.

Appendix

To understand ytl_mode required in some functions and what is “YTL”, please follow what is YTL?.

Modules

contains two main elements that are used in operations of evds_basic and evds_currency.

contains date elements that are used in some functions of evds_basic and evds_currency.

contains specified error options that are returned from the functions of evds_basic and evds_currency to illustrate why the error occurs.

provides most of the EVDS web services except requesting advanced currency data that means currency data with frequency formulas.

provides only currency operations with methods of CurrencySeries and MultipleCurrencySeries.