Skip to content

Commit b2da9c0

Browse files
Options Edge and Equities Edge (#42)
* equities edge * options edge
1 parent 8d45f01 commit b2da9c0

7 files changed

Lines changed: 36 additions & 17 deletions

File tree

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# intrinio realtime python sdk
2-
SDK for working with Intrinio's realtime OPRA, IEX, delayed SIP, CBOE One, or NASDAQ Basic prices feeds. Get a comprehensive view with increased market volume and enjoy minimized exchange and per user fees.
2+
SDK for working with Intrinio's realtime OPRA, Options Edge, IEX, delayed SIP, CBOE One, Equities Edge, or NASDAQ Basic prices feeds. Get a comprehensive view with increased market volume and enjoy minimized exchange and per user fees.
33

44
[Intrinio](https://intrinio.com/) provides real-time stock and option prices via a two-way WebSocket connection. To get started, [subscribe to a real-time equity feed](https://intrinio.com/real-time-multi-exchange), or [subscribe to a real-time options feed](https://intrinio.com/financial-market-data/options-data) and follow the instructions below.
55

@@ -96,7 +96,7 @@ class Summarize(threading.Thread):
9696

9797
configuration = {
9898
'api_key': 'API_KEY_HERE',
99-
'provider': 'IEX' # 'REALTIME' (IEX), or 'IEX', or 'DELAYED_SIP', or 'NASDAQ_BASIC', or 'CBOE_ONE'
99+
'provider': 'IEX' # 'REALTIME' (IEX), or 'IEX', or 'DELAYED_SIP', or 'NASDAQ_BASIC', or 'CBOE_ONE' or 'EQUITIES_EDGE'
100100
# ,'delayed': True # Add this if you have realtime (nondelayed) access and want to force delayed mode. If you only have delayed mode access, this is redundant.
101101
# ,'replay_date': datetime.date.today() - datetime.timedelta(days=1) # needed for ReplayClient. The date to replay.
102102
# ,'with_simulated_delay': False # needed for ReplayClient. This plays back the events at the same rate they happened in market.
@@ -171,6 +171,7 @@ sys.exit(0)
171171
* **`NASDAQ_BASIC`** - NASDAQ Basic in the NASDAQ_BASIC provider.
172172
* **`IEX`** - From the IEX exchange in the REALTIME provider.
173173
* **`CBOE_ONE`** - From the CBOE One exchanges provider.
174+
* **`EQUITIES_EDGE`** - From the Equities Edge provider.
174175
* **market_center** - Provides the market center
175176
* **condition** - Provides the condition
176177

@@ -201,6 +202,7 @@ sys.exit(0)
201202
* **`NASDAQ_BASIC`** - NASDAQ Basic in the NASDAQ_BASIC provider.
202203
* **`IEX`** - From the IEX exchange in the REALTIME provider.
203204
* **`CBOE_ONE`** - From the CBOE One exchanges provider.
205+
* **`EQUITIES_EDGE`** - From the Equities Edge provider.
204206
* **market_center** - Provides the market center
205207
* **condition** - Provides the condition
206208

@@ -410,7 +412,7 @@ class Summarize(threading.Thread):
410412
# Your config object MUST include the 'api_key' and 'provider', at a minimum
411413
config: Config = Config(
412414
api_key="API_KEY_HERE",
413-
provider=Providers.OPRA,
415+
provider=Providers.OPRA, # or Providers.OPTIONS_EDGE
414416
num_threads=8,
415417
symbols=["AAPL", "BRKB__230217C00300000"], # this is a static list of symbols (options contracts or option chains) that will automatically be subscribed to when the client starts
416418
log_level=LogLevel.INFO,
@@ -633,7 +635,7 @@ You will receive your Intrinio API Key after [creating an account](https://intri
633635

634636
`client = IntrinioRealtimeEquitiesClient(configuration)` - Creates an Intrinio Realtime client
635637
* **Parameter** `configuration.api_key`: Your Intrinio API Key
636-
* **Parameter** `configuration.provider`: The real-time data provider to use ("IEX"/"REALTIME", or "DELAYED_SIP", or "NASDAQ_BASIC", or "CBOE_ONE")
638+
* **Parameter** `configuration.provider`: The real-time data provider to use ("IEX"/"REALTIME", or "DELAYED_SIP", or "NASDAQ_BASIC", or "CBOE_ONE", or "EQUITIES_EDGE")
637639
* **Parameter** `configuration.on_quote(quote, backlog)`: A function that handles received quotes. `backlog` is an integer representing the approximate size of the queue of unhandled quote/trade events.
638640
* **Parameter** `configuration.on_trade(quote, backlog)`: A function that handles received trades. `backlog` is an integer representing the approximate size of the queue of unhandled quote/trade events.
639641
* **Parameter** `configuration.logger`: (optional) A Python Logger instance to use for logging
@@ -654,7 +656,7 @@ def on_trade(trade, backlog):
654656

655657
configuration = {
656658
'api_key': '',
657-
'provider': 'IEX', # REALTIME (IEX) or IEX or CBOE_ONE or DELAYED_SIP or NASDAQ_BASIC
659+
'provider': 'IEX', # REALTIME (IEX) or IEX or CBOE_ONE or EQUITIES_EDGE or DELAYED_SIP or NASDAQ_BASIC
658660
#'delayed': True, # Add this if you have realtime (nondelayed) access and want to force delayed mode. If you only have delayed mode access, this is redundant.
659661
'on_quote': on_quote,
660662
'on_trade': on_trade
@@ -668,7 +670,7 @@ client = IntrinioRealtimeEquitiesClient(configuration)
668670
class Config:
669671
def __init__(self, apiKey : str, provider : Providers, numThreads : int = 4, logLevel : LogLevel = LogLevel.INFO, manualIpAddress : str = None, symbols : set[str] = None):
670672
self.apiKey : str = apiKey
671-
self.provider : Providers = provider # Providers.OPRA or Providers.MANUAL
673+
self.provider : Providers = provider # Providers.OPRA or Providers.OPTIONS_EDGE or Providers.MANUAL
672674
self.numThreads : int = numThreads # At least 4 threads are recommended for 'FIREHOSE' connections
673675
self.manualIpAddress : str = manualIpAddress
674676
self.symbols : list[str] = symbols # Static list of symbols to use
@@ -727,7 +729,7 @@ def on_trade(trade, backlog):
727729

728730
options = {
729731
'api_key': '',
730-
'provider': 'IEX', # REALTIME (IEX) or IEX or CBOE_ONE or DELAYED_SIP or NASDAQ_BASIC
732+
'provider': 'IEX', # REALTIME (IEX) or IEX or CBOE_ONE or EQUITIES_EDGE or DELAYED_SIP or NASDAQ_BASIC
731733
'replay_date': datetime.date.today(),
732734
'with_simulated_delay': False, # This plays back the events at the same rate they happened in market.
733735
'delete_file_when_done': True,

example_app_equities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def run(self):
4747

4848
configuration = {
4949
'api_key': 'API_KEY_HERE',
50-
'provider': 'IEX' # 'REALTIME' (IEX), or 'IEX', or 'DELAYED_SIP', or 'NASDAQ_BASIC', or 'CBOE_ONE'
50+
'provider': 'IEX' # 'REALTIME' (IEX), or 'IEX', or 'DELAYED_SIP', or 'NASDAQ_BASIC', or 'CBOE_ONE', or 'EQUITIES_EDGE'
5151
# ,'delayed': True # Add this if you have realtime (nondelayed) access and want to force delayed mode. If you only have delayed mode access, this is redundant.
5252
# ,'replay_date': datetime.date.today() - datetime.timedelta(days=1) # needed for ReplayClient. The date to replay.
5353
# ,'with_simulated_delay': False # needed for ReplayClient. This plays back the events at the same rate they happened in market.

example_app_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def run(self):
105105
# Your config object MUST include the 'api_key' and 'provider', at a minimum
106106
config: Config = Config(
107107
api_key="API_KEY_HERE",
108-
provider=Providers.OPRA,
108+
provider=Providers.OPRA, # or Providers.OPTIONS_EDGE
109109
num_threads=8,
110110
symbols=["AAPL", "BRKB__230217C00300000"], # this is a static list of symbols (options contracts or option chains) that will automatically be subscribed to when the client starts
111111
log_level=LogLevel.INFO,

intriniorealtime/equities_client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@
2525
OTC = "OTC"
2626
IEX = "IEX"
2727
CBOE_ONE = "CBOE_ONE"
28-
PROVIDERS = [REALTIME, MANUAL, DELAYED_SIP, NASDAQ_BASIC, IEX, CBOE_ONE]
29-
SUB_PROVIDERS = [NO_SUBPROVIDER, CTA_A, CTA_B, UTP, OTC, NASDAQ_BASIC, IEX, CBOE_ONE]
28+
EQUITIES_EDGE = "EQUITIES_EDGE"
29+
PROVIDERS = [REALTIME, MANUAL, DELAYED_SIP, NASDAQ_BASIC, IEX, CBOE_ONE, EQUITIES_EDGE]
30+
SUB_PROVIDERS = [NO_SUBPROVIDER, CTA_A, CTA_B, UTP, OTC, NASDAQ_BASIC, IEX, CBOE_ONE, EQUITIES_EDGE]
3031
MAX_QUEUE_SIZE = 250000
3132
DEBUGGING = not (sys.gettrace() is None)
3233
HEADER_MESSAGE_FORMAT_KEY = "UseNewEquitiesFormat"
3334
HEADER_MESSAGE_FORMAT_VALUE = "v2"
3435
HEADER_CLIENT_INFORMATION_KEY = "Client-Information"
35-
HEADER_CLIENT_INFORMATION_VALUE = "IntrinioPythonSDKv6.0.3"
36+
HEADER_CLIENT_INFORMATION_VALUE = "IntrinioPythonSDKv6.1.0"
3637

3738

3839
class EquitiesQuote:
@@ -184,6 +185,8 @@ def auth_url(self) -> str:
184185
auth_url = "https://realtime-nasdaq-basic.intrinio.com/auth"
185186
elif self.provider == CBOE_ONE:
186187
auth_url = "https://cboe-one.intrinio.com/auth"
188+
elif self.provider == EQUITIES_EDGE:
189+
auth_url = "https://equities-edge.intrinio.com/auth"
187190
elif self.provider == MANUAL:
188191
auth_url = "http://" + self.ipaddress + "/auth"
189192

@@ -213,6 +216,8 @@ def websocket_url(self) -> str:
213216
return "wss://realtime-nasdaq-basic.intrinio.com/socket/websocket?vsn=1.0.0&token=" + self.token + delayed_part
214217
elif self.provider == CBOE_ONE:
215218
return "wss://cboe-one.intrinio.com/socket/websocket?vsn=1.0.0&token=" + self.token + delayed_part
219+
elif self.provider == EQUITIES_EDGE:
220+
return "wss://equities-edge.intrinio.com/socket/websocket?vsn=1.0.0&token=" + self.token + delayed_part
216221
elif self.provider == MANUAL:
217222
return "ws://" + self.ipaddress + "/socket/websocket?vsn=1.0.0&token=" + self.token + delayed_part
218223
else:
@@ -470,7 +475,8 @@ def __init__(self, client, bypass_parsing: bool):
470475
4: OTC,
471476
5: NASDAQ_BASIC,
472477
6: IEX,
473-
7: CBOE_ONE
478+
7: CBOE_ONE,
479+
8: EQUITIES_EDGE
474480
}
475481

476482
def parse_quote(self, quote_bytes: bytes, start_index: int = 0) -> EquitiesQuote:

intriniorealtime/equities_replay_client.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ class IntrinioRealtimeConstants:
2929
NASDAQ_BASIC = "NASDAQ_BASIC"
3030
IEX = "IEX"
3131
CBOE_ONE = "CBOE_ONE"
32-
PROVIDERS = [REALTIME, MANUAL, DELAYED_SIP, NASDAQ_BASIC, IEX, CBOE_ONE]
33-
SUB_PROVIDERS = [NO_SUBPROVIDER, CTA_A, CTA_B, UTP, OTC, NASDAQ_BASIC, IEX, CBOE_ONE]
32+
EQUITIES_EDGE = "EQUITIES_EDGE"
33+
PROVIDERS = [REALTIME, MANUAL, DELAYED_SIP, NASDAQ_BASIC, IEX, CBOE_ONE, EQUITIES_EDGE]
34+
SUB_PROVIDERS = [NO_SUBPROVIDER, CTA_A, CTA_B, UTP, OTC, NASDAQ_BASIC, IEX, CBOE_ONE, EQUITIES_EDGE]
3435
MAX_QUEUE_SIZE = 1000000
3536
EVENT_BUFFER_SIZE = 100
3637

@@ -278,6 +279,8 @@ def map_subprovider_to_api_value(sub_provider):
278279
return "nasdaq_basic"
279280
case IntrinioRealtimeConstants.CBOE_ONE:
280281
return "cboe_one"
282+
case IntrinioRealtimeConstants.EQUITIES_EDGE:
283+
return "equities_edge"
281284
case _:
282285
return "iex"
283286

@@ -298,6 +301,8 @@ def map_provider_to_subproviders(provider):
298301
return [IntrinioRealtimeConstants.NASDAQ_BASIC]
299302
case IntrinioRealtimeConstants.CBOE_ONE:
300303
return [IntrinioRealtimeConstants.CBOE_ONE]
304+
case IntrinioRealtimeConstants.EQUITIES_EDGE:
305+
return [IntrinioRealtimeConstants.EQUITIES_EDGE]
301306
case _:
302307
return []
303308

@@ -447,6 +452,7 @@ def __init__(self, client):
447452
5: IntrinioRealtimeConstants.NASDAQ_BASIC,
448453
6: IntrinioRealtimeConstants.IEX,
449454
7: IntrinioRealtimeConstants.CBOE_ONE,
455+
8: IntrinioRealtimeConstants.EQUITIES_EDGE
450456
}
451457

452458
def parse_quote(self, quote_bytes, start_index=0):

intriniorealtime/options_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def do_backoff(fn: Callable[[None], bool]):
4545
class Providers(IntEnum):
4646
OPRA = 1
4747
MANUAL = 2
48+
OPTIONS_EDGE = 3
4849

4950
@unique
5051
class LogLevel(IntEnum):
@@ -704,6 +705,8 @@ def __get_websocket(self) -> _WebSocket:
704705
def __get_auth_url(self) -> str:
705706
if self.__provider == Providers.OPRA:
706707
return "https://realtime-options.intrinio.com/auth?api_key=" + self.__apiKey
708+
elif self.__provider == Providers.OPTIONS_EDGE:
709+
return "https://options-edge.intrinio.com/auth?api_key=" + self.__apiKey
707710
elif self.__provider == Providers.MANUAL:
708711
return "http://" + self.__manualIP + "/auth?api_key=" + self.__apiKey
709712
else:
@@ -713,6 +716,8 @@ def __get_web_socket_url(self, token: str) -> str:
713716
delay: str = "&delayed=true" if self.__delayed else ""
714717
if self.__provider == Providers.OPRA:
715718
return "wss://realtime-options.intrinio.com/socket/websocket?vsn=1.0.0&token=" + token + delay
719+
elif self.__provider == Providers.OPTIONS_EDGE:
720+
return "wss://options-edge.intrinio.com/socket/websocket?vsn=1.0.0&token=" + token + delay
716721
elif self.__provider == Providers.MANUAL:
717722
return "ws://" + self.__manualIP + "/socket/websocket?vsn=1.0.0&token=" + token + delay
718723
else:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def readme():
77
setup(
88
name = 'intriniorealtime',
99
packages = ['intriniorealtime'],
10-
version = '6.0.3',
10+
version = '6.1.0',
1111
author = 'Intrinio Python SDK for Real-Time Stock Prices',
1212
author_email = 'success@intrinio.com',
1313
url = 'https://intrinio.com',
@@ -16,7 +16,7 @@ def readme():
1616
long_description_content_type = 'text/markdown',
1717
install_requires = ['requests>=2.26.0','websocket-client>=1.2.1','wsaccel>=0.6.3', 'intrinio-sdk>=6.26.0'],
1818
python_requires = '~=3.10',
19-
download_url = 'https://github.com/intrinio/intrinio-realtime-python-sdk/archive/v6.0.3.tar.gz',
19+
download_url = 'https://github.com/intrinio/intrinio-realtime-python-sdk/archive/v6.1.0.tar.gz',
2020
keywords = ['realtime','stock prices','intrinio','stock market','stock data','financial'],
2121
classifiers = [
2222
'Intended Audience :: Financial and Insurance Industry',

0 commit comments

Comments
 (0)