ncdsclient

class ncdssdk.src.main.python.ncdsclient.NCDSClient.NCDSClient(security_cfg, kafka_cfg)

This is a client class to access Nasdaq’s market data. Internal methods are used by NCDSSession to get topics, schemas, messages, and consumer info.

security_cfg

Authentication security configuration passed from the client

Type

dict

kafka_cfg

Kafka consume configuration settings passed in from the client

Type

dict

close_consumer()

Close Nasdaq Kafka Consumer

end_of_data(consumer)

Checks if there is a final sequence number for this stream signaling the end of the data. Final sequence number is delivered in the stream_completed event.

Parameters

consumer (KafkaAvroConsumer) – the KafkaAvroConsumer

Returns

True if the end of the data stream has been reached, False otherwise

Return type

bool

get_sample_messages(topic_name, message_name, all_messages)

If all_messages is True, prints out all messages with given message name and topic. Otherwise, retrieves the first message from the topic with the given message name.

Parameters
  • topic_name (str) – name of topic we want to get a sample message for

  • message_name (str) – name of the message, retrieved from the schema

  • all_messages (bool) – True if function should query for all sample messages, False if function should query for just one

Returns

The example message(s)

Return type

str

get_schema_for_topic(topic)

Method takes in a topic and retrieves the schema from the consumer instance.

Parameters

topic (str) – the topic/stream name

Returns

The Kafka schema name for the given topic

Return type

str

list_topics_for_client()

Method produces a topics list from the NasdaqKafkaAvroConsumer instance.

Returns

A list of eligible topics/streams for the client

Return type

list

ncds_kafka_consumer(topic, timestamp=None)

Retrieves the Kafka consumer.

Parameters
  • topic (string) – Topic/Stream name

  • timestamp (int) – timestamp in milliseconds since the UNIX epoch

Returns

Nasdaq’s market data Kafka consumer

Return type

KafkaAvroConsumer

top_messages(topic_name, timestamp=None)

Retrieves messages from the given topic.

Parameters
  • topic_name (string) – Topic/Stream name

  • timestamp (int) – timestamp in milliseconds since the UNIX epoch, optional

Returns

A list of messages from the given topic

Return type

list