0.0.171 • Published 3 days ago

freechange v0.0.171

Weekly downloads
7
License
MIT
Repository
github
Last release
3 days ago

Freechange is a javascript module and data to perform historical currency exchange.

View on npmTry on RunkitWebsite

Installation and usage

npm install freechange

This will include a few meg of historical json, so be warned we are very data heavy. See below for options to reduce this size.

var freechange = require("freechange")

console.log( freechange.by_date(100,"GBP","USD","2010") )
console.log( freechange.by_date(100,"GBP","USD","2010-01") )
console.log( freechange.by_date(100,"GBP","USD","2010-01-01") )

This will exchange 100 GBP to USD multiple times, using slightly different dates.

Remember, we have a focus on historical data so this call may give different results when used with a date less than a year old, depending on when you installed the package and when we last updated the package with newer data. This happens as new data is collected overtime.

Currencies are expressed as their ISO 4217 codes.

We currently have historical exchange rates for 190 currencies with varying degrees of support and resolution.

You can view this list by visiting https://xriss.github.io/freechange-charts/ and selecting from USD to your currency of choice.

The monthly chart represents good coverage so if that is missing then we do not support that currency very well.

Options

So to recap, times in the past are good and stable, times in the future are not.
If you mostly care about today's exchange rates, you should be using an API rather than this historical data dump.

When you provide a date, it will trigger one of three modes as described below - depending on if it is a full date, a month or a year only.

Year provided

We will use yearly averages for the given year or closest year if it is out of the range of data.

Month provided

We will use monthly averages for the given month or switch to yearly average if the date is out of the range of our monthly data.

Day provided

We will use daily numbers for the given day or switch to monthly and then yearly average if the date is out of the range of our data.

This function will return a number if it is successful or undefined if it is not; eg. we could not find the currency you requested.

If you want to reduce the amount of memory used by data, you can reduce the maximum resolution from day to month or year by changing to one of the following requires. This allows you to explicitly choose the resolutions available to reduce accuracy and more importantly, data size.

var freechange = require("freechange/day")
var freechange = require("freechange/month")
var freechange = require("freechange/year")

Sources

When it comes to sourcing the data we use ( in order of preference ) numbers from the following sources. You can find the latest data we grabbed in the JSON directory along with generated usd_to_xxx exchange rates for days, months and years.

NameRangeSourceJSON
IMFDailyhttps://www.imf.org/external/np/fin/data/param_rms_mth.aspxhttps://github.com/xriss/freechange/blob/master/json/imf.json
FREDDailyhttps://fred.stlouisfed.org/categories/94https://github.com/xriss/freechange/blob/master/json/fred.json
CodeforIATIDailyhttps://raw.githubusercontent.com/codeforIATI/imf-exchangerates/gh-pages/imf_exchangerates.csvhttps://github.com/xriss/freechange/blob/master/json/cfiati.json
OECDMonthlyhttps://data.oecd.org/conversion/exchange-rates.htmhttps://github.com/xriss/freechange/blob/master/json/oecd.json
MYBUTTYearlyhttps://github.com/xriss/freechange/blob/master/mybutt/year.csvThis folder contains handmade CSV for when every other source fails.

Data Downloads

All of these sources are combined into the following output JSON files which contain data you could use directly outside of this module.
CSV files are also built at the same time as the JSON files and will contain the same data.

NameJSONCSV
USD to XXX by Dayhttps://github.com/xriss/freechange/blob/master/json/usd_to_xxx_by_day.jsonhttps://github.com/xriss/freechange/blob/master/csv/usd_to_xxx_by_day.csv
USD to XXX by Monthhttps://github.com/xriss/freechange/blob/master/json/usd_to_xxx_by_month.jsonhttps://github.com/xriss/freechange/blob/master/csv/usd_to_xxx_by_month.csv
USD to XXX by Yearhttps://github.com/xriss/freechange/blob/master/json/usd_to_xxx_by_year.jsonhttps://github.com/xriss/freechange/blob/master/csv/usd_to_xxx_by_year.csv
0.0.171

3 days ago

0.0.170

10 days ago

0.0.169

17 days ago

0.0.168

24 days ago

0.0.167

1 month ago

0.0.166

1 month ago

0.0.165

1 month ago

0.0.164

1 month ago

0.0.163

2 months ago

0.0.162

2 months ago

0.0.161

2 months ago

0.0.160

2 months ago

0.0.159

3 months ago

0.0.158

3 months ago

0.0.157

3 months ago

0.0.156

3 months ago

0.0.155

4 months ago

0.0.154

4 months ago

0.0.153

4 months ago

0.0.152

4 months ago

0.0.151

5 months ago

0.0.150

5 months ago

0.0.149

5 months ago

0.0.138

7 months ago

0.0.148

5 months ago

0.0.147

5 months ago

0.0.142

6 months ago

0.0.141

6 months ago

0.0.140

6 months ago

0.0.146

6 months ago

0.0.145

6 months ago

0.0.144

6 months ago

0.0.143

6 months ago

0.0.137

7 months ago

0.0.136

7 months ago

0.0.135

8 months ago

0.0.134

8 months ago

0.0.133

8 months ago

0.0.132

8 months ago

0.0.128

9 months ago

0.0.129

9 months ago

0.0.131

8 months ago

0.0.130

9 months ago

0.0.127

9 months ago

0.0.126

10 months ago

0.0.125

10 months ago

0.0.124

10 months ago

0.0.123

10 months ago

0.0.122

11 months ago

0.0.117

12 months ago

0.0.119

12 months ago

0.0.118

12 months ago

0.0.120

11 months ago

0.0.121

11 months ago

0.0.116

1 year ago

0.0.115

1 year ago

0.0.109

1 year ago

0.0.114

1 year ago

0.0.113

1 year ago

0.0.112

1 year ago

0.0.111

1 year ago

0.0.110

1 year ago

0.0.106

1 year ago

0.0.105

1 year ago

0.0.104

1 year ago

0.0.108

1 year ago

0.0.107

1 year ago

0.0.103

1 year ago

0.0.102

1 year ago

0.0.101

1 year ago

0.0.100

1 year ago

0.0.95

1 year ago

0.0.96

1 year ago

0.0.97

1 year ago

0.0.98

1 year ago

0.0.99

1 year ago

0.0.90

2 years ago

0.0.91

2 years ago

0.0.92

2 years ago

0.0.93

2 years ago

0.0.94

2 years ago

0.0.84

2 years ago

0.0.85

2 years ago

0.0.86

2 years ago

0.0.87

2 years ago

0.0.88

2 years ago

0.0.89

2 years ago

0.0.83

2 years ago

0.0.80

2 years ago

0.0.81

2 years ago

0.0.82

2 years ago

0.0.73

2 years ago

0.0.74

2 years ago

0.0.75

2 years ago

0.0.76

2 years ago

0.0.77

2 years ago

0.0.78

2 years ago

0.0.79

2 years ago

0.0.70

2 years ago

0.0.71

2 years ago

0.0.72

2 years ago

0.0.69

2 years ago

0.0.65

2 years ago

0.0.66

2 years ago

0.0.67

2 years ago

0.0.68

2 years ago

0.0.62

2 years ago

0.0.63

2 years ago

0.0.64

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.58

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.47

2 years ago

0.0.51

2 years ago

0.0.52

2 years ago

0.0.53

2 years ago

0.0.54

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.40

3 years ago

0.0.41

2 years ago

0.0.44

2 years ago

0.0.39

3 years ago

0.0.38

3 years ago

0.0.37

3 years ago

0.0.36

3 years ago

0.0.35

3 years ago

0.0.34

3 years ago

0.0.33

3 years ago

0.0.32

3 years ago

0.0.31

3 years ago

0.0.30

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.26

3 years ago

0.0.21

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.16

4 years ago

0.0.17

4 years ago

0.0.15

4 years ago

0.0.12

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.10

4 years ago

0.0.11

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.3

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago