Skip to content

Exchange Rates

izqalan edited this page Nov 17, 2019 · 4 revisions

Exchange Rates

Currency exchange rates from the Interbank Foreign Exchange Market in Kuala Lumpur. The price of selected countries currency in relation to Ringgit.

Usage

exchangeRate()

by latest

bnm.exchangeRate().then(response => console.log(response))

Output

{
  "meta": {
    "last_updated": "2019-11-17T12:51:22Z",
    "total_result": 0,
    "quote": "rm",
    "session": "1130"
  },
  "data": [
    {
      "currency_code": "str",
      "unit": 0,
      "rate": {
        "date": "2019-11-17",
        "buying_rate": 0,
        "selling_rate": 0,
        "middle_rate": 0
      }
    }
  ]
}

xchgRate(currency_code) or xchgRate()

by currency code. ie. USD, EUR, JPY

bnm.xchgRate('currency_code')

Output

{
  "meta": {
    "last_updated": "2019-11-17T12:51:22Z",
    "total_result": 0,
    "quote": "rm",
    "session": "1130"
  },
  "data": {
    "currency_code": "str",
    "unit": 0,
    "rate": {
      "date": "2019-11-17",
      "buying_rate": 0,
      "selling_rate": 0,
      "middle_rate": 0
    }
  }
}

xchgRateByDate(currency_code, date)

by currency code with specific date. Date with format as defined by RFC 3339, section 5.6

bnm.xchgRateByDate('currency_code', 'yyyy-mm-dd')

Output

{
  "meta": {
    "last_updated": "2019-11-17T12:51:22Z",
    "total_result": 0,
    "quote": "rm",
    "session": "1130"
  },
  "data": {
    "currency_code": "str",
    "unit": 0,
    "rate": {
      "date": "2019-11-17",
      "buying_rate": 0,
      "selling_rate": 0,
      "middle_rate": 0
    }
  }
}

xchgRateByYearMonth(currency_code, year, month)

by currency, year and month

xchgRateByYearMonth('currency_code', 'yyyy', 'mm')

Output

{
  "meta": {
    "last_updated": "2019-11-15T08:34:38Z",
    "total_result": 0,
    "quote": "rm",
    "session": "1130"
  },
  "data": {
    "currency_code": "str",
    "unit": 0,
    "rate": [
      {
        "date": "2019-11-15",
        "buying_rate": 0,
        "selling_rate": 0,
        "middle_rate": 0
      }
    ]
  }
}

Clone this wiki locally