From 8aa76badbab6502c2c3d5718cbfbba5333b357b9 Mon Sep 17 00:00:00 2001 From: TerenceLiu98 Date: Fri, 28 May 2021 22:23:39 +0800 Subject: [PATCH 1/4] add bib --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ea39fd..68452d8 100644 --- a/README.md +++ b/README.md @@ -28,4 +28,19 @@ python -m pip install CEDApy * Thanks [akshare](https://github.com/jindaxiang/akshare/) * Thanks [EastMoney](https://www.eastmoney.com) * Thanks [St.Louis Fred Reserve Bank](https://fred.stlouisfed.org/) -* Thanks [eurostat Economic Indicators](https://ec.europa.eu/eurostat/cache/infographs/economy/desktop/index.html) \ No newline at end of file +* Thanks [eurostat Economic Indicators](https://ec.europa.eu/eurostat/cache/infographs/economy/desktop/index.html) + +## If you want to cite... + +```txt +@misc{LIU2021, + author = {Terence,Junjie-LIU}, + title = {CEDApy: A centralized macro-economic data library}, + year = {2021}, + publisher = {GitHub}, + journal = {GitHub repository}, + howpublished = {\url{https://github.com/TerenceLiu98/CEDApy}}, + url = "https://pypi.org/project/CEDApy/", + commit = {117e6e61d05af48576a8734c6b87248a380e6114} +} +``` \ No newline at end of file From 153ce58bd078ebab9116649bcfca4fdc9aed2b82 Mon Sep 17 00:00:00 2001 From: TerenceLiu98 Date: Sat, 29 May 2021 16:58:20 +0800 Subject: [PATCH 2/4] update --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68452d8..ebe9c29 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,12 @@ python -m pip install CEDApy * Thanks [akshare](https://github.com/jindaxiang/akshare/) * Thanks [EastMoney](https://www.eastmoney.com) -* Thanks [St.Louis Fred Reserve Bank](https://fred.stlouisfed.org/) +* Thanks [St.Louis Federal Reserve Bank](https://fred.stlouisfed.org/) +* Thanks [Chicago Federal Reserve Bank](https://www.chicagofed.org/) +* Thanks [Philadelphia Federal Reserve Bank](https://www.philadelphiafed.org/) * Thanks [eurostat Economic Indicators](https://ec.europa.eu/eurostat/cache/infographs/economy/desktop/index.html) +* Thanks [Europen Central Bank](https://www.ecb.europa.eu) + ## If you want to cite... From 1182d220400813de060a777b37f323ba8618ac22 Mon Sep 17 00:00:00 2001 From: TerenceLiu98 Date: Sat, 29 May 2021 17:27:09 +0800 Subject: [PATCH 3/4] v1.0b0 --- setup.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 3833b47..bf6f1db 100644 --- a/setup.py +++ b/setup.py @@ -2,8 +2,8 @@ from setuptools import setup, find_packages import os setup( name = "CEDApy", - version = "0.2-beta", - keywords = "economic data", + version = "1.0-beta", + keywords = "quantitative economic data", long_description = open( os.path.join( os.path.dirname(__file__), @@ -14,10 +14,23 @@ setup( author_email = "terenceliu1012@outlook.com", url = "https://github.com/TerenceLiu98/CEDApy", packages = find_packages(), + install_requires=[ + "matplotlib>=3.1.1", + "numpy>=1.15.4", + "pandas>=0.25", + "requests>=2.22.0", + "demjson>=2.2.4", + "html5lib>=1.0.1", + "xlrd==1.2.0", + ], license = "MIT", classifiers=[ - "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], + python_requires=">=3.6", ) \ No newline at end of file From ba530b253b600ab5d5fdbeb7a56d6014ddb777c9 Mon Sep 17 00:00:00 2001 From: TerenceLiu98 Date: Sat, 29 May 2021 18:15:34 +0800 Subject: [PATCH 4/4] update --- CEDA/Market/market.py | 55 +++++++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 CEDA/Market/market.py diff --git a/CEDA/Market/market.py b/CEDA/Market/market.py new file mode 100644 index 0000000..841592b --- /dev/null +++ b/CEDA/Market/market.py @@ -0,0 +1,55 @@ +import requests +import demjson +import pandas as pd +from fake_useragent import UserAgent + +url = { + "dukascopy": "http://data.uicstat.com/api_1.0" +} + + +def market_data( + instrument: str, + startdate: str, + enddate: str, + timeframe: str, + pricetype: str, + volume: bool, + flat: bool): + tmp_url = url["dukascopy"] + ua = UserAgent() + request_header = {"User-Agent": ua.random} + request_params = { + "instrument": "{}".format(instrument), + "startdate": "{}".format(startdate), + "enddate": "{}".format(enddate), + "timeframe": "{}".format(timeframe), + "pricetype": "{}".format(pricetype), + "volume": "{}".format(volume), + "flat": "{}".format(flat) + + } + r = requests.get(tmp_url, params=request_params, headers=request_header) + data_text = r.text + data_json = demjson.decode(data_text) + df = pd.DataFrame(data_json['result']) + df['timestamp'] = pd.to_datetime(df['timestamp'], unit='ms') + df.columns = [ + "Date", + "Open", + "High", + "Low", + "Close", + "Volume" + ] + return df + + +if __name__ == "__main__": + data = market_data(instrument="eurusd", + startdate="2020-01-01", + enddate="2021-01-01", + timeframe="d1", + pricetype="bid", + volume=True, + flat=True) diff --git a/setup.py b/setup.py index bf6f1db..8771924 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import os setup( name = "CEDApy", - version = "1.0-beta", + version = "1.0.1", keywords = "quantitative economic data", long_description = open( os.path.join(