Browse Source

Add currency api

master
sipp11 9 years ago
parent
commit
e32dfcc478
  1. 39
      api/controllers/CurrencyController.js
  2. 29
      api/models/Currency.js
  3. 1
      config/routes.js
  4. 179
      py_processor/currencycode-iso4217.csv
  5. 57
      py_processor/iso4217.py

39
api/controllers/CurrencyController.js

@ -0,0 +1,39 @@
/**
* CurrencyController
*
* @description :: Server-side logic for managing currencies
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
*/
module.exports = {
search: function(req, res) {
var word = req.param('query'),
query = Currency.find();
if (word != undefined)
query = Currency.find({
where: {
or: [
{currency: {contains: word}},
{code: word},
{country: {contains: word}},
]
},
sort: {
code: 1
}
});
page = ((req.query.page != undefined) ? +req.query.page : 1);
query.paginate({page: page, limit: 10}).exec(function(err, items) {
if (err) {
res.send(400);
} else {
res.send(items);
}
});
}
};

29
api/models/Currency.js

@ -0,0 +1,29 @@
/**
* Currency.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/#!documentation/models
*/
module.exports = {
attributes: {
code: {
type: 'string'
},
num: {
type: 'integer'
},
decimalpoint: {
type: 'integer'
},
country: {
type: 'array'
},
}
};

1
config/routes.js

@ -47,6 +47,7 @@ module.exports.routes = {
***************************************************************************/ ***************************************************************************/
'GET /nationality/search/:query': 'NationalityController.search', 'GET /nationality/search/:query': 'NationalityController.search',
'GET /flag/search/:query': 'FlagController.search', 'GET /flag/search/:query': 'FlagController.search',
'GET /currency/search/:query': 'CurrencyController.search',
'GET /prefix/search/:query': 'PrefixController.search', 'GET /prefix/search/:query': 'PrefixController.search',
'GET /objreference/search/:query': 'ObjReferenceController.search', 'GET /objreference/search/:query': 'ObjReferenceController.search',
'GET /useractivity/search/:query': 'UserActivityController.search', 'GET /useractivity/search/:query': 'UserActivityController.search',

179
py_processor/currencycode-iso4217.csv

@ -0,0 +1,179 @@
Code,Num,Decimal point,Currency,Locations using this currency
AED,784,2,United Arab Emirates dirham,United Arab Emirates
AFN,971,2,Afghan afghani,Afghanistan
ALL,8,2,Albanian lek,Albania
AMD,51,2,Armenian dram,Armenia
ANG,532,2,Netherlands Antillean guilder,"Curaçao (CW), Sint Maarten (SX)"
AOA,973,2,Angolan kwanza,Angola
ARS,32,2,Argentine peso,Argentina
AUD,36,2,Australian dollar,"Australia, Christmas Island (CX), Cocos (Keeling) Islands (CC), Heard Island and McDonald Islands (HM), Kiribati (KI), Nauru (NR), Norfolk Island (NF), Tuvalu (TV), Australian Antarctic Territory"
AWG,533,2,Aruban florin,Aruba
AZN,944,2,Azerbaijani manat,Azerbaijan
BAM,977,2,Bosnia and Herzegovina convertible mark,Bosnia and Herzegovina
BBD,52,2,Barbados dollar,Barbados
BDT,50,2,Bangladeshi taka,Bangladesh
BGN,975,2,Bulgarian lev,Bulgaria
BHD,48,3,Bahraini dinar,Bahrain
BIF,108,0,Burundian franc,Burundi
BMD,60,2,Bermudian dollar,Bermuda
BND,96,2,Brunei dollar,"Brunei, auxiliary in Singapore (SG)"
BOB,68,2,Boliviano,Bolivia
BOV,984,2,Bolivian Mvdol (funds code),Bolivia
BRL,986,2,Brazilian real,Brazil
BSD,44,2,Bahamian dollar,Bahamas
BTN,64,2,Bhutanese ngultrum,Bhutan
BWP,72,2,Botswana pula,Botswana
BYR,974,0,Belarusian ruble,Belarus
BZD,84,2,Belize dollar,Belize
CAD,124,2,Canadian dollar,Canada
CDF,976,2,Congolese franc,Democratic Republic of the Congo
CHE,947,2,WIR Euro (complementary currency),Switzerland
CHF,756,2,Swiss franc,"Switzerland, Liechtenstein (LI)"
CHW,948,2,WIR Franc (complementary currency),Switzerland
CLF,990,4,Unidad de Fomento (funds code),Chile
CLP,152,0,Chilean peso,Chile
CNY,156,2,Chinese yuan,China
COP,170,2,Colombian peso,Colombia
COU,970,2[7],Unidad de Valor Real (UVR) (funds code)[7],Colombia
CRC,188,2,Costa Rican colon,Costa Rica
CUC,931,2,Cuban convertible peso,Cuba
CUP,192,2,Cuban peso,Cuba
CVE,132,0,Cape Verde escudo,Cape Verde
CZK,203,2,Czech koruna,Czech Republic
DJF,262,0,Djiboutian franc,Djibouti
DKK,208,2,Danish krone,"Denmark, Faroe Islands (FO), Greenland (GL)"
DOP,214,2,Dominican peso,Dominican Republic
DZD,12,2,Algerian dinar,Algeria
EGP,818,2,Egyptian pound,"Egypt, auxiliary in Gaza Strip"
ERN,232,2,Eritrean nakfa,Eritrea
ETB,230,2,Ethiopian birr,Ethiopia
EUR,978,2,Euro,"Akrotiri and Dhekelia, Andorra (AD), Austria (AT), Belgium (BE), Cyprus (CY), Estonia (EE), Finland(FI), France (FR), Germany (DE), Greece (GR), Guadeloupe (GP), Ireland (IE), Italy (IT), Kosovo, Latvia (LV), Lithuania (LT), Luxembourg (LU), Malta (MT), Martinique (MQ), Mayotte (YT), Monaco (MC), Montenegro (ME), Netherlands (NL), Portugal (PT), Réunion (RE), Saint Barthélemy (BL), Saint Pierre and Miquelon (PM), San Marino (SM), Slovakia (SK), Slovenia (SI), Spain (ES), Vatican City (VA); see Eurozone"
FJD,242,2,Fiji dollar,Fiji
FKP,238,2,Falkland Islands pound,Falkland Islands (pegged to GBP 1:1)
GBP,826,2,Pound sterling,"United Kingdom, the Isle of Man (IM, see Manx pound), Jersey (JE, see Jersey pound), Guernsey (GG, seeGuernsey pound), South Georgia and the South Sandwich Islands (GS), British Indian Ocean Territory (IO) (also uses USD), Tristan da Cunha (SH-TA), and British Antarctic Territory"
GEL,981,2,Georgian lari,Georgia (except Abkhazia (GE-AB) and South Ossetia)
GHS,936,2,Ghanaian cedi,Ghana
GIP,292,2,Gibraltar pound,Gibraltar (pegged to GBP 1:1)
GMD,270,2,Gambian dalasi,Gambia
GNF,324,0,Guinean franc,Guinea
GTQ,320,2,Guatemalan quetzal,Guatemala
GYD,328,2,Guyanese dollar,Guyana
HKD,344,2,Hong Kong dollar,"Hong Kong, Macao (MO)"
HNL,340,2,Honduran lempira,Honduras
HRK,191,2,Croatian kuna,Croatia
HTG,332,2,Haitian gourde,Haiti
HUF,348,2,Hungarian forint,Hungary
IDR,360,2,Indonesian rupiah,Indonesia
ILS,376,2,Israeli new shekel,"Israel, State of Palestine (PS)[8]"
INR,356,2,Indian rupee,"India, Bhutan, Nepal,"
IQD,368,3,Iraqi dinar,Iraq
IRR,364,2,Iranian rial,Iran
ISK,352,0,Icelandic krĂłna,Iceland
JMD,388,2,Jamaican dollar,Jamaica
JOD,400,3,Jordanian dinar,"Jordan, auxiliary in West Bank"
JPY,392,0,Japanese yen,Japan
KES,404,2,Kenyan shilling,Kenya
KGS,417,2,Kyrgyzstani som,Kyrgyzstan
KHR,116,2,Cambodian riel,Cambodia
KMF,174,0,Comoro franc,Comoros
KPW,408,2,North Korean won,North Korea
KRW,410,0,South Korean won,South Korea
KWD,414,3,Kuwaiti dinar,Kuwait
KYD,136,2,Cayman Islands dollar,Cayman Islands
KZT,398,2,Kazakhstani tenge,Kazakhstan
LAK,418,2,Lao kip,Laos
LBP,422,2,Lebanese pound,Lebanon
LKR,144,2,Sri Lankan rupee,Sri Lanka
LRD,430,2,Liberian dollar,Liberia
LSL,426,2,Lesotho loti,Lesotho
LYD,434,3,Libyan dinar,Libya
MAD,504,2,Moroccan dirham,Morocco
MDL,498,2,Moldovan leu,Moldova (except Transnistria)
MGA,969,1*[9],Malagasy ariary,Madagascar
MKD,807,2,Macedonian denar,Macedonia
MMK,104,2,Myanmar kyat,Myanmar
MNT,496,2,Mongolian tugrik,Mongolia
MOP,446,2,Macanese pataca,Macao
MRO,478,1*[9],Mauritanian ouguiya,Mauritania
MUR,480,2,Mauritian rupee,Mauritius
MVR,462,2,Maldivian rufiyaa,Maldives
MWK,454,2,Malawian kwacha,Malawi
MXN,484,2,Mexican peso,Mexico
MXV,979,2,Mexican Unidad de Inversion(UDI) (funds code),Mexico
MYR,458,2,Malaysian ringgit,Malaysia
MZN,943,2,Mozambican metical,Mozambique
NAD,516,2,Namibian dollar,Namibia
NGN,566,2,Nigerian naira,Nigeria
NIO,558,2,Nicaraguan cĂłrdoba,Nicaragua
NOK,578,2,Norwegian krone,"Norway, Svalbard and Jan Mayen (SJ), Bouvet Island (BV), Queen Maud Land, Peter I Island"
NPR,524,2,Nepalese rupee,Nepal
NZD,554,2,New Zealand dollar,"New Zealand, Cook Islands (CK), Niue (NU), Pitcairn Islands (PN; see also Pitcairn Islands dollar), Tokelau(TK), Ross Dependency"
OMR,512,3,Omani rial,Oman
PAB,590,2,Panamanian balboa,Panama
PEN,604,2,Peruvian nuevo sol,Peru
PGK,598,2,Papua New Guinean kina,Papua New Guinea
PHP,608,2,Philippine peso,Philippines
PKR,586,2,Pakistani rupee,Pakistan
PLN,985,2,Polish złoty,Poland
PYG,600,0,Paraguayan guaranĂ­,Paraguay
QAR,634,2,Qatari riyal,Qatar
RON,946,2,Romanian leu,Romania
RSD,941,2,Serbian dinar,Serbia
RUB,643,2,Russian ruble,"Russia, Abkhazia (GE-AB), South Ossetia, Crimea"
RWF,646,0,Rwandan franc,Rwanda
SAR,682,2,Saudi riyal,Saudi Arabia
SBD,90,2,Solomon Islands dollar,Solomon Islands
SCR,690,2,Seychelles rupee,Seychelles
SDG,938,2,Sudanese pound,Sudan
SEK,752,2,Swedish krona/kronor,Sweden
SGD,702,2,Singapore dollar,"Singapore, auxiliary in Brunei (BN)"
SHP,654,2,Saint Helena pound,"Saint Helena (SH-SH), Ascension Island (SH-AC) (pegged to GBP 1:1)"
SLL,694,2,Sierra Leonean leone,Sierra Leone
SOS,706,2,Somali shilling,Somalia (except Somaliland)
SRD,968,2,Surinamese dollar,Suriname
SSP,728,2,South Sudanese pound,South Sudan
STD,678,2,São Tomé and Príncipe dobra,São Tomé and Príncipe
SYP,760,2,Syrian pound,Syria
SZL,748,2,Swazi lilangeni,Swaziland
THB,764,2,Thai baht,"Thailand , Cambodia , Myanmar , Laos"
TJS,972,2,Tajikistani somoni,Tajikistan
TMT,934,2,Turkmenistani manat,Turkmenistan
TND,788,3,Tunisian dinar,Tunisia
TOP,776,2,Tongan paʻanga,Tonga
TRY,949,2,Turkish lira,"Turkey , Northern Cyprus"
TTD,780,2,Trinidad and Tobago dollar,Trinidad and Tobago
TWD,901,2,New Taiwan dollar,Taiwan
TZS,834,2,Tanzanian shilling,Tanzania
UAH,980,2,Ukrainian hryvnia,Ukraine
UGX,800,0,Ugandan shilling,Uganda
USD,840,2,United States dollar,"United States, American Samoa (AS), Barbados (BB) (as well as Barbados Dollar), Bermuda (BM) (as well asBermudian Dollar), British Indian Ocean Territory (IO) (also uses GBP), British Virgin Islands (VG), Caribbean Netherlands(BQ - Bonaire, Sint Eustatius and Saba), Ecuador (EC), El Salvador (SV), Guam (GU), Haiti (HT), Marshall Islands (MH), Federated States of Micronesia (FM), Northern Mariana Islands (MP), Palau (PW), Panama (PA), Puerto Rico (PR), Timor-Leste (TL), Turks and Caicos Islands (TC), U.S. Virgin Islands (VI), Zimbabwe (ZW),"
USN,997,2,United States dollar (next day) (funds code),United States
USS,998,2,United States dollar (same day) (funds code)[10],United States
UYI,940,0,Uruguay Peso en Unidades Indexadas (URUIURUI) (funds code),Uruguay
UYU,858,2,Uruguayan peso,Uruguay
UZS,860,2,Uzbekistan som,Uzbekistan
VEF,937,2,Venezuelan bolĂ­var,Venezuela
VND,704,0,Vietnamese dong,Vietnam
VUV,548,0,Vanuatu vatu,Vanuatu
WST,882,2,Samoan tala,Samoa
XAF,950,0,CFA franc BEAC,"Cameroon (CM), Central African Republic (CF), Republic of the Congo (CG), Chad (TD), Equatorial Guinea(GQ), Gabon (GA)"
XAG,961,.,Silver (one troy ounce),
XAU,959,.,Gold (one troy ounce),
XBA,955,.,European Composite Unit(EURCO) (bond market unit),
XBB,956,.,European Monetary Unit(E.M.U.-6) (bond market unit),
XBC,957,.,European Unit of Account 9(E.U.A.-9) (bond market unit),
XBD,958,.,European Unit of Account 17(E.U.A.-17) (bond market unit),
XCD,951,2,East Caribbean dollar,"Anguilla (AI), Antigua and Barbuda (AG), Dominica (DM), Grenada (GD), Montserrat (MS), Saint Kitts and Nevis (KN), Saint Lucia (LC), Saint Vincent and the Grenadines (VC)"
XDR,960,.,Special drawing rights,International Monetary Fund
XFU,Nil,.,UIC franc(special settlement currency),International Union of Railways
XOF,952,0,CFA franc BCEAO,"Benin (BJ), Burkina Faso (BF), CĂ´te d'Ivoire (CI), Guinea-Bissau (GW), Mali (ML), Niger (NE), Senegal(SN), Togo (TG)"
XPD,964,.,Palladium (onetroy ounce),
XPF,953,0,CFP franc(franc Pacifique),"French territories of the Pacific Ocean: French Polynesia (PF), New Caledonia (NC), Wallis and Futuna (WF)"
XPT,962,.,Platinum (onetroy ounce),
XSU,994,.,SUCRE,Unified System for Regional Compensation (SUCRE)[11]
XTS,963,.,Code reserved for testing purposes,
XUA,965,.,ADB Unit of Account,African Development Bank[12]
XXX,999,.,No currency,
YER,886,2,Yemeni rial,Yemen
ZAR,710,2,South African rand,South Africa
ZMW,967,2,Zambian kwacha,Zambia
1 Code Num Decimal point Currency Locations using this currency
2 AED 784 2 United Arab Emirates dirham United Arab Emirates
3 AFN 971 2 Afghan afghani Afghanistan
4 ALL 8 2 Albanian lek Albania
5 AMD 51 2 Armenian dram Armenia
6 ANG 532 2 Netherlands Antillean guilder Curaçao (CW), Sint Maarten (SX)
7 AOA 973 2 Angolan kwanza Angola
8 ARS 32 2 Argentine peso Argentina
9 AUD 36 2 Australian dollar Australia, Christmas Island (CX), Cocos (Keeling) Islands (CC), Heard Island and McDonald Islands (HM), Kiribati (KI), Nauru (NR), Norfolk Island (NF), Tuvalu (TV), Australian Antarctic Territory
10 AWG 533 2 Aruban florin Aruba
11 AZN 944 2 Azerbaijani manat Azerbaijan
12 BAM 977 2 Bosnia and Herzegovina convertible mark Bosnia and Herzegovina
13 BBD 52 2 Barbados dollar Barbados
14 BDT 50 2 Bangladeshi taka Bangladesh
15 BGN 975 2 Bulgarian lev Bulgaria
16 BHD 48 3 Bahraini dinar Bahrain
17 BIF 108 0 Burundian franc Burundi
18 BMD 60 2 Bermudian dollar Bermuda
19 BND 96 2 Brunei dollar Brunei, auxiliary in Singapore (SG)
20 BOB 68 2 Boliviano Bolivia
21 BOV 984 2 Bolivian Mvdol (funds code) Bolivia
22 BRL 986 2 Brazilian real Brazil
23 BSD 44 2 Bahamian dollar Bahamas
24 BTN 64 2 Bhutanese ngultrum Bhutan
25 BWP 72 2 Botswana pula Botswana
26 BYR 974 0 Belarusian ruble Belarus
27 BZD 84 2 Belize dollar Belize
28 CAD 124 2 Canadian dollar Canada
29 CDF 976 2 Congolese franc Democratic Republic of the Congo
30 CHE 947 2 WIR Euro (complementary currency) Switzerland
31 CHF 756 2 Swiss franc Switzerland, Liechtenstein (LI)
32 CHW 948 2 WIR Franc (complementary currency) Switzerland
33 CLF 990 4 Unidad de Fomento (funds code) Chile
34 CLP 152 0 Chilean peso Chile
35 CNY 156 2 Chinese yuan China
36 COP 170 2 Colombian peso Colombia
37 COU 970 2[7] Unidad de Valor Real (UVR) (funds code)[7] Colombia
38 CRC 188 2 Costa Rican colon Costa Rica
39 CUC 931 2 Cuban convertible peso Cuba
40 CUP 192 2 Cuban peso Cuba
41 CVE 132 0 Cape Verde escudo Cape Verde
42 CZK 203 2 Czech koruna Czech Republic
43 DJF 262 0 Djiboutian franc Djibouti
44 DKK 208 2 Danish krone Denmark, Faroe Islands (FO), Greenland (GL)
45 DOP 214 2 Dominican peso Dominican Republic
46 DZD 12 2 Algerian dinar Algeria
47 EGP 818 2 Egyptian pound Egypt, auxiliary in Gaza Strip
48 ERN 232 2 Eritrean nakfa Eritrea
49 ETB 230 2 Ethiopian birr Ethiopia
50 EUR 978 2 Euro Akrotiri and Dhekelia, Andorra (AD), Austria (AT), Belgium (BE), Cyprus (CY), Estonia (EE), Finland(FI), France (FR), Germany (DE), Greece (GR), Guadeloupe (GP), Ireland (IE), Italy (IT), Kosovo, Latvia (LV), Lithuania (LT), Luxembourg (LU), Malta (MT), Martinique (MQ), Mayotte (YT), Monaco (MC), Montenegro (ME), Netherlands (NL), Portugal (PT), Réunion (RE), Saint Barthélemy (BL), Saint Pierre and Miquelon (PM), San Marino (SM), Slovakia (SK), Slovenia (SI), Spain (ES), Vatican City (VA); see Eurozone
51 FJD 242 2 Fiji dollar Fiji
52 FKP 238 2 Falkland Islands pound Falkland Islands (pegged to GBP 1:1)
53 GBP 826 2 Pound sterling United Kingdom, the Isle of Man (IM, see Manx pound), Jersey (JE, see Jersey pound), Guernsey (GG, seeGuernsey pound), South Georgia and the South Sandwich Islands (GS), British Indian Ocean Territory (IO) (also uses USD), Tristan da Cunha (SH-TA), and British Antarctic Territory
54 GEL 981 2 Georgian lari Georgia (except Abkhazia (GE-AB) and South Ossetia)
55 GHS 936 2 Ghanaian cedi Ghana
56 GIP 292 2 Gibraltar pound Gibraltar (pegged to GBP 1:1)
57 GMD 270 2 Gambian dalasi Gambia
58 GNF 324 0 Guinean franc Guinea
59 GTQ 320 2 Guatemalan quetzal Guatemala
60 GYD 328 2 Guyanese dollar Guyana
61 HKD 344 2 Hong Kong dollar Hong Kong, Macao (MO)
62 HNL 340 2 Honduran lempira Honduras
63 HRK 191 2 Croatian kuna Croatia
64 HTG 332 2 Haitian gourde Haiti
65 HUF 348 2 Hungarian forint Hungary
66 IDR 360 2 Indonesian rupiah Indonesia
67 ILS 376 2 Israeli new shekel Israel, State of Palestine (PS)[8]
68 INR 356 2 Indian rupee India, Bhutan, Nepal,
69 IQD 368 3 Iraqi dinar Iraq
70 IRR 364 2 Iranian rial Iran
71 ISK 352 0 Icelandic krĂłna Iceland
72 JMD 388 2 Jamaican dollar Jamaica
73 JOD 400 3 Jordanian dinar Jordan, auxiliary in West Bank
74 JPY 392 0 Japanese yen Japan
75 KES 404 2 Kenyan shilling Kenya
76 KGS 417 2 Kyrgyzstani som Kyrgyzstan
77 KHR 116 2 Cambodian riel Cambodia
78 KMF 174 0 Comoro franc Comoros
79 KPW 408 2 North Korean won North Korea
80 KRW 410 0 South Korean won South Korea
81 KWD 414 3 Kuwaiti dinar Kuwait
82 KYD 136 2 Cayman Islands dollar Cayman Islands
83 KZT 398 2 Kazakhstani tenge Kazakhstan
84 LAK 418 2 Lao kip Laos
85 LBP 422 2 Lebanese pound Lebanon
86 LKR 144 2 Sri Lankan rupee Sri Lanka
87 LRD 430 2 Liberian dollar Liberia
88 LSL 426 2 Lesotho loti Lesotho
89 LYD 434 3 Libyan dinar Libya
90 MAD 504 2 Moroccan dirham Morocco
91 MDL 498 2 Moldovan leu Moldova (except Transnistria)
92 MGA 969 1*[9] Malagasy ariary Madagascar
93 MKD 807 2 Macedonian denar Macedonia
94 MMK 104 2 Myanmar kyat Myanmar
95 MNT 496 2 Mongolian tugrik Mongolia
96 MOP 446 2 Macanese pataca Macao
97 MRO 478 1*[9] Mauritanian ouguiya Mauritania
98 MUR 480 2 Mauritian rupee Mauritius
99 MVR 462 2 Maldivian rufiyaa Maldives
100 MWK 454 2 Malawian kwacha Malawi
101 MXN 484 2 Mexican peso Mexico
102 MXV 979 2 Mexican Unidad de Inversion(UDI) (funds code) Mexico
103 MYR 458 2 Malaysian ringgit Malaysia
104 MZN 943 2 Mozambican metical Mozambique
105 NAD 516 2 Namibian dollar Namibia
106 NGN 566 2 Nigerian naira Nigeria
107 NIO 558 2 Nicaraguan cĂłrdoba Nicaragua
108 NOK 578 2 Norwegian krone Norway, Svalbard and Jan Mayen (SJ), Bouvet Island (BV), Queen Maud Land, Peter I Island
109 NPR 524 2 Nepalese rupee Nepal
110 NZD 554 2 New Zealand dollar New Zealand, Cook Islands (CK), Niue (NU), Pitcairn Islands (PN; see also Pitcairn Islands dollar), Tokelau(TK), Ross Dependency
111 OMR 512 3 Omani rial Oman
112 PAB 590 2 Panamanian balboa Panama
113 PEN 604 2 Peruvian nuevo sol Peru
114 PGK 598 2 Papua New Guinean kina Papua New Guinea
115 PHP 608 2 Philippine peso Philippines
116 PKR 586 2 Pakistani rupee Pakistan
117 PLN 985 2 Polish złoty Poland
118 PYG 600 0 Paraguayan guaranĂ­ Paraguay
119 QAR 634 2 Qatari riyal Qatar
120 RON 946 2 Romanian leu Romania
121 RSD 941 2 Serbian dinar Serbia
122 RUB 643 2 Russian ruble Russia, Abkhazia (GE-AB), South Ossetia, Crimea
123 RWF 646 0 Rwandan franc Rwanda
124 SAR 682 2 Saudi riyal Saudi Arabia
125 SBD 90 2 Solomon Islands dollar Solomon Islands
126 SCR 690 2 Seychelles rupee Seychelles
127 SDG 938 2 Sudanese pound Sudan
128 SEK 752 2 Swedish krona/kronor Sweden
129 SGD 702 2 Singapore dollar Singapore, auxiliary in Brunei (BN)
130 SHP 654 2 Saint Helena pound Saint Helena (SH-SH), Ascension Island (SH-AC) (pegged to GBP 1:1)
131 SLL 694 2 Sierra Leonean leone Sierra Leone
132 SOS 706 2 Somali shilling Somalia (except Somaliland)
133 SRD 968 2 Surinamese dollar Suriname
134 SSP 728 2 South Sudanese pound South Sudan
135 STD 678 2 São Tomé and Príncipe dobra São Tomé and Príncipe
136 SYP 760 2 Syrian pound Syria
137 SZL 748 2 Swazi lilangeni Swaziland
138 THB 764 2 Thai baht Thailand , Cambodia , Myanmar , Laos
139 TJS 972 2 Tajikistani somoni Tajikistan
140 TMT 934 2 Turkmenistani manat Turkmenistan
141 TND 788 3 Tunisian dinar Tunisia
142 TOP 776 2 Tongan paʻanga Tonga
143 TRY 949 2 Turkish lira Turkey , Northern Cyprus
144 TTD 780 2 Trinidad and Tobago dollar Trinidad and Tobago
145 TWD 901 2 New Taiwan dollar Taiwan
146 TZS 834 2 Tanzanian shilling Tanzania
147 UAH 980 2 Ukrainian hryvnia Ukraine
148 UGX 800 0 Ugandan shilling Uganda
149 USD 840 2 United States dollar United States, American Samoa (AS), Barbados (BB) (as well as Barbados Dollar), Bermuda (BM) (as well asBermudian Dollar), British Indian Ocean Territory (IO) (also uses GBP), British Virgin Islands (VG), Caribbean Netherlands(BQ - Bonaire, Sint Eustatius and Saba), Ecuador (EC), El Salvador (SV), Guam (GU), Haiti (HT), Marshall Islands (MH), Federated States of Micronesia (FM), Northern Mariana Islands (MP), Palau (PW), Panama (PA), Puerto Rico (PR), Timor-Leste (TL), Turks and Caicos Islands (TC), U.S. Virgin Islands (VI), Zimbabwe (ZW),
150 USN 997 2 United States dollar (next day) (funds code) United States
151 USS 998 2 United States dollar (same day) (funds code)[10] United States
152 UYI 940 0 Uruguay Peso en Unidades Indexadas (URUIURUI) (funds code) Uruguay
153 UYU 858 2 Uruguayan peso Uruguay
154 UZS 860 2 Uzbekistan som Uzbekistan
155 VEF 937 2 Venezuelan bolĂ­var Venezuela
156 VND 704 0 Vietnamese dong Vietnam
157 VUV 548 0 Vanuatu vatu Vanuatu
158 WST 882 2 Samoan tala Samoa
159 XAF 950 0 CFA franc BEAC Cameroon (CM), Central African Republic (CF), Republic of the Congo (CG), Chad (TD), Equatorial Guinea(GQ), Gabon (GA)
160 XAG 961 . Silver (one troy ounce)
161 XAU 959 . Gold (one troy ounce)
162 XBA 955 . European Composite Unit(EURCO) (bond market unit)
163 XBB 956 . European Monetary Unit(E.M.U.-6) (bond market unit)
164 XBC 957 . European Unit of Account 9(E.U.A.-9) (bond market unit)
165 XBD 958 . European Unit of Account 17(E.U.A.-17) (bond market unit)
166 XCD 951 2 East Caribbean dollar Anguilla (AI), Antigua and Barbuda (AG), Dominica (DM), Grenada (GD), Montserrat (MS), Saint Kitts and Nevis (KN), Saint Lucia (LC), Saint Vincent and the Grenadines (VC)
167 XDR 960 . Special drawing rights International Monetary Fund
168 XFU Nil . UIC franc(special settlement currency) International Union of Railways
169 XOF 952 0 CFA franc BCEAO Benin (BJ), Burkina Faso (BF), CĂ´te d'Ivoire (CI), Guinea-Bissau (GW), Mali (ML), Niger (NE), Senegal(SN), Togo (TG)
170 XPD 964 . Palladium (onetroy ounce)
171 XPF 953 0 CFP franc(franc Pacifique) French territories of the Pacific Ocean: French Polynesia (PF), New Caledonia (NC), Wallis and Futuna (WF)
172 XPT 962 . Platinum (onetroy ounce)
173 XSU 994 . SUCRE Unified System for Regional Compensation (SUCRE)[11]
174 XTS 963 . Code reserved for testing purposes
175 XUA 965 . ADB Unit of Account African Development Bank[12]
176 XXX 999 . No currency
177 YER 886 2 Yemeni rial Yemen
178 ZAR 710 2 South African rand South Africa
179 ZMW 967 2 Zambian kwacha Zambia

57
py_processor/iso4217.py

@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
from pymongo import MongoClient
from pymongo import DESCENDING
import csv
import re
MONGO_CONF = {
'host': 'localhost',
'port': 27017,
}
conn = MongoClient(**MONGO_CONF)
db = conn.yeti
collection = db.currency
def dictify_data(row):
cs = []
for c in row[4].split(', '):
cx = re.sub(r'\[\d+\]', '', c)
cx = cx.strip()
cs.append(cx)
try:
num = int(row[1])
except:
num = 0
try:
decimal = int(row[2].replace('[7]', '').replace('*[9]', ''))
except ValueError:
decimal = 0
result = {
'code': row[0],
'num': num,
'decimalpoint': decimal,
'currency': row[3],
'country': cs
}
return result
def push_to_mongo(data):
return collection.insert(data)
def main():
with open('currencycode-iso4217.csv', 'rb') as f:
csf = csv.reader(f)
csf.next()
for row in csf:
d = dictify_data(row)
r = push_to_mongo(d)
# print d
print r
if __name__ == '__main__':
main()
Loading…
Cancel
Save