Previously we are using https://finance.yahoo.com/webservice/v1/symbols/allcurrencies/quote?format=json to get all the currencies exchange rate for our application. However, realized that currently this link doesn't work anymore. What should we use now?
You can use YahooFinancials (Python Module) to get currency data from YahooFinanace:
$ pip install yahoofinancials
https://github.com/JECSand/yahoofinancials
from yahoofinancials import YahooFinancials
currencies = ['EURUSD=X', 'JPY=X', 'GBPUSD=X']
yahoo_financials_currencies = YahooFinancials(currencies)
print(yahoo_financials_currencies.get_historical_price_data("2018-08-01", "2018-08-10", "daily"))
Which returns:
{
"JPY=X": {
"eventsData": {},
"firstTradeDate": {
"date": 846633600,
"formatted_date": "1996-10-30"
},
"currency": "JPY",
"prices": [
{
"high": 112.13700103759766,
"volume": 0,
"formatted_date": "2018-07-31",
"low": 111.69999694824219,
"adjclose": 111.80799865722656,
"date": 1533078000,
"close": 111.80799865722656,
"open": 111.79499816894531
},
{
"high": 111.7239990234375,
"volume": 0,
"formatted_date": "2018-08-01",
"low": 111.33000183105469,
"adjclose": 111.62000274658203,
"date": 1533164400,
"close": 111.62000274658203,
"open": 111.63700103759766
},
{
"high": 111.78299713134766,
"volume": 0,
"formatted_date": "2018-08-02",
"low": 111.0999984741211,
"adjclose": 111.69000244140625,
"date": 1533250800,
"close": 111.69000244140625,
"open": 111.6989974975586
},
{
"high": 111.52200317382812,
"volume": 0,
"formatted_date": "2018-08-05",
"low": 111.16699981689453,
"adjclose": 111.23400115966797,
"date": 1533510000,
"close": 111.23400115966797,
"open": 111.21700286865234
},
{
"high": 111.36399841308594,
"volume": 0,
"formatted_date": "2018-08-06",
"low": 110.9990005493164,
"adjclose": 111.33999633789062,
"date": 1533596400,
"close": 111.33999633789062,
"open": 111.3280029296875
},
{
"high": 111.41999816894531,
"volume": 0,
"formatted_date": "2018-08-07",
"low": 110.83999633789062,
"adjclose": 111.34500122070312,
"date": 1533682800,
"close": 111.34500122070312,
"open": 111.34700012207031
},
{
"high": 111.1780014038086,
"volume": 0,
"formatted_date": "2018-08-08",
"low": 110.70999908447266,
"adjclose": 110.89199829101562,
"date": 1533769200,
"close": 110.89199829101562,
"open": 110.90299987792969
},
{
"high": 111.12799835205078,
"volume": 0,
"formatted_date": "2018-08-09",
"low": 110.51799774169922,
"adjclose": 111.09100341796875,
"date": 1533855600,
"close": 111.09100341796875,
"open": 111.06400299072266
}
],
"timeZone": {
"gmtOffset": 3600
},
"instrumentType": "CURRENCY"
},
"EURUSD=X": {
"eventsData": {},
"firstTradeDate": {
"date": 1070236800,
"formatted_date": "2003-12-01"
},
"currency": "USD",
"prices": [
{
"high": 1.169864296913147,
"volume": 0,
"formatted_date": "2018-07-31",
"low": 1.166534423828125,
"adjclose": 1.168961763381958,
"date": 1533078000,
"close": 1.168961763381958,
"open": 1.168961763381958
},
{
"high": 1.1669973134994507,
"volume": 0,
"formatted_date": "2018-08-01",
"low": 1.1604158878326416,
"adjclose": 1.1665889024734497,
"date": 1533164400,
"close": 1.1665889024734497,
"open": 1.1663848161697388
},
{
"high": 1.1612001657485962,
"volume": 0,
"formatted_date": "2018-08-02",
"low": 1.1562163829803467,
"adjclose": 1.1586008071899414,
"date": 1533250800,
"close": 1.1586008071899414,
"open": 1.1585606336593628
},
{
"high": 1.1570056676864624,
"volume": 0,
"formatted_date": "2018-08-05",
"low": 1.1530966758728027,
"adjclose": 1.1562297344207764,
"date": 1533510000,
"close": 1.1562297344207764,
"open": 1.156136155128479
},
{
"high": 1.1609008312225342,
"volume": 0,
"formatted_date": "2018-08-06",
"low": 1.1552013158798218,
"adjclose": 1.1558021306991577,
"date": 1533596400,
"close": 1.1558021306991577,
"open": 1.155748724937439
},
{
"high": 1.1629259586334229,
"volume": 0,
"formatted_date": "2018-08-07",
"low": 1.1574609279632568,
"adjclose": 1.1602946519851685,
"date": 1533682800,
"close": 1.1602946519851685,
"open": 1.1603351831436157
},
{
"high": 1.1621150970458984,
"volume": 0,
"formatted_date": "2018-08-08",
"low": 1.156176209449768,
"adjclose": 1.1610760688781738,
"date": 1533769200,
"close": 1.1610760688781738,
"open": 1.1610087156295776
},
{
"high": 1.1539349555969238,
"volume": 0,
"formatted_date": "2018-08-09",
"low": 1.1396141052246094,
"adjclose": 1.1523923873901367,
"date": 1533855600,
"close": 1.1523923873901367,
"open": 1.1528706550598145
}
],
"timeZone": {
"gmtOffset": 3600
},
"instrumentType": "CURRENCY"
},
"GBPUSD=X": {
"eventsData": {},
"firstTradeDate": {
"date": 1070236800,
"formatted_date": "2003-12-01"
},
"currency": "USD",
"prices": [
{
"high": 1.314578652381897,
"volume": 0,
"formatted_date": "2018-07-31",
"low": 1.3097577095031738,
"adjclose": 1.3121638298034668,
"date": 1533078000,
"close": 1.3121638298034668,
"open": 1.3118367195129395
},
{
"high": 1.3128528594970703,
"volume": 0,
"formatted_date": "2018-08-01",
"low": 1.3018969297409058,
"adjclose": 1.3126115798950195,
"date": 1533164400,
"close": 1.3126115798950195,
"open": 1.3125253915786743
},
{
"high": 1.3043080568313599,
"volume": 0,
"formatted_date": "2018-08-02",
"low": 1.2976226806640625,
"adjclose": 1.3018121719360352,
"date": 1533250800,
"close": 1.3018121719360352,
"open": 1.301574945449829
},
{
"high": 1.3007283210754395,
"volume": 0,
"formatted_date": "2018-08-05",
"low": 1.292073130607605,
"adjclose": 1.3003562688827515,
"date": 1533510000,
"close": 1.3003562688827515,
"open": 1.300153374671936
},
{
"high": 1.2973533868789673,
"volume": 0,
"formatted_date": "2018-08-06",
"low": 1.2938284873962402,
"adjclose": 1.2944984436035156,
"date": 1533596400,
"close": 1.2944984436035156,
"open": 1.294247031211853
},
{
"high": 1.2961763143539429,
"volume": 0,
"formatted_date": "2018-08-07",
"low": 1.2855453491210938,
"adjclose": 1.2946659326553345,
"date": 1533682800,
"close": 1.2946659326553345,
"open": 1.2946659326553345
},
{
"high": 1.2911388874053955,
"volume": 0,
"formatted_date": "2018-08-08",
"low": 1.2843565940856934,
"adjclose": 1.2881617546081543,
"date": 1533769200,
"close": 1.2881617546081543,
"open": 1.2879958152770996
},
{
"high": 1.283861756324768,
"volume": 0,
"formatted_date": "2018-08-09",
"low": 1.2726045846939087,
"adjclose": 1.2828407287597656,
"date": 1533855600,
"close": 1.2828407287597656,
"open": 1.2830052375793457
}
],
"timeZone": {
"gmtOffset": 3600
},
"instrumentType": "CURRENCY"
}
}
From here you can easily save this JSON data to a file if needed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.