Skip to content

Commit

Permalink
0.2.0 release
Browse files Browse the repository at this point in the history
Removing certificate pinning

Co-Authored-By: Spencer Sortman <47249767+ssortman@users.noreply.github.com>
  • Loading branch information
ruchirvaninasdaq and ssortman committed Nov 1, 2021
1 parent 076227f commit 6f4b0e0
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 294 deletions.
70 changes: 16 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,12 @@

Nasdaq Cloud Data Service (NCDS) provides a modern and efficient method of delivery for realtime exchange data and other financial information. Data is made available through a suite of APIs, allowing for effortless integration of data from disparate sources, and a dramatic reduction in time to market for customer-designed applications. The API is highly scalable, and robust enough to support the delivery of real-time exchange data.

# Products Currently Available
### Equities
#### The Nasdaq Stock Market
- [Nasdaq Basic](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NasdaqBasic-Cloud.pdf)
- [Nasdaq Last Sale+](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NLSPlus-cloud.pdf)
- [Nasdaq TotalView](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/Totalview-ITCH-cloud.pdf)
- [Nasdaq Consolidated Quotes and Trades](https://github.com/Nasdaq/CloudDataService/raw/master/specs/CQT-cloud.pdf)
#### Nasdaq BX
- [BX BBO](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/BX_BBO_Cloud.pdf)
- [BX Last Sale](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/BLS_Cloud.pdf)
#### Nasdaq PSX
- [PSX BBO](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/PSX_BBO_Cloud.pdf)
- [PSX Last Sale](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/PLS_Cloud.pdf)
#### Nasdaq Canada
- [Nasdaq Canada Basic](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/Nasdaq-Basic-Canada-Cloud-Specification.pdf)
### Indexes & ETPs
- [Global Index Data Service](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/GIDS_Cloud.pdf)
### Options
#### Nasdaq U.S. Derivatives
- [Nasdaq Smart Options](http://nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NCDSSmartOptions.pdf)
### Mutual Funds
- [Nasdaq Fund Network](http://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NFNDS_NCDS.pdf)
### News
- [Financial News](http://nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/MTNewswires-cloud.pdf)



# Items To Note

### Items To Note

* Connecting to the API requires credentials, which are provided by the Nasdaq Data Operations team during an on-boarding process
* This sample code only connects to one topic (NLSCTA); during on-boarding process, you will receive a topic list that you're entitled to.
* See https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Java for our officially support Java-based SDK.
* See https://github.com/Nasdaq/CloudDataService for our officially support Java-based SDK.


# Table of Contents
Expand All @@ -45,46 +19,37 @@ Nasdaq Cloud Data Service (NCDS) provides a modern and efficient method of deliv
The SDK currently supports Python 3.9 and above

### Get the SDK
The source code is currently hosted on GitHub at: https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python
- Clone the repository: ```git clone https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python.git```
- Move into the directory ```cd NasdaqCloudDataService-SDK-Python```
- Install the library and its dependencies from local source with ```pip install -e .```
The source code is currently hosted on GitHub at: https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python
- Clone the repository: ```git clone https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python.git```
- Move into the directory ```cd ncds-python-sample-consumer```
- Install the library and its dependencies from local source with ```pip install .```

Optional: to use the Jupyter notebook provided,
- Download Jupyter notebook using either pip ```pip3 install notebook``` or conda ```conda install -c conda-forge notebook```
- Download Jupyter notebook using pip ```pip install notebook```
- To run the notebook, use the command ```jupyter notebook``` and the Notebook Dashboard will open in your browser
- Select the file ```python_sdk_examples.ipynb```

### Retrieving certificates

Run `ncdssdk_client/src/main/python/ncdsclient/NCDSSession.py` with arguments, which takes the path where the certificate should be installed.

For example:
```python3.9 ncdssdk_client/src/main/python/ncdsclient/NCDSSession.py -opt INSTALLCERTS -path /my/trusted/store/ncdsinstallcerts```

### Stream configuration

Replace example stream properties in the file **kafka-config.json** (https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python/blob/master/ncdssdk_client/src/main/python/resources/kafka-config.json) with provided values during on-boarding.
Replace example stream properties in the file **kafka-config.json** (https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python/blob/master/ncdssdk_client/src/main/python/resources/kafka-config.json) with provided values during on-boarding.

**Note**: Ensure that the full path to the ca.crt file is provided. If the certificate was installed in the directory
`/my/trusted/store/ncdsinstallcerts`, then the full path would be `/my/trusted/store/ncdsinstallcerts/ca.crt`
Required kafka configuration

```properties
"bootstrap.servers": "{streams_endpoint_url}:9094"
"ssl.ca.location": "/path/to/dir/ca.crt"
"bootstrap.servers": {streams_endpoint_url}:9094
```

For optional consumer configurations see: https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md

### Client Authentication configuration

Replace example client authentication properties in the file **client-authentication-config.json** (https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python/blob/master/ncdssdk_client/src/main/python/resources/client-authentication-config.json) with valid credentials provided during on-boarding.
Replace example client authentication properties in the file **client-authentication-config.json** (https://github.com/Nasdaq/NasdaqCloudDataService-SDK-Python/blob/master/ncdssdk_client/src/main/python/resources/client-authentication-config.json) with valid credentials provided during on-boarding.


```properties
oauth.token.endpoint.uri: "https://{auth_endpoint_url}/auth/realms/pro-realm/protocol/openid-connect/token"
oauth.client.id: "client_id"
oauth.client.secret: "client_secret"
oauth.token.endpoint.uri: https://{auth_endpoint_url}/auth/realms/demo/protocol/openid-connect/token
oauth.client.id: client
oauth.client.secret: client-secret
```

### Create NCDS Session Client
Expand All @@ -97,7 +62,6 @@ oauth.client.secret: "client_secret"
" * METRICS - Display the Metrics for the topic\n" +
" * TOPICS - List of streams available on Nasdaq Cloud DataService\n" +
" * GETMSG - Get one example message for the given message name\n" +
" * INSTALLCERTS - Install certificate to keystore\n" +
" * CONTSTREAM - Retrieve continuous stream \n" +
" * FILTERSTREAM - Retrieve continuous stream filtered by symbols and/or msgtypes \n" +
" * HELP - help \n" +
Expand All @@ -108,7 +72,6 @@ oauth.client.secret: "client_secret"
"-kafkaprops -- Provide Kafka Properties File path --- For using different set of Kafka Properties \n" +
"-n -- Provide number of messages to retrieve --- REQUIRED for TOP \n" +
"-msgName -- Provide name of message based on schema --- REQUIRED for GETMSG \n" +
"-path -- Provide the path for key store --- REQUIRED for INSTALLCERTS \n" +
"-timestamp -- Provide timestamp in milliseconds --- OPTIONAL for TOP, CONTSTREAM and FILTERSTREAM\n"
```

Expand Down Expand Up @@ -138,7 +101,6 @@ security_cfg = {
}
kafka_cfg = {
"bootstrap.servers": "{streams_endpoint_url}:9094",
"ssl.ca.location": "ca.crt",
"auto.offset.reset": "earliest"
}
```
Expand Down Expand Up @@ -302,7 +264,7 @@ while True:
print(f"No Records Found for the Topic: {topic}")

for message in messages:
print(f"value :" + str(message.value()))
print(f"value :" + message.value())
```

Example output:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def nasdaq_specific_config(p):
p["security.protocol"] = "SASL_SSL"
p["sasl.mechanism"] = "OAUTHBEARER"
p["ssl.endpoint.identification.algorithm"] = "https"
p["enable.ssl.certificate.verification"] = False

return p

Expand Down
32 changes: 0 additions & 32 deletions ncdssdk/src/tests/unit-tests/test_InstallCertificates.py

This file was deleted.

11 changes: 0 additions & 11 deletions ncdssdk_client/src/main/python/ncdsclient/NCDSSession.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import sys
import logging
from ncdssdk.src.main.python.ncdsclient.NCDSClient import NCDSClient
from ncdssdk.src.main.python.ncdsclient.internal.utils.InstallCertificates import InstallCertificates
from ncdssdk_client.src.main.python.ncdsclient.utils.ValidateInput import ValidateInput
from confluent_kafka import KafkaException
from importlib import resources
Expand All @@ -22,7 +21,6 @@ def __init__(self, cmd):
self.symbols = cmd['symbols']
self.msgnames = cmd['msgnames']
self.message_name = cmd['msgname']
self.certificate_path = cmd['path']
self.num_top_messages = cmd['n']
self.timestamp = cmd['timestamp']

Expand Down Expand Up @@ -79,15 +77,6 @@ def main(self):
ncds_client.get_sample_messages(
self.topic, self.message_name, True)

elif self.test_option == "INSTALLCERTS":
try:
print("Installing Certificates")
# TODO: This could return the name of the full path of the certificate
InstallCertificates(self.certificate_path).install()
print(f"Installed certificate at: {self.certificate_path}")
except Exception as e:
logging.exception(f"Error in installing certificates {e}")

elif self.test_option == "TOPICS":
ncds_client = NCDSClient(self.security_cfg, self.kafka_cfg)
self.topics = ncds_client.list_topics_for_client()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ def print_help_message():
" * METRICS - Display the Metrics for the topic\n" +
" * TOPICS - List of streams available on Nasdaq Cloud DataService\n" +
" * GETMSG - Get one example message for the given message name\n" +
" * INSTALLCERTS - Install certificate to keystore\n" +
" * CONTSTREAM - Retrieve continuous stream \n" +
" * FILTERSTREAM - Retrieve continuous stream filtered by symbols and/or msgtypes \n" +
" * HELP - help \n" +
Expand All @@ -16,6 +15,5 @@ def print_help_message():
"-kafkaprops -- Provide Kafka Properties File path --- For using different set of Kafka Properties \n" +
"-n -- Provide number of messages to retrieve --- REQUIRED for TOP \n" +
"-msgName -- Provide name of message based on schema --- REQUIRED for GETMSG \n" +
"-path -- Provide the path for key store --- REQUIRED for INSTALLCERTS \n" +
"-timestamp -- Provide timestamp in milliseconds --- OPTIONAL for TOP, CONTSTREAM and FILTERSTREAM\n"
)
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ def validate_user_input(self):
print_help_message()
sys.exit()

elif self.test_option == "INSTALLCERTS":
if not self.certificate_path:
print(
"You must provide -path (Directory path) for getting example message")
print_help_message()
sys.exit()

elif self.test_option == "CONTSTREAM":
if not self.topic:
print("You must provide -topic")
Expand Down
1 change: 0 additions & 1 deletion ncdssdk_client/src/main/python/resources/kafka-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"bootstrap.servers": "bootstrap-server-endpoint",
"ssl.ca.location": "ncdscert.crt",
"auto.offset.reset": "earliest"
}
Loading

0 comments on commit 6f4b0e0

Please sign in to comment.