-
Notifications
You must be signed in to change notification settings - Fork 21
Commit b4d4422
committed
Abstracted out websocket interactions into an abstract base class that
OrderBook now inherits from. This allows easy creation of new types of
listeners for the GDAX websocket API.
*****************************
*** WebSocketFeedListener ***
*****************************
Factored the web socket code away from the actual orderbook
implementation. The new WebSocketFeedListener is an abstract base class
that handles the websocket itself including:
- Connect
- Disconnect
- Send / Receive messages
- Subscribing to channels
- Leveraging the trade log file
- Async Context Manager calls
WebSocketFeedListener inherits from ABC and has a single @AbstractMethod
handle_message(self), which must be implemented by subclasses.
******************************
********* OrderBook **********
******************************
Removed all WebSocket manipulation from OrderBook and left just the
OrderBook implementation. OrderBook now inherits from
WebSocketFeedListener and implements handle_message.1 parent eb4d93b commit b4d4422
3 files changed
+132
-75
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | - | ||
13 | 12 | | |
14 | 13 | | |
15 | - | ||
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
18 | + | ||
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | - | ||
25 | + | ||
27 | 26 | | |
28 | 27 | | |
29 | 28 | | |
30 | - | ||
31 | - | ||
32 | - | ||
33 | - | ||
34 | - | ||
35 | - | ||
36 | - | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
40 | - | ||
41 | - | ||
42 | - | ||
43 | - | ||
44 | 39 | | |
45 | 40 | | |
46 | 41 | | |
47 | 42 | | |
48 | 43 | | |
49 | 44 | | |
50 | - | ||
51 | - | ||
52 | - | ||
53 | - | ||
54 | - | ||
55 | - | ||
56 | - | ||
57 | - | ||
58 | - | ||
59 | - | ||
60 | - | ||
61 | - | ||
62 | - | ||
63 | - | ||
64 | - | ||
65 | 45 | | |
66 | 46 | | |
67 | - | ||
47 | + | ||
68 | 48 | | |
69 | 49 | | |
70 | 50 | | |
| |||
95 | 75 | | |
96 | 76 | | |
97 | 77 | | |
98 | - | ||
99 | - | ||
100 | - | ||
101 | - | ||
102 | - | ||
103 | - | ||
104 | - | ||
105 | - | ||
106 | - | ||
107 | - | ||
108 | - | ||
109 | - | ||
110 | - | ||
111 | - | ||
112 | - | ||
113 | - | ||
114 | - | ||
115 | - | ||
116 | - | ||
117 | - | ||
118 | - | ||
119 | - | ||
120 | - | ||
121 | - | ||
122 | - | ||
123 | - | ||
124 | - | ||
125 | - | ||
126 | - | ||
127 | - | ||
128 | - | ||
129 | - | ||
130 | - | ||
131 | - | ||
132 | - | ||
133 | - | ||
134 | - | ||
135 | - | ||
136 | - | ||
137 | - | ||
138 | - | ||
139 | - | ||
140 | - | ||
141 | - | ||
142 | - | ||
143 | 78 | | |
144 | 79 | | |
145 | 80 | | |
| |||
155 | 90 | | |
156 | 91 | | |
157 | 92 | | |
93 | + | ||
94 | + | ||
95 | + | ||
158 | 96 | | |
159 | 97 | | |
160 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | + | ||
2 | + | ||
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + | ||
8 | + | ||
9 | + | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | + | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | ||
19 | + | ||
20 | + | ||
21 | + | ||
22 | + | ||
23 | + | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | ||
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | ||
41 | + | ||
42 | + | ||
43 | + | ||
44 | + | ||
45 | + | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | + | ||
51 | + | ||
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | ||
80 | + | ||
81 | + | ||
82 | + | ||
83 | + | ||
84 | + | ||
85 | + | ||
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | ||
90 | + | ||
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | ||
100 | + | ||
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | ||
105 | + | ||
106 | + | ||
107 | + | ||
108 | + | ||
109 | + | ||
110 | + | ||
111 | + | ||
112 | + | ||
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | ||
117 | + | ||
118 | + | ||
0 commit comments