Skip to content

Commit 7eb65b7

Browse files
committed
Bug fix, forgot to return on_open
1 parent 52bffc5 commit 7eb65b7

File tree

7 files changed

+12
-78
lines changed

7 files changed

+12
-78
lines changed

polygon/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
from polygon.websocket import WebSocketClient, STOCKS_CLUSTER, FOREX_CLUSTER, CRYPTO_CLUSTER
2+
from polygon.rest import RESTClient

polygon/rest/__init__.py

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1 @@
1-
# coding: utf-8
2-
3-
# flake8: noqa
4-
5-
"""
6-
Polygon API
7-
8-
The future of fintech. # noqa: E501
9-
10-
OpenAPI spec version: 1.0.1
11-
12-
Generated by: https://github.com/swagger-api/swagger-codegen.git
13-
"""
14-
15-
from __future__ import absolute_import
16-
17-
# import apis into sdk package
18-
from polygon.rest.api import CryptoApi
19-
from polygon.rest.api import ForexCurrenciesApi
20-
from polygon.rest.api import ReferenceApi
21-
from polygon.rest.api import StocksEquitiesApi
22-
# import ApiClient
23-
from polygon.rest.api_client import ApiClient
24-
from polygon.rest.configuration import Configuration
25-
# import models into sdk package
26-
from polygon.rest.models import AggResponse
27-
from polygon.rest.models import Aggregate
28-
from polygon.rest.models import Aggv2
29-
from polygon.rest.models import AnalystRatings
30-
from polygon.rest.models import Company
31-
from polygon.rest.models import ConditionTypeMap
32-
from polygon.rest.models import Conflict
33-
from polygon.rest.models import CryptoExchange
34-
from polygon.rest.models import CryptoSnapshotAgg
35-
from polygon.rest.models import CryptoSnapshotBookItem
36-
from polygon.rest.models import CryptoSnapshotTicker
37-
from polygon.rest.models import CryptoSnapshotTickerBook
38-
from polygon.rest.models import CryptoTick
39-
from polygon.rest.models import CryptoTickJson
40-
from polygon.rest.models import Dividend
41-
from polygon.rest.models import Earning
42-
from polygon.rest.models import Error
43-
from polygon.rest.models import Exchange
44-
from polygon.rest.models import Financial
45-
from polygon.rest.models import Financials
46-
from polygon.rest.models import Forex
47-
from polygon.rest.models import ForexAggregate
48-
from polygon.rest.models import ForexSnapshotAgg
49-
from polygon.rest.models import ForexSnapshotTicker
50-
from polygon.rest.models import HistTrade
51-
from polygon.rest.models import LastForexQuote
52-
from polygon.rest.models import LastForexTrade
53-
from polygon.rest.models import LastQuote
54-
from polygon.rest.models import LastTrade
55-
from polygon.rest.models import MarketHoliday
56-
from polygon.rest.models import MarketStatus
57-
from polygon.rest.models import News
58-
from polygon.rest.models import NotFound
59-
from polygon.rest.models import Quote
60-
from polygon.rest.models import RatingSection
61-
from polygon.rest.models import Split
62-
from polygon.rest.models import StockSymbol
63-
from polygon.rest.models import StocksSnapshotAgg
64-
from polygon.rest.models import StocksSnapshotBookItem
65-
from polygon.rest.models import StocksSnapshotQuote
66-
from polygon.rest.models import StocksSnapshotTicker
67-
from polygon.rest.models import StocksSnapshotTickerBook
68-
from polygon.rest.models import StocksV2NBBO
69-
from polygon.rest.models import StocksV2Trade
70-
from polygon.rest.models import Symbol
71-
from polygon.rest.models import SymbolTypeMap
72-
from polygon.rest.models import Ticker
73-
from polygon.rest.models import TickerSymbol
74-
from polygon.rest.models import Trade
75-
from polygon.rest.models import Unauthorized
1+
from .rest_client import RESTClient

polygon/websocket/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from polygon.websocket.websocket_client import WebSocketClient, STOCKS_CLUSTER, FOREX_CLUSTER, CRYPTO_CLUSTER

polygon_client/websocket_client.py renamed to polygon/websocket/websocket_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
CRYPTO_CLUSTER = "crypto"
1010

1111

12-
class WebSocketClient(object):
13-
DEFAULT_HOST = 'socket.polygon.io'
12+
class WebSocketClient:
13+
DEFAULT_HOST = "socket.polygon.io"
1414

1515
# TODO: Either an instance of the client couples 1:1 with the cluster or an instance of the Client couples 1:3 with
1616
# the 3 possible clusters (I think I like client per, but then a problem is the user can make multiple clients for
@@ -32,6 +32,9 @@ def __init__(self, cluster: str, auth_key: str, process_message: Optional[Callab
3232
# self._run_thread is only set if the client is run asynchronously
3333
self._run_thread: Optional[threading.Thread] = None
3434

35+
# TODO: this probably isn't great design.
36+
# If the user defines their own signal handler then this will gets overwritten.
37+
# We still need to make sure that killing, terminating, interrupting the program closes the connection
3538
signal.signal(signal.SIGINT, self._cleanup_signal_handler())
3639
signal.signal(signal.SIGTERM, self._cleanup_signal_handler())
3740

@@ -92,6 +95,7 @@ def _default_process_message(message):
9295
def _default_on_open(self):
9396
def f(ws):
9497
self._authenticate(ws)
98+
9599
return f
96100

97101
@staticmethod

polygon_client/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ certifi==2019.9.11
66
chardet==3.0.4
77
idna==2.8
88
multidict==4.5.2
9+
requests==2.22.0
910
six==1.12.0
11+
urllib3==1.25.6
1012
websocket-client==0.56.0
1113
websockets==8.0.2
1214
yarl==1.3.0
File renamed without changes.

0 commit comments

Comments
 (0)