Skip to main content

This is wrapper for marketanalyst api

Project description

Requirement:

This library requires greater than 3.6 version of python.

Installment: First install marketanalyst package from pip so do

pip install marketanalyst python -m pip install marketanalyst

This will download the package itself and dependencies that is uses.

How to use:

Import the package. import marketanalyst Make a client which can be used to call all the other methods. client = marketanalyst.client("your api key","your secret key") The client is ready to use, it can be used to call the below methods.

Methods:

All of these methods will return either a string with error message or a dataframe as a success Getallsecurities: df = client.Getallsecurities() This will return a dataframe like this: id title 0 71877 AMEX:AAAU 1 71878 AMEX:AADR 2 67702 AMEX:AAMC 3 48525 AMEX:AAU 4 71880 AMEX:ACIM ... ... ... 20631 56925 TSX:YRI 20632 56932 TSX:ZAR 20633 56933 TSX:ZAZ 20634 56934 TSX:ZCL 20635 56935 TSX:ZNC

[20636 rows x 2 columns]

Here title is the name of security and id represents the database id that was assigned to this security.

getallcategory: df = client.getallcategory() return: id title 0 1 Commodities 1 2 Currencies 2 5 Global Indices 3 27 Hong Kong ETF 4 15 Indian Equities 5 28 Singapore ETF 6 29 Singapore REIT 7 4 US Equities 8 26 USA ETF getallsubcategory: df = client.getallsubcategory("Commodities") Return: id title 0 464 COMEX 1 463 NYMEX getallportfolio: df = client.getallportfolio() return: id title 0 8003 DOW 30 1 8008 FAANG 2 8004 NASDAQ 100 3 8010 nmbjk 4 8005 Russell 1000 5 8006 Russell 2000 6 8007 Russell 3000 7 8002 S&P 400 8 8001 S&P 500 9 8009 Warren Buffett Stocks

getallindicator: df = client.getallindicator() Return:

id title 0 1 Price 1 2 Technical 2 3 Fundamental 3 4 Financials

getallsubindicator: df = client.getallsubindicator("Price") Return: id title 0 1 EOD 1 2 Analytics

getdata: df = client.getdata(["NASDAQ:AAPL"],"01/01/2012","01/01/2019","Price","EOD") Return: e s i v d 0 NASDAQ AAPL D_EODCLOSE_EXT_1 58.75 2012-01-03 1 NASDAQ AAPL D_EODCLOSE_EXT_1 59.06 2012-01-04 2 NASDAQ AAPL D_EODCLOSE_EXT_1 59.72 2012-01-05 3 NASDAQ AAPL D_EODCLOSE_EXT_1 60.34 2012-01-06 4 NASDAQ AAPL D_EODCLOSE_EXT_1 60.25 2012-01-09 ... ... ... ... ... ... 17590 NASDAQ MSFT D_EODVOL_EXT_1 43935100 2018-12-24 17591 NASDAQ MSFT D_EODVOL_EXT_1 51634700 2018-12-26 17592 NASDAQ MSFT D_EODVOL_EXT_1 49498500 2018-12-27 17593 NASDAQ MSFT D_EODVOL_EXT_1 38169300 2018-12-28 17594 NASDAQ MSFT D_EODVOL_EXT_1 33173700 2018-12-31

[17595 rows x 5 columns]

getOHLCVData: df = client.getOHLCVData(["NASDAQ:AAPL","NASDAQ:MSFT"],"01/01/2012","01/01/2019") OR df = client.getOHLCVData(["NASDAQ:AAPL","NASDAQ:MSFT"],"01/01/2012","01/01/2019","EOD") You can provide sub indicator type like this. Return: datetime exchange security open low high close volume 0 2012-01-03 NASDAQ AAPL 58.49 58.43 58.93 58.75 75564699 1 2012-01-04 NASDAQ AAPL 58.57 58.47 59.24 59.06 65061108 2 2012-01-05 NASDAQ AAPL 59.28 58.95 59.79 59.72 67816805 3 2012-01-06 NASDAQ AAPL 59.97 59.89 60.39 60.34 79596412 4 2012-01-09 NASDAQ AAPL 60.79 60.19 61.11 60.25 98505792 ... ... ... ... ... ... ... ... ... 3514 2018-12-24 NASDAQ MSFT 97.68 93.98 97.97 94.13 43935100 3515 2018-12-26 NASDAQ MSFT 95.14 93.96 100.69 100.56 51634700 3516 2018-12-27 NASDAQ MSFT 99.3 96.4 101.19 101.18 49498500 3517 2018-12-28 NASDAQ MSFT 102.09 99.52 102.41 100.39 38169300 3518 2018-12-31 NASDAQ MSFT 101.29 100.44 102.4 101.57 33173700

[3519 rows x 8 columns] export_df: With this method you can export a dataframe to a csv or excel. client.export_df(df,'excel',r"D:\some_folder\filename") This example is for windows.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marketanalyst-0.1.2.tar.gz (5.3 kB view hashes)

Uploaded Source

Built Distribution

marketanalyst-0.1.2-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page