{"_id":"@apilayer/fixer","_rev":"1-cd1bdc74b870f314bfecfedee06231db","name":"@apilayer/fixer","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.6":{"name":"@apilayer/fixer","version":"0.1.6","author":{"name":"Samuel Oloruntoba","email":"github@kayandra.co","url":"https://kayandra.co"},"license":"MIT","dependencies":{"@types/node-fetch":"^2.5.0","node-fetch":"^2.5.0"},"gitHead":"e0a9510ba4e021cc2692311d4869e451bef33799","publishConfig":{"access":"public"},"description":"Fixer is a simple and lightweight API for current and historical foreign exchange (forex) rates.","_id":"@apilayer/fixer@0.1.6","_nodeVersion":"10.16.3","_npmVersion":"lerna/3.16.4/node@v10.16.3+x64 (linux)","dist":{"integrity":"sha512-5yqijlt/PSuTIkHU6beOmfPnVA+RHRlmQtndePMZ3xwr4hRZcxYUE+9Q35xbJwcp6FTbYtxhQ9ItduS2Jap6rA==","shasum":"d9f48b0dba40f283ee7754befe7aa00f918d496f","tarball":"https://registry.npmjs.org/@apilayer/fixer/-/fixer-0.1.6.tgz","fileCount":5,"unpackedSize":26128,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdkzKjCRA9TVsSAnZWagAA/6kP/22XFTKq1dw9/QaWDcso\noxsd3DuKOxE9YVOXUKzUPCZ04CoY/++AxQGXwEFQB8m02u15FYaXH3wcltNQ\neRx30hsF05TxsdkDNNxOe64l/n5HLzTu7bmT281W2HFYfuikCSkoLdvNrPBE\ngVkWfJsPCRkBWB4mGgA0Upuw6paVINGw/cHQRxwFpF7e2aqVI9zTwKaGFKiU\nA1wpqgmVuRcklfDyZMd14ez78EkTN4EDUN+0hXEpIv0+JnfPqduAcxzrPPuX\nTZ0u7VC2avQ58H/ZAFgadc7zOr1LaTt/0N5BNcIK+rc8kTPaG5SIR/eRqjBp\nJEO6YQ00TJ/pkjpV3+AZSiKLDi7jMhghESw3rNNm4NPNTwBRAywenhQ5eXSg\nx2PnmdJ5IA9UYXr8nrsBzIz2QpR2k2wE3zaEs4m3s2b3nFtZhI9AOyv5+GsA\n1xywpsUkFIiHH6l3JSEn8VZlyi+WB3tfN6GM/2+S2xExQ9lZnRB/0rVVM/2Q\nLPWsGDhXAF0x6SVUIFh8SvN8thGIOmvpRET8PL2UgeW7CIqQuua4M7SFbEVF\nYo3U0jgHWGrfZ/rWVRqVwasMW75ybuDQvgV+JLCOsA48OibNYLDrrxT6qjXB\nYPL7Nm2Z2A2r1fAER7XtXUAEixJrgRZbDE3sjH+PuW4JRcpDpncP+P+OwmwZ\nnESU\r\n=6sXp\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICvEIr0WtVRsvnvEgbb8otErrpsZntuBPc9cJj6QP9XzAiBms35BV3tcH8m/zWjZzT5gFGW0KXKCHSrJ7fjBsm42WQ=="}]},"maintainers":[{"name":"kayandra","email":"tag@kayandra.co"},{"name":"apilayer-p","email":"support@apilayer.com"}],"_npmUser":{"name":"kayandra","email":"tag@kayandra.co"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/fixer_0.1.6_1569927843275_0.7605417193519599"},"_hasShrinkwrap":false}},"time":{"created":"2019-10-01T11:04:03.049Z","0.1.6":"2019-10-01T11:04:03.391Z","modified":"2022-04-04T14:37:49.856Z"},"maintainers":[{"name":"kayandra","email":"tag@kayandra.co"},{"name":"apilayer-p","email":"support@apilayer.com"}],"description":"Fixer is a simple and lightweight API for current and historical foreign exchange (forex) rates.","author":{"name":"Samuel Oloruntoba","email":"github@kayandra.co","url":"https://kayandra.co"},"license":"MIT","readme":"# fixer-js\n\nFixer is a simple and lightweight API for current and historical foreign exchange (forex) rates.\n\n## Installation\n\nUsing npm\n\n```\nnpm install --save @apilayer/fixer\n```\n\nor yarn\n\n```\nyarn add @apilayer/fixer\n```\n\n## Getting Started\n\nHead over to [Fixer](https://fixer.io/) and create an account. Copy access key from dashboard.\n\n```javascript\nimport Fixer from '@apilayer/fixer';\n\nconst layer = new Fixer({\n  key: \"<your-access-key>\"\n  base: \"USD\",\n  secure: false\n})\n```\n\nAlternatively, you can change the default currency used by the library by:\n\n```javascript\nlayer.setBase(\"GBP\")\n```\n\n> *Unsupported currency codes with throw an error.*\n\nIf you're using typescript, you can import `BaseType` type.\n\n```javascript\nimport Fixer, { BaseType } from '@apilayer/fixer';\n\nconst layer = new Fixer({\n  ...\n  base: BaseType.USD,\n})\n```\n\n**Note:**\n> RequestDate type represents a string matching \"YYYY-mm-dd\" or a date\n> object\n\n## Latest rates\n\nTo fetch current live rates, use the `latest()` method and pass in string slice of [accepted currencies](#supported-currencies).\n\n**Signature:**\n\n```typescript\nlatest(symbols: BaseType[]): Promise<Latest>\n```\n\n**Example:**\n\n```javascript\nconst response = layer.latest([\"GBP\", \"NGN\"])\n\nconsole.log(\"response:\", response)\n```\n\n**Response:**\n\n```javascript\n{\n\tsuccess: true,\n\ttimestamp: 1566902074,\n\tbase: \"USD\",\n\trates: {\n    \"USDGBP\": \"0.82\",\n    \"USDNGN\": \"366.02\",\n  }\n}\n```\n\n_An unsupported [currency code](#supported-currencies) will cause an error_.\n\n## Historical\n\nTo get rates for a currency pair at a date in the past, you should make a historical request:\n\n**Signature:**\n\n```typescript\nhistorical(date: RequestDate, symbols: BaseType[]): Promise<Historical>\n```\n\n**Example:**\n\n```javascript\nconst response = layer.historical(\"2019-01-21\", [\"GBP\", \"NGN\"])\n\nconsole.log(\"response:\", response)\n```\n\n**Response:**\n\n```javascript\n{\n  success: true,\n\thistorical: true,\n\ttimestamp: 1566902074,\n  base: \"USD\",\n  date: \"2019-06-01\",\n\trates: {\n    \"USDGBP\": \"0.82\",\n    \"USDNGN\": \"366.02\",\n  }\n}\n```\n\n## Auto Conversion\n\nIt is also possible to convert an amount from a currency to its equivalent value in another currency.\n\n**Signature:**\n\n```typescript\nconvert(\n  from: string,\n  to: string,\n  amount: number,\n  date: RequestDate = null\n): Promise<Convert>\n```\n\n**Example:**\n\n```javascript\nconst response = layer.convert(\"USD\", \"GBP\", 100.00)\n\nconsole.log(\"response:\", response)\n```\n\nThe above call does a conversion of 100 USD to GBP as at the current date.\n\n**Response:**\n\n```javascript\n{\n  success: true,\n\tinfo: {\n    timestamp: 1566902074,\n    rate: 82.00,\n  },\n  result: 82.00,\n\tquery: {\n    from: \"USD\",\n    to: \"GBP\",\n    amount: 100.00,\n  },\n\thistorical: false,\n  date: \"2019-06-01\",\n}\n```\n\nAlternatively, you can do a conversion for at a specific date\n\n```javascript\nconst response = layer.convert(\"USD\", \"GBP\", 100.00, \"2019-01-21\")\n```\n\n## Timeseries\n\nTimeseries: you may request historical exchange rates for a time-period of your choice. (maximum range: 365 days)\n\n**Signature:**\n\n```typescript\ntimeseries(start: RequestDate, end: RequestDate, symbols: BaseType[]): Promise<Timeseries>\n```\n\n**Example:**\n\n```javascript\nconst response = layer.timeseries(\"2019-06-01\", new Date(), [\"GBP\", \"NGN\"])\n\nconsole.log(\"response:\", response)\n```\n\n**Response:**\n\n```javascript\n{\n  success: true,\n  timeseries: true,\n\tstart_date: \"2019-06-01\",\n\tend_date: \"2019-06-04\",\n\tbase: \"USD\",\n\trates: {\n    \"2019-06-01\": {\"USDGBP\": 0.82, \"USDNGN\": 365.03},\n    \"2019-06-02\": {\"USDGBP\": 0.82, \"USDNGN\": 366.51},\n    \"2019-06-03\": {\"USDGBP\": 0.82, \"USDNGN\": 365.3},\n    \"2019-06-04\": {\"USDGBP\": 0.82, \"USDNGN\": 366.01},\n  }\n}\n```\n\n## Fluctuation\n\nFluctuation request the change (both margin and percentage) of one or more currencies, relative to a Source Currency, within a specific time-frame\n\n**Signature:**\n\n```typescript\nfluctuation(\n  start: RequestDate,\n  end: RequestDate,\n  symbols: BaseType[]\n): Promise<Fluctuation>\n```\n\n**Example:**\n\n```javascript\nconst response = layer.fluctuation(\"2019-06-01\", new Date(), [\"GBP\", \"NGN\"])\n\nconsole.log(\"response:\", response)\n```\n\n**Response:**\n\n```javascript\n{\n  success: true,\n  fluctuation: bool\n\tstart_date: \"2019-06-01\"\n\tend_date: \"2019-06-02\"\n\tbase: \"USD\"\n\trates: {\n    \"USDGBP\": {\n      start_rate: 0.82,\n      end_rate: 0.81,\n      change: 0.01,\n      change_pct: 1.21,\n    },\n    \"USDNGN\": {\n      start_rate: 366.60,\n      end_rate: 364.25,\n      change: 2.35,\n      change_pct: 0.64,\n    }\n  }\n}\n```\n\n## Supported Currencies\n\nA list of all supported currencies can be displayed by:\n\n```javascript\nlayer.symbols()\n```\n\nOr, you can see a list of all supported currencies below:\n\n| Code | Name                                |\n| :--: | ----------------------------------- |\n| AED  | United Arab Emirates Dirham         |\n| AFN  | Afghan Afghani                      |\n| ALL  | Albanian Lek                        |\n| AMD  | Armenian Dram                       |\n| ANG  | Netherlands Antillean Guilder       |\n| AOA  | Angolan Kwanza                      |\n| ARS  | Argentine Peso                      |\n| AUD  | Australian Dollar                   |\n| AWG  | Aruban Florin                       |\n| AZN  | Azerbaijani Manat                   |\n| BAM  | Bosnia-Herzegovina Convertible Mark |\n| BBD  | Barbadian Dollar                    |\n| BDT  | Bangladeshi Taka                    |\n| BGN  | Bulgarian Lev                       |\n| BHD  | Bahraini Dinar                      |\n| BIF  | Burundian Franc                     |\n| BMD  | Bermudan Dollar                     |\n| BND  | Brunei Dollar                       |\n| BOB  | Bolivian Boliviano                  |\n| BRL  | Brazilian Real                      |\n| BSD  | Bahamian Dollar                     |\n| BTC  | Bitcoin                             |\n| BTN  | Bhutanese Ngultrum                  |\n| BWP  | Botswanan Pula                      |\n| BYR  | Belarusian Ruble                    |\n| BZD  | Belize Dollar                       |\n| CAD  | Canadian Dollar                     |\n| CDF  | Congolese Franc                     |\n| CHF  | Swiss Franc                         |\n| CLF  | Chilean Unit of Account (UF)        |\n| CLP  | Chilean Peso                        |\n| CNY  | Chinese Yuan                        |\n| COP  | Colombian Peso                      |\n| CRC  | Costa Rican Colón                   |\n| CUC  | Cuban Convertible Peso              |\n| CUP  | Cuban Peso                          |\n| CVE  | Cape Verdean Escudo                 |\n| CZK  | Czech Republic Koruna               |\n| DJF  | Djiboutian Franc                    |\n| DKK  | Danish Krone                        |\n| DOP  | Dominican Peso                      |\n| DZD  | Algerian Dinar                      |\n| EGP  | Egyptian Pound                      |\n| ERN  | Eritrean Nakfa                      |\n| ETB  | Ethiopian Birr                      |\n| EUR  | Euro                                |\n| FJD  | Fijian Dollar                       |\n| FKP  | Falkland Islands Pound              |\n| GBP  | British Pound Sterling              |\n| GEL  | Georgian Lari                       |\n| GGP  | Guernsey Pound                      |\n| GHS  | Ghanaian Cedi                       |\n| GIP  | Gibraltar Pound                     |\n| GMD  | Gambian Dalasi                      |\n| GNF  | Guinean Franc                       |\n| GTQ  | Guatemalan Quetzal                  |\n| GYD  | Guyanaese Dollar                    |\n| HKD  | Hong Kong Dollar                    |\n| HNL  | Honduran Lempira                    |\n| HRK  | Croatian Kuna                       |\n| HTG  | Haitian Gourde                      |\n| HUF  | Hungarian Forint                    |\n| IDR  | Indonesian Rupiah                   |\n| ILS  | Israeli New Sheqel                  |\n| IMP  | Manx pound                          |\n| INR  | Indian Rupee                        |\n| IQD  | Iraqi Dinar                         |\n| IRR  | Iranian Rial                        |\n| ISK  | Icelandic Króna                     |\n| JEP  | Jersey Pound                        |\n| JMD  | Jamaican Dollar                     |\n| JOD  | Jordanian Dinar                     |\n| JPY  | Japanese Yen                        |\n| KES  | Kenyan Shilling                     |\n| KGS  | Kyrgystani Som                      |\n| KHR  | Cambodian Riel                      |\n| KMF  | Comorian Franc                      |\n| KPW  | North Korean Won                    |\n| KRW  | South Korean Won                    |\n| KWD  | Kuwaiti Dinar                       |\n| KYD  | Cayman Islands Dollar               |\n| KZT  | Kazakhstani Tenge                   |\n| LAK  | Laotian Kip                         |\n| LBP  | Lebanese Pound                      |\n| LKR  | Sri Lankan Rupee                    |\n| LRD  | Liberian Dollar                     |\n| LSL  | Lesotho Loti                        |\n| LTL  | Lithuanian Litas                    |\n| LVL  | Latvian Lats                        |\n| LYD  | Libyan Dinar                        |\n| MAD  | Moroccan Dirham                     |\n| MDL  | Moldovan Leu                        |\n| MGA  | Malagasy Ariary                     |\n| MKD  | Macedonian Denar                    |\n| MMK  | Myanma Kyat                         |\n| MNT  | Mongolian Tugrik                    |\n| MOP  | Macanese Pataca                     |\n| MRO  | Mauritanian Ouguiya                 |\n| MUR  | Mauritian Rupee                     |\n| MVR  | Maldivian Rufiyaa                   |\n| MWK  | Malawian Kwacha                     |\n| MXN  | Mexican Peso                        |\n| MYR  | Malaysian Ringgit                   |\n| MZN  | Mozambican Metical                  |\n| NAD  | Namibian Dollar                     |\n| NGN  | Nigerian Naira                      |\n| NIO  | Nicaraguan Córdoba                  |\n| NOK  | Norwegian Krone                     |\n| NPR  | Nepalese Rupee                      |\n| NZD  | New Zealand Dollar                  |\n| OMR  | Omani Rial                          |\n| PAB  | Panamanian Balboa                   |\n| PEN  | Peruvian Nuevo Sol                  |\n| PGK  | Papua New Guinean Kina              |\n| PHP  | Philippine Peso                     |\n| PKR  | Pakistani Rupee                     |\n| PLN  | Polish Zloty                        |\n| PYG  | Paraguayan Guarani                  |\n| QAR  | Qatari Rial                         |\n| RON  | Romanian Leu                        |\n| RSD  | Serbian Dinar                       |\n| RUB  | Russian Ruble                       |\n| RWF  | Rwandan Franc                       |\n| SAR  | Saudi Riyal                         |\n| SBD  | Solomon Islands Dollar              |\n| SCR  | Seychellois Rupee                   |\n| SDG  | Sudanese Pound                      |\n| SEK  | Swedish Krona                       |\n| SGD  | Singapore Dollar                    |\n| SHP  | Saint Helena Pound                  |\n| SLL  | Sierra Leonean Leone                |\n| SOS  | Somali Shilling                     |\n| SRD  | Surinamese Dollar                   |\n| STD  | São Tomé and Príncipe Dobra         |\n| SVC  | Salvadoran Colón                    |\n| SYP  | Syrian Pound                        |\n| SZL  | Swazi Lilangeni                     |\n| THB  | Thai Baht                           |\n| TJS  | Tajikistani Somoni                  |\n| TMT  | Turkmenistani Manat                 |\n| TND  | Tunisian Dinar                      |\n| TOP  | Tongan Paʻanga                      |\n| TRY  | Turkish Lira                        |\n| TTD  | Trinidad and Tobago Dollar          |\n| TWD  | New Taiwan Dollar                   |\n| TZS  | Tanzanian Shilling                  |\n| UAH  | Ukrainian Hryvnia                   |\n| UGX  | Ugandan Shilling                    |\n| USD  | United States Dollar                |\n| UYU  | Uruguayan Peso                      |\n| UZS  | Uzbekistan Som                      |\n| VEF  | Venezuelan Bolívar Fuerte           |\n| VND  | Vietnamese Dong                     |\n| VUV  | Vanuatu Vatu                        |\n| WST  | Samoan Tala                         |\n| XAF  | CFA Franc BEAC                      |\n| XAG  | Silver (troy ounce)                 |\n| XAU  | Gold (troy ounce)                   |\n| XCD  | East Caribbean Dollar               |\n| XDR  | Special Drawing Rights              |\n| XOF  | CFA Franc BCEAO                     |\n| XPF  | CFP Franc                           |\n| YER  | Yemeni Rial                         |\n| ZAR  | South African Rand                  |\n| ZMK  | Zambian Kwacha (pre-2013)           |\n| ZMW  | Zambian Kwacha                      |\n| ZWL  | Zimbabwean Dollar                   |\n\n## License\n\n[MIT](/LICENSE)\n","readmeFilename":"README.md"}