Nasdaq / data-link-python

A Python library for Nasdaq Data Link's RESTful API
MIT License
418 stars 69 forks source link

Unable to use api key #31

Open ghost opened 1 year ago

ghost commented 1 year ago

I am beginner at coding.

Should I store the api key in a json format file? containing the following statement : api_key = XXXXXXXXXXX (my api key)

AND import nasdaqdatalink nasdaqdatalink.read_key(filename="/path")

the path begins where my code is located or should I write the full path of the archive?

clientsuccessnasdaq commented 1 year ago

-- Please reply above this line --

Thank you for contacting the Client Success Team at Nasdaq Data Link. Your email is very important to us and we will respond to you within 1 to 2 business days.

clientsuccessnasdaq commented 1 year ago

-- Please reply above this line --

        Hi there,

Thank you for reaching out.

If you are attempting to store your API key in a different file, you only need to save the API key in a .txt file. In addition, the filename should be the full path of the archive.

The recommended way to pass in your API key is to simply use nasdaqdatalink.ApiConfig.api_key = "xxx" directly in your python code as some user system configurations make it more difficult to setup the API key in a different file.

Please let me know if you have any additional questions!

Best regards, Hao

TRUNG-HAO NGUYEN Client Success  Nasdaq Data Link

How would you rate my reply? Great [1]    Okay [2]    Not Good [3]

Links:

[1] https://secure.helpscout.net/satisfaction/580195372/record/6161318355/1/ [2] https://secure.helpscout.net/satisfaction/580195372/record/6161318355/2/ [3] https://secure.helpscout.net/satisfaction/580195372/record/6161318355/3/

    > On Thu, Nov 17, 2022 at 2:02 PM EST, Nasdaq/data-Link-Python ***@***.***> wrote:

WARNING - EXTERNAL EMAIL; EXERCISE CAUTION.

I am beginner at coding.

Should I store the api key in a json format file? containing the following statement : api_key = XXXXXXXXXXX (my api key)

AND import nasdaqdatalink nasdaqdatalink.read_key(filename="/path")

the path begins where my code is located or should I write the full path of the archive?

- Reply to this email directly, view it on GitHub [1], or unsubscribe [2]. You are receiving this because you are subscribed to this thread.Message ID: @.***>


CONFIDENTIALITY AND PRIVACY NOTICE: This e-mail and any attachments are for the exclusive and confidential use of the intended recipient and may constitute non-public information. Personal data in this email is governed by our Privacy Policy at https://www.nasdaq.com/privacy-statement [3] unless explicitly excluded from it; please see the section in the policy entitled "Situations Where This Privacy Policy Does Not Apply" for circumstances where different privacy terms govern emailed personal data. If you received this e-mail in error, disclosing, copying, distributing or taking any action in reliance of this e-mail is strictly prohibited and may be unlawful. Instead, please notify us immediately by return e-mail and promptly delete this message and its attachments from your computer system. We do not waive any work product or other applicable legal privilege(s) by the transmission of this message.


Links:

[1] https://github.com/Nasdaq/data-link-python/issues/31 [2] https://github.com/notifications/unsubscribe-auth/AWYQ644DGHFUOZN4CT5SIWLWIZ6JFANCNFSM6AAAAAASDWOTGQ [3] https://www.nasdaq.com/privacy-statement

morfeo630 commented 1 year ago

Hello to all,

I also have truble getting the data.... I have my https://data.nasdaq.com/ account and a subscription to QUOTEMEDIA/End of Day US Stock Prices.

I have truble getting the end of day data for the last month. Can you please help me, with my code to get the last 30 day data for IBM, please?

In my code below I replaced my API KEY with 'xxx'. Thank you for your time and help. Best regards, Valter

My python code:

import nasdaqdatalink

if __name__ == '__main__':
    nasdaqdatalink.ApiConfig.api_key = "xxx"
    data = nasdaqdatalink.get('NSE/OIL')
    print(data)

The result:

               Open     High  ...  Total Trade Quantity  Turnover (Lacs)
Date                          ...                                       
2009-09-30  1096.00  1156.70  ...            19748012.0        223877.07
2009-10-01  1102.00  1173.70  ...             3074254.0         35463.78
2009-10-05  1152.00  1165.90  ...              919832.0         10581.13
2009-10-06  1149.80  1157.20  ...              627957.0          7185.90
2009-10-07  1153.80  1160.70  ...              698216.0          8032.98
...             ...      ...  ...                   ...              ...
2018-12-31   178.10   179.00  ...              761462.0          1343.75
2019-01-01   175.00   176.40  ...              381570.0           669.16
2019-01-02   175.80   176.20  ...              722532.0          1251.85
2019-01-03   172.80   175.70  ...              698190.0          1212.34
2019-01-04   172.05   174.95  ...              431122.0           749.99

[2299 rows x 7 columns]

Process finished with exit code 0
clientsuccessnasdaq commented 1 year ago

-- Please reply above this line --

Thank you for contacting the Client Success Team at Nasdaq Data Link. Your email is very important to us and we will respond to you within 1 to 2 business days.

clientsuccessnasdaq commented 1 year ago

-- Please reply above this line --

        Hello Valter,

Thank you very much for reaching out.

Based on the code provided, it appears that you are retrieving data from the time-series dataset NSE/OIL instead of the data found in QUOTEMEDIA/PRICES table.

As the EOD product is in a different format, you are required to use the GET_TABLE function.

Here's the code that will return data from the QUOTEMEDIA/PRICES table: nasdaqdatalink.ApiConfig.api_key = "xxx" data = nasdaqdatalink.get_table('QUOTEMEDIA/PRICES', ticker='IBM', date={'gte':'2022-12-01','lte':'2022-12-28'}, paginate=True) print(data)

This will return all available data from the QUOTEMEDIA/PRICES table for the ticker IBM, for the date range 2022-12-01 to 2022-12-28.

To understand the composition of the above code:

* _nasdaqdatalink.get_table _is the function compatible with the

Tables API;

To view the full Python documentation for our tables API, please see: https://docs.data.nasdaq.com/docs/python-tables [1] Additional usage examples specific to the EOD product may be viewed in the product page's quickstart guide: https://data.nasdaq.com/databases/EOD/usage/quickstart/api [2]

We hope this helps! Please feel free to let us know should you have any additional questions.

Kind regards, Kim

Links:

[1] https://docs.data.nasdaq.com/docs/python-tables [2] https://data.nasdaq.com/databases/EOD/usage/quickstart/api

KIM LIRA Client Success  Nasdaq Data Link

How would you rate my reply? Great [1]    Okay [2]    Not Good [3]

Links:

[1] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/1/ [2] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/2/ [3] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/3/

    > On Wed, Dec 28, 2022 at 6:59 AM EST, Nasdaq/data-Link-Python ***@***.***> wrote:

WARNING - EXTERNAL EMAIL; EXERCISE CAUTION.

Hello to all,

I also have truble getting the data.... I have my https://data.nasdaq.com/ [1] account and a subscription to QUOTEMEDIA/End of Day US Stock Prices.

I have truble getting the end of day data for the last month. Can you please help me, with my code to get the last 30 day data for IBM, please?

In my code below I replaced my API KEY with 'xxx'. Thank you for your time and help. Best regards, Valter

My python code:

import nasdaqdatalink if name == 'main': nasdaqdatalink.ApiConfig.api_key = "xxx" data = nasdaqdatalink.get('NSE/OIL') print(data)

The result:

Open High ... Total Trade Quantity Turnover (Lacs) Date ... 2009-09-30 1096.00 1156.70 ... 19748012.0 223877.07 2009-10-01 1102.00 1173.70 ... 3074254.0 35463.78 2009-10-05 1152.00 1165.90 ... 919832.0 10581.13 2009-10-06 1149.80 1157.20 ... 627957.0 7185.90 2009-10-07 1153.80 1160.70 ... 698216.0 8032.98 ... ... ... ... ... ... 2018-12-31 178.10 179.00 ... 761462.0 1343.75 2019-01-01 175.00 176.40 ... 381570.0 669.16 2019-01-02 175.80 176.20 ... 722532.0 1251.85 2019-01-03 172.80 175.70 ... 698190.0 1212.34 2019-01-04 172.05 174.95 ... 431122.0 749.99 [2299 rows x 7 columns] Process finished with exit code 0

- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you commented.Message ID: @.***>


CONFIDENTIALITY AND PRIVACY NOTICE: This e-mail and any attachments are for the exclusive and confidential use of the intended recipient and may constitute non-public information. Personal data in this email is governed by our Privacy Policy at https://www.nasdaq.com/privacy-statement [4] unless explicitly excluded from it; please see the section in the policy entitled "Situations Where This Privacy Policy Does Not Apply" for circumstances where different privacy terms govern emailed personal data. If you received this e-mail in error, disclosing, copying, distributing or taking any action in reliance of this e-mail is strictly prohibited and may be unlawful. Instead, please notify us immediately by return e-mail and promptly delete this message and its attachments from your computer system. We do not waive any work product or other applicable legal privilege(s) by the transmission of this message.


Links:

[1] https://data.nasdaq.com/ [2] https://github.com/Nasdaq/data-link-python/issues/31#issuecomment-1366598059 [3] https://github.com/notifications/unsubscribe-auth/AWYQ644UC4NNKEMVJKIRHQ3WPQTQ3ANCNFSM6AAAAAASDWOTGQ [4] https://www.nasdaq.com/privacy-statement

morfeo630 commented 1 year ago

Hello,

Thank you very much. You helped me. The code snapshot you provided works as expected. I was hoping to get also the current last price for the specific ticker. Is it possible to get the current close price with my current subscription? If not, what subscription do I need to have?

A second question also if a little off topic: what function i have to call to get a list of all tickers?

Thank you for your time. Best regards, Valter

-- Please reply above this line --

Hello Valter,

Thank you very much for reaching out.

Based on the code provided, it appears that you are retrieving data from the time-series dataset NSE/OIL instead of the data found in QUOTEMEDIA/PRICES table.

As the EOD product is in a different format, you are required to use the GET_TABLE function.

Here's the code that will return data from the QUOTEMEDIA/PRICES table: nasdaqdatalink.ApiConfig.api_key = "xxx" data = nasdaqdatalink.get_table('QUOTEMEDIA/PRICES', ticker='IBM', date={'gte':'2022-12-01','lte':'2022-12-28'}, paginate=True) print(data)

This will return all available data from the QUOTEMEDIA/PRICES table for the ticker IBM, for the date range 2022-12-01 to 2022-12-28.

To understand the composition of the above code:

  • _nasdaqdatalink.get_table _is the function compatible with the Tables API;
  • QUOTEMEDIA/PRICES is the the appropriate database to call;
  • ticker='IBM' is the ticker required;
  • date={...} passes the GTE and LTE operators to specify the date range; and
  • paginate=True (optional) is a parameter used to return data if there are more than 10,000 rows.

To view the full Python documentation for our tables API, please see: https://docs.data.nasdaq.com/docs/python-tables [1] Additional usage examples specific to the EOD product may be viewed in the product page's quickstart guide: https://data.nasdaq.com/databases/EOD/usage/quickstart/api [2]

We hope this helps! Please feel free to let us know should you have any additional questions.

Kind regards, Kim

Links:

[1] https://docs.data.nasdaq.com/docs/python-tables [2] https://data.nasdaq.com/databases/EOD/usage/quickstart/api

KIM LIRA Client Success Nasdaq Data Link

How would you rate my reply? Great [1] Okay [2] Not Good [3]

Links:

[1] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/1/ [2] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/2/ [3] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/3/

On Wed, Dec 28, 2022 at 6:59 AM EST, Nasdaq/data-Link-Python @.***> wrote:

WARNING - EXTERNAL EMAIL; EXERCISE CAUTION.

Hello to all,

I also have truble getting the data.... I have my https://data.nasdaq.com/ [1] account and a subscription to QUOTEMEDIA/End of Day US Stock Prices.

I have truble getting the end of day data for the last month. Can you please help me, with my code to get the last 30 day data for IBM, please?

In my code below I replaced my API KEY with 'xxx'. Thank you for your time and help. Best regards, Valter

My python code:

import nasdaqdatalink if name == 'main': nasdaqdatalink.ApiConfig.api_key = "xxx" data = nasdaqdatalink.get('NSE/OIL') print(data)

The result:

Open High ... Total Trade Quantity Turnover (Lacs) Date ... 2009-09-30 1096.00 1156.70 ... 19748012.0 223877.07 2009-10-01 1102.00 1173.70 ... 3074254.0 35463.78 2009-10-05 1152.00 1165.90 ... 919832.0 10581.13 2009-10-06 1149.80 1157.20 ... 627957.0 7185.90 2009-10-07 1153.80 1160.70 ... 698216.0 8032.98 ... ... ... ... ... ... 2018-12-31 178.10 179.00 ... 761462.0 1343.75 2019-01-01 175.00 176.40 ... 381570.0 669.16 2019-01-02 175.80 176.20 ... 722532.0 1251.85 2019-01-03 172.80 175.70 ... 698190.0 1212.34 2019-01-04 172.05 174.95 ... 431122.0 749.99 [2299 rows x 7 columns] Process finished with exit code 0

- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you commented.Message ID: @.***>


CONFIDENTIALITY AND PRIVACY NOTICE: This e-mail and any attachments are for the exclusive and confidential use of the intended recipient and may constitute non-public information. Personal data in this email is governed by our Privacy Policy at https://www.nasdaq.com/privacy-statement [4] unless explicitly excluded from it; please see the section in the policy entitled "Situations Where This Privacy Policy Does Not Apply" for circumstances where different privacy terms govern emailed personal data. If you received this e-mail in error, disclosing, copying, distributing or taking any action in reliance of this e-mail is strictly prohibited and may be unlawful. Instead, please notify us immediately by return e-mail and promptly delete this message and its attachments from your computer system. We do not waive any work product or other applicable legal privilege(s) by the transmission of this message.


Links:

[1] https://data.nasdaq.com/ [2]

https://github.com/Nasdaq/data-link-python/issues/31#issuecomment-1366598059 [3]

https://github.com/notifications/unsubscribe-auth/AWYQ644UC4NNKEMVJKIRHQ3WPQTQ3ANCNFSM6AAAAAASDWOTGQ [4] https://www.nasdaq.com/privacy-statement

— Reply to this email directly, view it on GitHub https://github.com/Nasdaq/data-link-python/issues/31#issuecomment-1366709189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4CDQBTDMC2IL7OGMP5G2TWPRICRANCNFSM6AAAAAASDWOTGQ . You are receiving this because you commented.Message ID: @.***>

clientsuccessnasdaq commented 1 year ago

-- Please reply above this line --

        Hi Valter,

You are most welcome -- we at Nasdaq Data Link are always happy to help!

To return only the most recent observation for a specific ticker, simply call for the exact date without using the 'gte' and 'lte' operators. You can try an API call like this one: nasdaqdatalink.get_table('QUOTEMEDIA/PRICES', qopts={"columns":"close"}, ticker='IBM', date='2022-12-27')

The above code will return close price data from the QUOTEMEDIA/PRICES table for the ticker IBM only for the date 2022-12-27. Simply adjust the date to return the exact data point you require, and you may modify the qopts="columns":... parameter to include additional columns.

The full ticker list may be retrieved by calling data from the QUOTEMEDIA/TICKERS table: data = nasdaqdatalink.get_table('QUOTEMEDIA/TICKERS', paginate=True)

Kindly feel free to reach out should you have further questions.

Best regards, Kim KIM LIRA Client Success  Nasdaq Data Link

How would you rate my reply? Great [1]    Okay [2]    Not Good [3]

Links:

[1] https://secure.helpscout.net/satisfaction/589130261/record/6275099339/1/ [2] https://secure.helpscout.net/satisfaction/589130261/record/6275099339/2/ [3] https://secure.helpscout.net/satisfaction/589130261/record/6275099339/3/

    > On Wed, Dec 28, 2022 at 11:14 AM EST, Nasdaq/data-Link-Python ***@***.***> wrote:

WARNING - EXTERNAL EMAIL; EXERCISE CAUTION. Hello,

Thank you very much. You helped me. The code snapshot you provided works as expected. I was hoping to get also the current last price for the specific ticker. Is it possible to get the current close price with my current subscription? If not, what subscription do I need to have?

A second question also if a little off topic: what function i have to call to get a list of all tickers?

Thank you for your time. Best regards, Valter

-- Please reply above this line --

Hello Valter,

Thank you very much for reaching out.

Based on the code provided, it appears that you are retrieving data from the time-series dataset NSE/OIL instead of the data found in QUOTEMEDIA/PRICES table.

As the EOD product is in a different format, you are required to use the GET_TABLE function.

Here's the code that will return data from the QUOTEMEDIA/PRICES table: nasdaqdatalink.ApiConfig.api_key = "xxx" data = nasdaqdatalink.get_table('QUOTEMEDIA/PRICES', ticker='IBM', date={'gte':'2022-12-01','lte':'2022-12-28'}, paginate=True) print(data)

This will return all available data from the QUOTEMEDIA/PRICES table for the ticker IBM, for the date range 2022-12-01 to 2022-12-28.

To understand the composition of the above code:

  • _nasdaqdatalink.get_table _is the function compatible with the Tables API;
  • QUOTEMEDIA/PRICES is the the appropriate database to call;
  • ticker='IBM' is the ticker required;
  • date={...} passes the GTE and LTE operators to specify the date range; and
  • paginate=True (optional) is a parameter used to return data if there are more than 10,000 rows.

To view the full Python documentation for our tables API, please see: https://docs.data.nasdaq.com/docs/python-tables [1] [1] Additional usage examples specific to the EOD product may be viewed in the product page's quickstart guide: https://data.nasdaq.com/databases/EOD/usage/quickstart/api [2] [2]

We hope this helps! Please feel free to let us know should you have any additional questions.

Kind regards, Kim

Links:

[1] https://docs.data.nasdaq.com/docs/python-tables [3] [2] https://data.nasdaq.com/databases/EOD/usage/quickstart/api [4]

KIM LIRA Client Success Nasdaq Data Link

How would you rate my reply? Great [1] Okay [2] Not Good [3]

Links:

[1]

https://secure.helpscout.net/satisfaction/589080097/record/6274470031/1/ [5] [2]

https://secure.helpscout.net/satisfaction/589080097/record/6274470031/2/ [6] [3]

https://secure.helpscout.net/satisfaction/589080097/record/6274470031/3/ [7]

On Wed, Dec 28, 2022 at 6:59 AM EST, Nasdaq/data-Link-Python @.***> wrote:

WARNING - EXTERNAL EMAIL; EXERCISE CAUTION.

Hello to all,

I also have truble getting the data.... I have my https://data.nasdaq.com/ [8] [1] account and a subscription to QUOTEMEDIA/End of Day US Stock Prices.

I have truble getting the end of day data for the last month. Can you please help me, with my code to get the last 30 day data for IBM, please?

In my code below I replaced my API KEY with 'xxx'. Thank you for your time and help. Best regards, Valter

My python code:

import nasdaqdatalink if name == 'main': nasdaqdatalink.ApiConfig.api_key = "xxx" data = nasdaqdatalink.get('NSE/OIL') print(data)

The result:

Open High ... Total Trade Quantity Turnover (Lacs) Date ... 2009-09-30 1096.00 1156.70 ... 19748012.0 223877.07 2009-10-01 1102.00 1173.70 ... 3074254.0 35463.78 2009-10-05 1152.00 1165.90 ... 919832.0 10581.13 2009-10-06 1149.80 1157.20 ... 627957.0 7185.90 2009-10-07 1153.80 1160.70 ... 698216.0 8032.98 ... ... ... ... ... ... 2018-12-31 178.10 179.00 ... 761462.0 1343.75 2019-01-01 175.00 176.40 ... 381570.0 669.16 2019-01-02 175.80 176.20 ... 722532.0 1251.85 2019-01-03 172.80 175.70 ... 698190.0 1212.34 2019-01-04 172.05 174.95 ... 431122.0 749.99 [2299 rows x 7 columns] Process finished with exit code 0

- Reply to this email directly, view it on GitHub [2], or unsubscribe [3]. You are receiving this because you commented.Message ID: @.***>


CONFIDENTIALITY AND PRIVACY NOTICE: This e-mail and any attachments are for the exclusive and confidential use of the intended recipient and may constitute non-public information. Personal data in this email is governed by our Privacy Policy at https://www.nasdaq.com/privacy-statement [9] [4] unless explicitly excluded from it; please see the section in the policy entitled "Situations Where This Privacy Policy Does Not Apply" for circumstances where different privacy terms govern emailed personal data. If you received this e-mail in error, disclosing, copying, distributing or taking any action in reliance of this e-mail is strictly prohibited and may be unlawful. Instead, please notify us immediately by return e-mail and promptly delete this message and its attachments from your computer system. We do not waive any work product or other applicable legal privilege(s) by the transmission of this message.


Links:

[1] https://data.nasdaq.com/ [10] [2]

https://github.com/Nasdaq/data-link-python/issues/31#issuecomment-1366598059 [11]

[3]

https://github.com/notifications/unsubscribe-auth/AWYQ644UC4NNKEMVJKIRHQ3WPQTQ3ANCNFSM6AAAAAASDWOTGQ [12]

[4] https://www.nasdaq.com/privacy-statement [13]

- Reply to this email directly, view it on GitHub

<https://github.com/Nasdaq/data-link-python/issues/31#issuecomment-1366709189, or unsubscribe

<https://github.com/notifications/unsubscribe-auth/AE4CDQBTDMC2IL7OGMP5G2TWPRICRANCNFSM6AAAAAASDWOTGQ . You are receiving this because you commented.Message ID: @.***>

- Reply to this email directly, view it on GitHub [14], or unsubscribe [15]. You are receiving this because you commented.Message ID: @.***>


CONFIDENTIALITY AND PRIVACY NOTICE: This e-mail and any attachments are for the exclusive and confidential use of the intended recipient and may constitute non-public information. Personal data in this email is governed by our Privacy Policy at https://www.nasdaq.com/privacy-statement [16] unless explicitly excluded from it; please see the section in the policy entitled "Situations Where This Privacy Policy Does Not Apply" for circumstances where different privacy terms govern emailed personal data. If you received this e-mail in error, disclosing, copying, distributing or taking any action in reliance of this e-mail is strictly prohibited and may be unlawful. Instead, please notify us immediately by return e-mail and promptly delete this message and its attachments from your computer system. We do not waive any work product or other applicable legal privilege(s) by the transmission of this message.


Links:

[1] https://docs.data.nasdaq.com/docs/python-tables [2] https://data.nasdaq.com/databases/EOD/usage/quickstart/api [3] https://docs.data.nasdaq.com/docs/python-tables [4] https://data.nasdaq.com/databases/EOD/usage/quickstart/api [5] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/1/ [6] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/2/ [7] https://secure.helpscout.net/satisfaction/589080097/record/6274470031/3/ [8] https://data.nasdaq.com/ [9] https://www.nasdaq.com/privacy-statement [10] https://data.nasdaq.com/ [11] https://github.com/Nasdaq/data-link-python/issues/31#issuecomment-1366598059 [12] https://github.com/notifications/unsubscribe-auth/AWYQ644UC4NNKEMVJKIRHQ3WPQTQ3ANCNFSM6AAAAAASDWOTGQ [13] https://www.nasdaq.com/privacy-statement [14] https://github.com/Nasdaq/data-link-python/issues/31#issuecomment-1366764938 [15] https://github.com/notifications/unsubscribe-auth/AWYQ645PQKCJGDW5QALT7BLWPRRNZANCNFSM6AAAAAASDWOTGQ [16] https://www.nasdaq.com/privacy-statement

morfeo630 commented 1 year ago

Thank you Kim for your help. Now I have my code working and getting the requested data. Howewer I have additional questions bat they are for other topic.

Thank you for your time and answers. Best regards, Valter