minor comments and doc changes

This commit is contained in:
mohamedemad4
2020-09-10 11:25:05 +02:00
parent 111dcb043d
commit a76fa92d60
3 changed files with 10 additions and 11 deletions

View File

@@ -144,7 +144,8 @@ Websocket support::
# Example response # Example response
# msg = { # msg = {
# "service":"iex" # An identifier telling you this is IEX data. The value returned by this will always be "iex". # "service":"iex" # An identifier telling you this is IEX data.
# The value returned by this will correspond to the endpoint argument.
# #
# # Will always return "A" meaning new price quotes. There are also H type Heartbeat msgs used to keep the connection alive # # Will always return "A" meaning new price quotes. There are also H type Heartbeat msgs used to keep the connection alive
# "messageType":"A" # A value telling you what kind of data packet this is from our IEX feed. # "messageType":"A" # A value telling you what kind of data packet this is from our IEX feed.

View File

@@ -70,7 +70,8 @@ Websocket support::
# Example response # Example response
# msg = { # msg = {
# "service":"iex" # An identifier telling you this is IEX data. The value returned by this will always be "iex". # "service":"iex" # An identifier telling you this is IEX data.
# The value returned by this will correspond to the endpoint argument.
# #
# # Will always return "A" meaning new price quotes. There are also H type Heartbeat msgs used to keep the connection alive # # Will always return "A" meaning new price quotes. There are also H type Heartbeat msgs used to keep the connection alive
# "messageType":"A" # A value telling you what kind of data packet this is from our IEX feed. # "messageType":"A" # A value telling you what kind of data packet this is from our IEX feed.

View File

@@ -1,5 +1,6 @@
import os import os
import websocket import websocket
#to import the correct version of thread regardless of python version
try: try:
import thread import thread
except ImportError: except ImportError:
@@ -42,7 +43,8 @@ class TiingoWebsocketClient:
# Example response # Example response
# msg = { # msg = {
# "service":"iex" # An identifier telling you this is IEX data. The value returned by this will always be "iex". # "service":"iex" # An identifier telling you this is IEX data.
# The value returned by this will correspond to the endpoint argument.
# #
# # Will always return "A" meaning new price quotes. There are also H type Heartbeat msgs used to keep the connection alive # # Will always return "A" meaning new price quotes. There are also H type Heartbeat msgs used to keep the connection alive
# "messageType":"A" # A value telling you what kind of data packet this is from our IEX feed. # "messageType":"A" # A value telling you what kind of data packet this is from our IEX feed.
@@ -85,13 +87,8 @@ class TiingoWebsocketClient:
" via environment variable or config argument." " via environment variable or config argument."
"Notice that this config dict takes the API Key as authorization ") "Notice that this config dict takes the API Key as authorization ")
try:
self.endpoint = endpoint self.endpoint = endpoint
if not self.endpoint:
raise KeyError
if not (self.endpoint=="iex" or self.endpoint=="fx" or self.endpoint=="crypto"): if not (self.endpoint=="iex" or self.endpoint=="fx" or self.endpoint=="crypto"):
raise KeyError
except KeyError:
raise AttributeError("Endpoint must be defined as either (iex,fx,crypto) ") raise AttributeError("Endpoint must be defined as either (iex,fx,crypto) ")
self.on_msg_cb = on_msg_cb self.on_msg_cb = on_msg_cb