Added currency exchange data

This commit is contained in:
DrMint 2024-02-24 18:42:52 +01:00
parent 07f6375b46
commit 8fc4b6a5c4
4 changed files with 389 additions and 1 deletions

View File

@ -9,7 +9,8 @@
"preview": "astro preview",
"astro": "astro",
"upgrade": "ncu",
"script:download-payload-sdk": "bun run scripts/download-payload-sdk.ts"
"script:download-payload-sdk": "bun run scripts/download-payload-sdk.ts",
"script:download-currencies": "bun run scripts/download-currencies.ts"
},
"dependencies": {
"@astrojs/check": "^0.5.4",

View File

@ -0,0 +1,38 @@
import { writeFileSync } from "fs";
const OPEN_EXCHANGE_FOLDER = `${process.cwd()}/src/shared/openExchange`;
const ratesUrl = `https://openexchangerates.org/api/latest.json?app_id=${
import.meta.env.OER_APP_ID
}`;
const currenciesUrl = `https://openexchangerates.org/api/currencies.json?app_id=${
import.meta.env.OER_APP_ID
}`;
const rates = await fetch(ratesUrl);
if (rates.ok) {
writeFileSync(`${OPEN_EXCHANGE_FOLDER}/rates.json`, await rates.text(), {
encoding: "utf-8",
});
} else {
console.error("Failed to get the rates", rates.status, rates.statusText);
}
const currencies = await fetch(currenciesUrl);
if (currencies.ok) {
writeFileSync(
`${OPEN_EXCHANGE_FOLDER}/currencies.json`,
await currencies.text(),
{
encoding: "utf-8",
}
);
} else {
console.error(
"Failed to get the currencies",
currencies.status,
currencies.statusText
);
}

View File

@ -0,0 +1,172 @@
{
"AED": "United Arab Emirates Dirham",
"AFN": "Afghan Afghani",
"ALL": "Albanian Lek",
"AMD": "Armenian Dram",
"ANG": "Netherlands Antillean Guilder",
"AOA": "Angolan Kwanza",
"ARS": "Argentine Peso",
"AUD": "Australian Dollar",
"AWG": "Aruban Florin",
"AZN": "Azerbaijani Manat",
"BAM": "Bosnia-Herzegovina Convertible Mark",
"BBD": "Barbadian Dollar",
"BDT": "Bangladeshi Taka",
"BGN": "Bulgarian Lev",
"BHD": "Bahraini Dinar",
"BIF": "Burundian Franc",
"BMD": "Bermudan Dollar",
"BND": "Brunei Dollar",
"BOB": "Bolivian Boliviano",
"BRL": "Brazilian Real",
"BSD": "Bahamian Dollar",
"BTC": "Bitcoin",
"BTN": "Bhutanese Ngultrum",
"BWP": "Botswanan Pula",
"BYN": "Belarusian Ruble",
"BZD": "Belize Dollar",
"CAD": "Canadian Dollar",
"CDF": "Congolese Franc",
"CHF": "Swiss Franc",
"CLF": "Chilean Unit of Account (UF)",
"CLP": "Chilean Peso",
"CNH": "Chinese Yuan (Offshore)",
"CNY": "Chinese Yuan",
"COP": "Colombian Peso",
"CRC": "Costa Rican Colón",
"CUC": "Cuban Convertible Peso",
"CUP": "Cuban Peso",
"CVE": "Cape Verdean Escudo",
"CZK": "Czech Republic Koruna",
"DJF": "Djiboutian Franc",
"DKK": "Danish Krone",
"DOP": "Dominican Peso",
"DZD": "Algerian Dinar",
"EGP": "Egyptian Pound",
"ERN": "Eritrean Nakfa",
"ETB": "Ethiopian Birr",
"EUR": "Euro",
"FJD": "Fijian Dollar",
"FKP": "Falkland Islands Pound",
"GBP": "British Pound Sterling",
"GEL": "Georgian Lari",
"GGP": "Guernsey Pound",
"GHS": "Ghanaian Cedi",
"GIP": "Gibraltar Pound",
"GMD": "Gambian Dalasi",
"GNF": "Guinean Franc",
"GTQ": "Guatemalan Quetzal",
"GYD": "Guyanaese Dollar",
"HKD": "Hong Kong Dollar",
"HNL": "Honduran Lempira",
"HRK": "Croatian Kuna",
"HTG": "Haitian Gourde",
"HUF": "Hungarian Forint",
"IDR": "Indonesian Rupiah",
"ILS": "Israeli New Sheqel",
"IMP": "Manx pound",
"INR": "Indian Rupee",
"IQD": "Iraqi Dinar",
"IRR": "Iranian Rial",
"ISK": "Icelandic Króna",
"JEP": "Jersey Pound",
"JMD": "Jamaican Dollar",
"JOD": "Jordanian Dinar",
"JPY": "Japanese Yen",
"KES": "Kenyan Shilling",
"KGS": "Kyrgystani Som",
"KHR": "Cambodian Riel",
"KMF": "Comorian Franc",
"KPW": "North Korean Won",
"KRW": "South Korean Won",
"KWD": "Kuwaiti Dinar",
"KYD": "Cayman Islands Dollar",
"KZT": "Kazakhstani Tenge",
"LAK": "Laotian Kip",
"LBP": "Lebanese Pound",
"LKR": "Sri Lankan Rupee",
"LRD": "Liberian Dollar",
"LSL": "Lesotho Loti",
"LYD": "Libyan Dinar",
"MAD": "Moroccan Dirham",
"MDL": "Moldovan Leu",
"MGA": "Malagasy Ariary",
"MKD": "Macedonian Denar",
"MMK": "Myanma Kyat",
"MNT": "Mongolian Tugrik",
"MOP": "Macanese Pataca",
"MRU": "Mauritanian Ouguiya",
"MUR": "Mauritian Rupee",
"MVR": "Maldivian Rufiyaa",
"MWK": "Malawian Kwacha",
"MXN": "Mexican Peso",
"MYR": "Malaysian Ringgit",
"MZN": "Mozambican Metical",
"NAD": "Namibian Dollar",
"NGN": "Nigerian Naira",
"NIO": "Nicaraguan Córdoba",
"NOK": "Norwegian Krone",
"NPR": "Nepalese Rupee",
"NZD": "New Zealand Dollar",
"OMR": "Omani Rial",
"PAB": "Panamanian Balboa",
"PEN": "Peruvian Nuevo Sol",
"PGK": "Papua New Guinean Kina",
"PHP": "Philippine Peso",
"PKR": "Pakistani Rupee",
"PLN": "Polish Zloty",
"PYG": "Paraguayan Guarani",
"QAR": "Qatari Rial",
"RON": "Romanian Leu",
"RSD": "Serbian Dinar",
"RUB": "Russian Ruble",
"RWF": "Rwandan Franc",
"SAR": "Saudi Riyal",
"SBD": "Solomon Islands Dollar",
"SCR": "Seychellois Rupee",
"SDG": "Sudanese Pound",
"SEK": "Swedish Krona",
"SGD": "Singapore Dollar",
"SHP": "Saint Helena Pound",
"SLL": "Sierra Leonean Leone",
"SOS": "Somali Shilling",
"SRD": "Surinamese Dollar",
"SSP": "South Sudanese Pound",
"STD": "São Tomé and Príncipe Dobra (pre-2018)",
"STN": "São Tomé and Príncipe Dobra",
"SVC": "Salvadoran Colón",
"SYP": "Syrian Pound",
"SZL": "Swazi Lilangeni",
"THB": "Thai Baht",
"TJS": "Tajikistani Somoni",
"TMT": "Turkmenistani Manat",
"TND": "Tunisian Dinar",
"TOP": "Tongan Pa'anga",
"TRY": "Turkish Lira",
"TTD": "Trinidad and Tobago Dollar",
"TWD": "New Taiwan Dollar",
"TZS": "Tanzanian Shilling",
"UAH": "Ukrainian Hryvnia",
"UGX": "Ugandan Shilling",
"USD": "United States Dollar",
"UYU": "Uruguayan Peso",
"UZS": "Uzbekistan Som",
"VEF": "Venezuelan Bolívar Fuerte (Old)",
"VES": "Venezuelan Bolívar Soberano",
"VND": "Vietnamese Dong",
"VUV": "Vanuatu Vatu",
"WST": "Samoan Tala",
"XAF": "CFA Franc BEAC",
"XAG": "Silver Ounce",
"XAU": "Gold Ounce",
"XCD": "East Caribbean Dollar",
"XDR": "Special Drawing Rights",
"XOF": "CFA Franc BCEAO",
"XPD": "Palladium Ounce",
"XPF": "CFP Franc",
"XPT": "Platinum Ounce",
"YER": "Yemeni Rial",
"ZAR": "South African Rand",
"ZMW": "Zambian Kwacha",
"ZWL": "Zimbabwean Dollar"
}

View File

@ -0,0 +1,177 @@
{
"disclaimer": "Usage subject to terms: https://openexchangerates.org/terms",
"license": "https://openexchangerates.org/license",
"timestamp": 1708779609,
"base": "USD",
"rates": {
"AED": 3.673,
"AFN": 72.50001,
"ALL": 95.741233,
"AMD": 405.666135,
"ANG": 1.800674,
"AOA": 831.5,
"ARS": 837.615005,
"AUD": 1.525553,
"AWG": 1.8,
"AZN": 1.7,
"BAM": 1.804826,
"BBD": 2,
"BDT": 109.657196,
"BGN": 1.804826,
"BHD": 0.376764,
"BIF": 2866,
"BMD": 1,
"BND": 1.344887,
"BOB": 6.90352,
"BRL": 4.9955,
"BSD": 1,
"BTC": 0.000019582906,
"BTN": 83.045533,
"BWP": 13.736447,
"BYN": 3.26969,
"BZD": 2.013934,
"CAD": 1.34865,
"CDF": 2763.615809,
"CHF": 0.88059,
"CLF": 0.035523,
"CLP": 980.2,
"CNH": 7.2038,
"CNY": 7.1949,
"COP": 3925.16035,
"CRC": 514.096076,
"CUC": 1,
"CUP": 25.75,
"CVE": 101.753323,
"CZK": 23.4281,
"DJF": 177.917221,
"DKK": 6.88885,
"DOP": 58.708992,
"DZD": 134.498,
"EGP": 30.9,
"ERN": 15,
"ETB": 56.66553,
"EUR": 0.92315,
"FJD": 2.2352,
"FKP": 0.788706,
"GBP": 0.788706,
"GEL": 2.65,
"GGP": 0.788706,
"GHS": 12.539104,
"GIP": 0.788706,
"GMD": 67.275,
"GNF": 8595,
"GTQ": 7.807872,
"GYD": 209.034301,
"HKD": 7.8221,
"HNL": 24.669403,
"HRK": 6.96308,
"HTG": 132.721527,
"HUF": 359.514887,
"IDR": 15594.15,
"ILS": 3.63115,
"IMP": 0.788706,
"INR": 82.88195,
"IQD": 1308.817913,
"IRR": 42032.5,
"ISK": 137.8,
"JEP": 0.788706,
"JMD": 156.268155,
"JOD": 0.709,
"JPY": 150.48501336,
"KES": 143.376564,
"KGS": 89.43,
"KHR": 4080,
"KMF": 454.950092,
"KPW": 900,
"KRW": 1331,
"KWD": 0.307735,
"KYD": 0.832649,
"KZT": 450.61631,
"LAK": 20848.022178,
"LBP": 89399.224549,
"LKR": 310.644628,
"LRD": 190.650011,
"LSL": 19.023588,
"LYD": 4.826282,
"MAD": 10.030637,
"MDL": 17.88954,
"MGA": 4532.835312,
"MKD": 56.858767,
"MMK": 2098.190404,
"MNT": 3450,
"MOP": 8.051216,
"MRU": 39.915102,
"MUR": 45.735945,
"MVR": 15.4,
"MWK": 1681.909174,
"MXN": 17.1162,
"MYR": 4.7775,
"MZN": 63.850001,
"NAD": 19.023588,
"NGN": 1469.112057,
"NIO": 36.813954,
"NOK": 10.537366,
"NPR": 132.873147,
"NZD": 1.613164,
"OMR": 0.38496,
"PAB": 1,
"PEN": 3.786924,
"PGK": 3.811565,
"PHP": 55.935001,
"PKR": 279.130048,
"PLN": 3.979237,
"PYG": 7273.608817,
"QAR": 3.645458,
"RON": 4.5979,
"RSD": 108.338,
"RUB": 94.78673,
"RWF": 1274.303976,
"SAR": 3.750554,
"SBD": 8.500465,
"SCR": 13.493,
"SDG": 601,
"SEK": 10.3298,
"SGD": 1.343,
"SHP": 0.788706,
"SLL": 20969.5,
"SOS": 571.033242,
"SRD": 35.701,
"SSP": 130.26,
"STD": 22281.8,
"STN": 23.12,
"SVC": 8.742675,
"SYP": 2512.53,
"SZL": 19.018416,
"THB": 35.86767,
"TJS": 10.940433,
"TMT": 3.51,
"TND": 3.1235,
"TOP": 2.360341,
"TRY": 30.818685,
"TTD": 6.790938,
"TWD": 31.617,
"TZS": 2550,
"UAH": 38.242329,
"UGX": 3903.120879,
"USD": 1,
"UYU": 39.080883,
"UZS": 12479.072451,
"VES": 36.186223,
"VND": 24639.648555,
"VUV": 118.722,
"WST": 2.8,
"XAF": 605.546705,
"XAG": 0.04357204,
"XAU": 0.00049126,
"XCD": 2.70255,
"XDR": 0.75421,
"XOF": 605.546705,
"XPD": 0.00102701,
"XPF": 110.161098,
"XPT": 0.00111006,
"YER": 250.349961,
"ZAR": 19.29,
"ZMW": 22.954829,
"ZWL": 322
}
}