12 FX Data Analysis

Interfaces implemented in this chapter are listed below; uncovered indicators are noted under “To be added” at the end.

Foreign exchange reserves (100 million USD)

Interface: macro_china_fx_reserves_yearly

Source URL: https://datacenter.jin10.com/reportType/dc_chinese_fx_reserves

Description: China annual FX reserves; data from 20140115 to present

Limits: Returns all historical data in a single call

Input

Name Type Description
- - -

Output

Name Type Description
Item object -
Date object -
Actual float64 Unit: 100 million USD
Forecast float64 Unit: 100 million USD
Previous float64 Unit: 100 million USD

Example

import meshare as ms

macro_china_fx_reserves_yearly_df = ms.macro_china_fx_reserves_yearly()
print(macro_china_fx_reserves_yearly_df)

Sample data

           Item          Date       Actual      Forecast     Previous
0    China FX reserves report  2014-01-15  38200.0  38000.0  36600
1    China FX reserves report  2014-07-15  39900.0  39800.0  39500
2    China FX reserves report  2015-01-15  38400.0  39000.0  39900
3    China FX reserves report  2016-03-07  32000.0  31900.0  32300
4    China FX reserves report  2016-04-07  32100.0  32100.0  32000
..        ...         ...      ...      ...    ...
106  China FX reserves report  2023-12-07  31720.0  31200.0  31010
107  China FX reserves report  2024-01-07  32380.0  32000.0  31720
108  China FX reserves report  2024-02-07  32190.0  32170.0  32380
109  China FX reserves report  2024-03-07  32260.0  32050.0  32190
110  China FX reserves report  2024-04-07      NaN      NaN  32260
[111 rows x 5 columns]

RMB central parity report

Interface: macro_china_rmb

Source URL: https://datacenter.jin10.com/reportType/dc_rmb_data

Description: China RMB central parity report; data from 20170103–20210513

Limits: Returns all historical data in a single call

Input

Name Type Description
- - -

Output

Name Type Description
Date object Date
USD/CNY_Mid float64 -
USD/CNY_Change float64 Unit: points
EUR/CNY_Mid float64 -
EUR/CNY_Change float64 Unit: points
100JPY/CNY_Mid float64 -
100JPY/CNY_Change float64 Unit: points
HKD/CNY_Mid float64 -
HKD/CNY_Change float64 Unit: points
GBP/CNY_Mid float64 -
GBP/CNY_Change float64 Unit: points
AUD/CNY_Mid float64 -
AUD/CNY_Change float64 Unit: points
NZD/CNY_Mid float64 -
NZD/CNY_Change float64 Unit: points
SGD/CNY_Mid float64 -
SGD/CNY_Change float64 Unit: points
CHF/CNY_Mid float64 -
CHF/CNY_Change float64 Unit: points
CAD/CNY_Mid float64 -
CAD/CNY_Change float64 Unit: points
CNY/MYR_Mid float64 -
CNY/MYR_Change float64 Unit: points
CNY/RUB_Mid float64 -
CNY/RUB_Change float64 Unit: points
CNY/ZAR_Mid float64 -
CNY/ZAR_Change float64 Unit: points
CNY/KRW_Mid float64 -
CNY/KRW_Change float64 Unit: points
CNY/AED_Mid float64 -
CNY/AED_Change float64 Unit: points
CNY/SAR_Mid float64 -
CNY/SAR_Change float64 Unit: points
CNY/HUF_Mid float64 -
CNY/HUF_Change float64 Unit: points
CNY/PLN_Mid float64 -
CNY/PLN_Change float64 Unit: points
CNY/DKK_Mid float64 -
CNY/DKK_Change float64 Unit: points
CNY/SEK_Mid float64 -
CNY/SEK_Change float64 Unit: points
CNY/NOK_Mid float64 -
CNY/NOK_Change float64 Unit: points
CNY/TRY_Mid float64 -
CNY/TRY_Change float64 Unit: points
CNY/MXN_Mid float64 -
CNY/MXN_Change float64 Unit: points
CNY/THB_Mid float64 -
CNY/THB_Change float64 Unit: points

Example

import meshare as ms

macro_china_rmb_df = ms.macro_china_rmb()
print(macro_china_rmb_df)

Sample data

     Date  USD/CNY_Mid  USD/CNY_Change  ...  CNY/MXN_Change  CNY/THB_Fix  CNY/THB_Change
0    2018-02-06      6.3072         0.0  ...            0.0     5.0191         0.0
1    2018-02-07      6.2882      -190.0  ...         -184.0     5.0178       -13.0
2    2018-02-08      6.2822       -60.0  ...          286.0     5.0429       251.0
3    2018-02-09      6.3194       372.0  ...          -64.0     5.0406       -23.0
4    2018-02-12      6.3001      -193.0  ...         -146.0     5.0310       -96.0
..          ...         ...         ...  ...            ...        ...         ...
786  2021-05-07      6.4678      -217.0  ...         -118.0     4.8283       310.0
787  2021-05-10      6.4425      -253.0  ...         -171.0     4.8333        50.0
788  2021-05-11      6.4254      -171.0  ...           85.0     4.8434       101.0
789  2021-05-12      6.4258         4.0  ...           65.0     4.8503        69.0
790  2021-05-13      6.4612       354.0  ...          107.0     4.8427       -76.0

FDI data

Interface: macro_china_fdi

Source URL: https://data.eastmoney.com/cjsj/fdi.html

Description: East Money — economic data overview — China — FDI; data from 200801–202307

Limits: Returns all historical data in a single call

Input

Name Type Description
- - -

Output

Name Type Description
Month object -
Current month int64 -
Current month-YoY float64 Unit: USD
Current month-MoM float64 Unit: %
Cumulative float64 Unit: USD
Cumulative-YoY float64 Unit: %

Example

import meshare as ms

macro_china_fdi_df = ms.macro_china_fdi()
print(macro_china_fdi_df)

Sample data

     Month          Current month        Current month-YoY Current month-MoM  Cumulative  Cumulative-YoY
0    Jan 2008  11200250.0  116.422424 -14.460445   11200250   109.78
1    Feb 2008   6928190.0   52.801205 -38.142541   18128440    75.19
2    Mar 2008   9285600.0   50.171752  34.026347   27414040    61.26
3    Apr 2008   7602890.0   70.214971 -18.121715   35016930    59.32
4    May 2008   7760960.0   58.421856   2.079078   42777890    54.97
..         ...         ...         ...        ...        ...      ...
180  Jan 2023  19020000.0   20.075758  72.126697   19020000    10.00
181  Feb 2023  20690000.0   -6.039964   8.780231   39710000     1.00
182  Apr 2023         NaN         NaN        NaN   73500000    -3.30
183  May 2023  10850000.0  -18.421053        NaN   84350000    -5.60
184  Jul 2023         NaN         NaN        NaN  111800000    -9.80
[185 rows x 6 columns]

PBOC gold and FX reserves

Interface: macro_china_foreign_exchange_gold

Source URL: http://finance.sina.com.cn/mac/#fininfo-5-0-31-2

Description: NBS — PBOC gold and FX reserves; longer history than the East Money interface

Limits: Returns all historical data in a single call

Input

Name Type Description
- - -

Output

Name Type Description
Period object Year-month
Gold reserves float64 Unit: 10,000 oz
National FX reserves float64 Unit: 100 million USD

Example

import meshare as ms

macro_china_foreign_exchange_gold_df = ms.macro_china_foreign_exchange_gold()
print(macro_china_foreign_exchange_gold_df)

Sample data

        Period     Gold reserves    National FX reserves
0    1978.12  1280.00      1.67
1    1979.12  1280.00      8.40
2    1980.12  1280.00    -12.96
3    1981.12  1267.00     27.08
4    1982.12  1267.00     69.86
..       ...      ...       ...
384   2023.7  6869.00  32042.70
385   2023.8  6962.00  31600.98
386   2023.9  7046.00  31150.70
387   2024.1  7219.00  32193.20
388   2024.2  7258.00  32258.17
[389 rows x 3 columns]

FX and gold reserves

Interface: macro_china_fx_gold

Source URL: http://data.eastmoney.com/cjsj/hjwh.html

Description: China FX and gold reserves; monthly data from 200801 to present

Limits: Returns all historical data in a single call

Input

Name Type Description
- - -

Output

Name Type Description
Month object Year and month
Gold reserves-Value float64 Unit: 10,000 oz
Gold reserves-YoY float64 Unit: 10,000 oz
Gold reserves-MoM float64 Unit: 10,000 oz
National FX reserves-Value float64 Unit: 100 million USD
National FX reserves-YoY float64 Unit: 100 million USD
National FX reserves-MoM float64 Unit: 100 million USD

Example

import meshare as ms

macro_china_fx_gold_df = ms.macro_china_fx_gold()
print(macro_china_fx_gold_df)

Sample data

       Month  Gold reserves-Value    Gold reserves-YoY   Gold reserves-MoM   National FX reserves-Value  National FX reserves-YoY  National FX reserves-MoM
0    Jan 2008      NaN        NaN       NaN  15898.1040  43.914387   4.028224
1    Feb 2008      NaN        NaN       NaN  16471.3371  42.316677   3.605670
2    Mar 2008      NaN        NaN       NaN  16821.7700  39.944557   2.127532
3    Apr 2008      NaN        NaN       NaN  17566.5514  40.919594   4.427485
4    May 2008      NaN        NaN       NaN  17969.6074  39.011455   2.294451
..         ...      ...        ...       ...         ...        ...        ...
170  Mar 2022  1216.63  14.849008  1.690906  31879.9400   0.566714  -0.803808
171  Apr 2022  1197.31   8.126829 -1.587993  31197.2000  -2.453270  -2.141598
172  May 2022  1151.83  -3.223828 -3.798515  31277.8000  -2.918335   0.258357
173  Jun 2022  1138.23   3.053871 -1.180730  30712.7200  -4.441119  -1.806649
174  Jul 2022  1098.39  -3.963383 -3.500171  31040.7100  -4.073655   1.067929

RMB central parity

Interface: currency_boc_safe

Source URL: https://www.safe.gov.cn/safe/rmbhlzjj/index.html

Description: SAFE — RMB central parity

Limits: Returns all historical data in a single call

Input

Name Type Description
- - -

Output

Name Type Description
Date object -
USD float64 -
EUR float64 -
JPY float64 -
HKD float64 -
GBP float64 -
MYR float64 -
RUB float64 -
AUD float64 -
CAD float64 -
NZD float64 -
SGD float64 -
CHF float64 -
ZAR float64 -
KRW float64 -
AED float64 -
SAR float64 -
HUF float64 -
PLN float64 -
DKK float64 -
SEK float64 -
NOK float64 -
TRY float64 -
MXN float64 -
THB float64 -

P.S. Central parities of RMB vs MYR, RUB, ZAR, KRW, AED, SAR, HUF, PLN, DKK, SEK, NOK, TRY, MXN, and THB use the indirect quotation (foreign currency per 100 RMB). Central parities vs the other 10 currencies use the direct quotation (RMB per 100 units of foreign currency).

Example

import meshare as ms

currency_boc_safe_df = ms.currency_boc_safe()
print(currency_boc_safe_df)

Sample data

       Date        USD      EUR   JPY  ...    NOK     TRY      MXN    THB
0     1994-01-01  870.00     NaN  7.7800  ...     NaN      NaN     NaN     NaN
1     1994-01-03  870.00     NaN  7.7800  ...     NaN      NaN     NaN     NaN
2     1994-01-04  870.00     NaN  7.7196  ...     NaN      NaN     NaN     NaN
3     1994-01-05  870.00     NaN  7.7196  ...     NaN      NaN     NaN     NaN
4     1994-01-06  870.00     NaN  7.7196  ...     NaN      NaN     NaN     NaN
          ...     ...     ...     ...  ...     ...      ...     ...     ...
7318  2023-09-11  721.48  781.40  4.9710  ...  145.79  368.808  242.47  484.82
7319  2023-09-12  719.86  779.52  4.9573  ...  146.60  371.740  239.65  487.87
7320  2023-09-13  718.94  779.19  4.9356  ...  147.20  372.274  238.83  489.51
7321  2023-09-14  718.74  776.11  4.9174  ...  148.01  372.886  238.35  492.54
7322  2023-09-15  717.86  768.65  4.9064  ...  148.78  373.622  237.86  493.03
[7323 rows x 25 columns]

RMB quoted rates

Interface: currency_boc_sina

Source URL: https://biz.finance.sina.com.cn/forex/forex.php?startdate=2012-01-01&enddate=2021-06-14&money_code=EUR&type=0

Description: Sina Finance — Bank of China RMB quoted rates history

Limits: Returns all historical data for the specified date range in a single call

Input

Name Type Description
symbol str Chinese API labels, e.g. symbol="美元" (USD); choice of {'美元','英镑','欧元','澳门元','泰国铢','菲律宾比索','港币','瑞士法郎','新加坡元','瑞典克朗','丹麦克朗','挪威克朗','日元','加拿大元','澳大利亚元','新西兰元','韩国元'}
start_date str start_date="20230304"; start–end span must exceed 6 months
end_date str end_date="20231110"; start–end span must exceed 6 months

Output

Name Type Description
Date object -
BOC remittance buy float64 Unit: yuan
BOC cash buy float64 Unit: yuan
BOC cash sell / remittance sell float64 Unit: yuan
PBOC mid rate float64 Unit: yuan

Example

import meshare as ms

currency_boc_sina_df = ms.currency_boc_sina(symbol="美元", start_date="20230304", end_date="20231110")
print(currency_boc_sina_df)

Sample data

    Date   BOC remittance buy   BOC cash buy  BOC cash sell / remittance sell   PBOC mid rate
0    2023-03-06  691.80  686.17     694.73  689.51
1    2023-03-07  694.49  688.84     697.44  691.56
2    2023-03-08  693.49  687.85     696.43  695.25
3    2023-03-09  695.04  689.39     697.99  696.66
4    2023-03-10  689.70  684.09     692.62  696.55
..          ...     ...     ...        ...     ...
175  2023-11-06  725.83  725.67     728.73  717.80
176  2023-11-07  726.73  726.57     729.63  717.76
177  2023-11-08  726.73  726.57     729.63  717.73
178  2023-11-09  727.28  727.12     730.18  717.72
179  2023-11-10  727.93  727.77     730.83  717.71
[180 rows x 5 columns]

Real-time quotes

Interface: forex_spot_em

Source URL: https://quote.eastmoney.com/center/gridlist.html#forex_all

Description: East Money — quotes center — FX market — all rates — real-time quotes

Limits: Returns all real-time quotes in a single call

Input

Name Type Description
- - -

Output

Name Type Description
No. int64 -
Code object -
Name object -
Latest float64 -
Change float64 -
Change % float64 -
Open float64 -
High float64 -
Low float64 -
Prev close float64 -

Example

import meshare as ms

forex_spot_em_df = ms.forex_spot_em()
print(forex_spot_em_df)

Sample data

     No.  Code           Name  ...          High        Low        Prev close
0      1   USDZAR      USD/ZAR  ...   17.7123   17.5129   17.5916
1      2   HKDJPY        HKD/JPY  ...   18.3602   18.2621   18.2684
2      3   USDJPY        USD/JPY  ...  144.1268  143.3220  143.4055
3      4   CADJPY        CAD/JPY  ...  105.5900  105.0575  105.0855
4      5   CNHJPY     CNH/JPY  ...   20.1081   20.0145   20.0260
..   ...      ...          ...  ...       ...       ...       ...
185  186   JPYHKD     100JPY/HKD  ...    5.4757    5.4466    5.4739
186  187   JPYTRY  100JPY/TRY  ...   27.7972   27.6140   27.7796
187  188  CNYZARC   CNY/ZAR mid  ...    2.4602    2.4602    2.4773
188  189   ZARUSD      ZAR/USD  ...    0.0569    0.0565    0.0569
189  190   HUFUSD     HUF/USD  ...    0.0030    0.0029    0.0030
[190 rows x 10 columns]

Historical quotes

Interface: forex_hist_em

Source URL: https://quote.eastmoney.com/cnyrate/EURCNYC.html

Description: East Money — quotes center — FX market — all rates — historical quotes

Limits: Returns historical quotes for the specified symbol in a single call

Input

Name Type Description
symbol str symbol="USDCNH"; instrument code; use ms.forex_spot_em() for all symbols with historical quotes

Output

Name Type Description
No. int64 -
Code object -
Name object -
Latest float64 -
Change float64 -
Change % float64 -
Open float64 -
High float64 -
Low float64 -
Prev close float64 -

Example

import meshare as ms

forex_hist_em_df = ms.forex_hist_em(symbol="USDCNH")
print(forex_hist_em_df)

Sample data

         Date      Code        Name      Open     Latest      High      Low    Amplitude
0     2010-08-23  USDCNH  USD/CNH  6.7200  6.7250  6.7250  6.7200  0.00
1     2010-08-24  USDCNH  USD/CNH  6.7230  6.7265  6.7265  6.7230  0.05
2     2010-08-25  USDCNH  USD/CNH  6.7325  6.7325  6.7325  6.7325  0.00
3     2010-08-26  USDCNH  USD/CNH  6.7500  6.7450  6.7500  6.7450  0.07
4     2010-08-27  USDCNH  USD/CNH  6.7530  6.7530  6.7530  6.7530  0.00
...          ...     ...       ...     ...     ...     ...     ...   ...
3776  2025-02-28  USDCNH  USD/CNH  7.3007  7.2954  7.3019  7.2844  0.24
3777  2025-03-03  USDCNH  USD/CNH  7.2915  7.3027  7.3069  7.2848  0.30
3778  2025-03-04  USDCNH  USD/CNH  7.3028  7.2543  7.3069  7.2488  0.80
3779  2025-03-05  USDCNH  USD/CNH  7.2532  7.2362  7.2769  7.2343  0.59
3780  2025-03-06  USDCNH  USD/CNH  7.2363  7.2484  7.2485  7.2354  0.18
[3781 rows x 8 columns]

RMB FX spot quotes

Interface: fx_spot_quote

Source URL: http://www.chinamoney.com.cn/chinese/mkdatapfx/

Description: RMB FX spot quotes

Limits: Returns real-time quotes in a single call

Input

Name Type Description
- - -

Output

RMB FX spot quotes

Name Type Description
Pair object
Bid float64
Ask float64

Note: indicative quotes (USD is ODM), updated in real time

Example

import meshare as ms

fx_spot_quote_df = ms.fx_spot_quote()
print(fx_spot_quote_df)

Sample data

      Pair        Bid        Ask
0      USD/CNY    6.68500    6.68540
1      EUR/CNY    7.08170    7.08260
2   100JPY/CNY    4.92400    4.92480
3      HKD/CNY    0.85184    0.85196
4      GBP/CNY    8.20610    8.20690
5      AUD/CNY    4.65300    4.65310
6      NZD/CNY    4.21240    4.21320
7      SGD/CNY    4.82670    4.82680
8      CHF/CNY    7.00390    7.00450
9      CAD/CNY    5.21290    5.21360
10     CNY/MYR    0.65590    0.65750
11     CNY/RUB    7.93950    7.98320
12     CNY/ZAR    2.37330    2.37360
13     CNY/KRW  192.14000  192.20000
14     CNY/AED    0.54935    0.54948
15     CNY/SAR    0.56142    0.56147
16     CNY/HUF   56.53140   56.57020
17     CNY/PLN    0.66319    0.66344
18     CNY/DKK    1.05070    1.05070
19     CNY/SEK    1.50220    1.50240
20     CNY/NOK    1.45980    1.46000
21     CNY/TRY    2.48949    2.48980
22     CNY/MXN    2.97690    2.97870
23     CNY/THB    5.24800    5.25000

Cross-currency spot quotes

Interface: fx_pair_quote

Source URL: http://www.chinamoney.com.cn/chinese/mkdatapfx/

Description: Cross-currency spot quotes

Limits: Returns the latest updated snapshot for the current time in a single call

Input

Name Type Description
- - -

Output

Name Type Description
Pair object e.g., "AUD/USD"
Bid float64 e.g., "0.68460"
Ask float64 e.g., "0.68461"

Note: indicative quotes (USD is ODM), updated in real time

Example

import meshare as ms

fx_pair_quote_df = ms.fx_pair_quote()
print(fx_pair_quote_df)

Sample data

        Pair        Bid        Ask
0   AUD/USD    0.69594    0.69600
1   EUR/JPY  143.80300  143.81500
2   EUR/USD    1.05929    1.05935
3   GBP/USD    1.22733    1.22739
4   USD/CAD    1.28238    1.28247
5   USD/CHF    0.95410    0.95417
6   USD/HKD    7.84744    7.84755
7   USD/JPY  135.75500  135.76000
8   USD/SGD    1.38510    1.38518
9   NZD/USD    0.63003    0.63012
10  EUR/GBP    0.86308    0.86308

RMB FX forward & swap quotes

Interface: fx_swap_quote

Source URL: http://www.chinamoney.com.cn/chinese/mkdatapfx/

Description: RMB FX forward & swap quotes

Limits: Returns real-time quotes in a single call

Input

Name Type Description
- - -

Output

RMB FX forward & swap quotes

Name Type Description
Pair object e.g., "USD/CNY"
1W object e.g., "11.50/12.00"
1M object
3M object
6M object
9M object
1Y object

Note: indicative quotes (USD is ODM), updated in real time

Example

import meshare as ms

fx_swap_quote_df = ms.fx_swap_quote()
print(fx_swap_quote_df)

Sample data

           Pair        1W  ...                 9M                 1Y
0      USD/CNY      5.00/5.00  ...    -235.00/-233.00    -347.00/-345.00
1      EUR/CNY    39.17/39.28  ...    1241.70/1242.30    1513.74/1514.19
2   100JPY/CNY    25.93/26.33  ...    1156.41/1158.04    1604.66/1604.74
3      HKD/CNY      2.35/2.55  ...          6.88/7.10        -4.88/-4.41
4      GBP/CNY    15.36/16.28  ...      221.38/222.74      188.33/191.70
5      AUD/CNY      9.47/9.87  ...    -128.45/-127.09    -254.98/-248.56
6      NZD/CNY      1.36/1.76  ...    -311.14/-299.26    -435.15/-420.15
7      SGD/CNY      3.31/3.39  ...        44.03/44.60        72.00/84.97
8      CHF/CNY    35.23/36.21  ...    1346.89/1347.41    1702.55/1706.77
9      CAD/CNY      7.86/7.96  ...    -124.21/-122.50    -193.11/-190.60
10     CNY/MYR     -1.43/0.35  ...       -22.75/-9.30       -21.12/-5.39
11     CNY/RUB  627.40/627.80  ...  30785.79/32165.82  35730.95/36968.82
12     CNY/ZAR    12.36/12.37  ...      719.25/726.67     992.29/1007.07
13     CNY/KRW    -4.63/-0.56  ...     -106.97/-93.21    -125.42/-117.52
14     CNY/AED    -0.60/-0.50  ...        18.31/18.63        27.90/28.35
15     CNY/SAR        ---/---  ...        22.03/22.54        32.68/33.00
16     CNY/HUF  370.56/423.79  ...  26568.04/26596.38  36664.72/36718.42
17     CNY/PLN      5.37/5.39  ...      264.19/264.92      359.67/361.01
18     CNY/DKK    -5.70/-5.49  ...    -186.20/-186.08    -229.34/-226.54
19     CNY/SEK    -5.91/-5.90  ...    -132.23/-131.85    -137.94/-137.43
20     CNY/NOK    -2.67/-2.64  ...      -43.57/-42.56      -35.65/-33.93
21     CNY/TRY    53.89/61.57  ...    8321.13/8339.39  11516.20/11550.77
22     CNY/MXN    -2.84/-2.80  ...      105.61/105.73    2350.95/2393.33
23     CNY/THB  -68.44/-43.00  ...    -514.60/-436.28    -675.05/-534.00