@nevuamarkets/poly-websockets 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -6
- package/dist/modules/GroupSocket.js +6 -6
- package/package.json +1 -1
- package/src/modules/GroupSocket.ts +6 -6
package/README.md
CHANGED
|
@@ -22,7 +22,10 @@ npm install @nevuamarkets/poly-websockets
|
|
|
22
22
|
## Quick Start
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
WSSubscriptionManager,
|
|
27
|
+
WebSocketHandlers
|
|
28
|
+
} from '@nevuamarkets/poly-websockets';
|
|
26
29
|
|
|
27
30
|
// Create the subscription manager with your own handlers
|
|
28
31
|
const manager = new WSSubscriptionManager({
|
|
@@ -147,10 +150,7 @@ const manager = new WSSubscriptionManager(handlers, {
|
|
|
147
150
|
|
|
148
151
|
## Examples
|
|
149
152
|
|
|
150
|
-
Check the [examples](./examples) folder for complete working examples
|
|
151
|
-
- Basic price monitoring
|
|
152
|
-
- Market data aggregation
|
|
153
|
-
- Real-time trading interfaces
|
|
153
|
+
Check the [examples](./examples) folder for complete working examples
|
|
154
154
|
|
|
155
155
|
## Error Handling
|
|
156
156
|
|
|
@@ -163,7 +163,6 @@ The library includes error handling:
|
|
|
163
163
|
Respects Polymarket's API rate limits:
|
|
164
164
|
- Default: 5 requests per second burst limit
|
|
165
165
|
- Configurable through custom Bottleneck instances
|
|
166
|
-
- Automatic backoff on rate limit hits
|
|
167
166
|
|
|
168
167
|
## License
|
|
169
168
|
|
|
@@ -188,7 +188,7 @@ class GroupSocket {
|
|
|
188
188
|
this.bookCache.upsertPriceChange(event);
|
|
189
189
|
}
|
|
190
190
|
catch (err) {
|
|
191
|
-
logger_1.logger.
|
|
191
|
+
logger_1.logger.debug({
|
|
192
192
|
message: `Skipping derived future price calculation price_change: book not found for asset`,
|
|
193
193
|
asset_id: event.asset_id,
|
|
194
194
|
event: event,
|
|
@@ -201,7 +201,7 @@ class GroupSocket {
|
|
|
201
201
|
spreadOver10Cents = this.bookCache.spreadOver(event.asset_id, 0.1);
|
|
202
202
|
}
|
|
203
203
|
catch (err) {
|
|
204
|
-
logger_1.logger.
|
|
204
|
+
logger_1.logger.debug({
|
|
205
205
|
message: 'Skipping derived future price calculation for price_change: error calculating spread',
|
|
206
206
|
asset_id: event.asset_id,
|
|
207
207
|
event: event,
|
|
@@ -215,7 +215,7 @@ class GroupSocket {
|
|
|
215
215
|
newPrice = this.bookCache.midpoint(event.asset_id);
|
|
216
216
|
}
|
|
217
217
|
catch (err) {
|
|
218
|
-
logger_1.logger.
|
|
218
|
+
logger_1.logger.debug({
|
|
219
219
|
message: 'Skipping derived future price calculation for price_change: error calculating midpoint',
|
|
220
220
|
asset_id: event.asset_id,
|
|
221
221
|
event: event,
|
|
@@ -225,7 +225,7 @@ class GroupSocket {
|
|
|
225
225
|
}
|
|
226
226
|
const bookEntry = this.bookCache.getBookEntry(event.asset_id);
|
|
227
227
|
if (!bookEntry) {
|
|
228
|
-
logger_1.logger.
|
|
228
|
+
logger_1.logger.debug({
|
|
229
229
|
message: 'Skipping derived future price calculation price_change: book not found for asset',
|
|
230
230
|
asset_id: event.asset_id,
|
|
231
231
|
event: event,
|
|
@@ -266,7 +266,7 @@ class GroupSocket {
|
|
|
266
266
|
spreadOver10Cents = this.bookCache.spreadOver(event.asset_id, 0.1);
|
|
267
267
|
}
|
|
268
268
|
catch (err) {
|
|
269
|
-
logger_1.logger.
|
|
269
|
+
logger_1.logger.debug({
|
|
270
270
|
message: 'Skipping derived future price calculation for last_trade_price: error calculating spread',
|
|
271
271
|
asset_id: event.asset_id,
|
|
272
272
|
event: event,
|
|
@@ -279,7 +279,7 @@ class GroupSocket {
|
|
|
279
279
|
const newPrice = parseFloat(event.price).toString();
|
|
280
280
|
const bookEntry = this.bookCache.getBookEntry(event.asset_id);
|
|
281
281
|
if (!bookEntry) {
|
|
282
|
-
logger_1.logger.
|
|
282
|
+
logger_1.logger.debug({
|
|
283
283
|
message: 'Skipping derived future price calculation last_trade_price: book not found for asset',
|
|
284
284
|
asset_id: event.asset_id,
|
|
285
285
|
event: event,
|
package/package.json
CHANGED
|
@@ -213,7 +213,7 @@ export class GroupSocket {
|
|
|
213
213
|
try {
|
|
214
214
|
this.bookCache.upsertPriceChange(event);
|
|
215
215
|
} catch (err: any) {
|
|
216
|
-
logger.
|
|
216
|
+
logger.debug({
|
|
217
217
|
message: `Skipping derived future price calculation price_change: book not found for asset`,
|
|
218
218
|
asset_id: event.asset_id,
|
|
219
219
|
event: event,
|
|
@@ -226,7 +226,7 @@ export class GroupSocket {
|
|
|
226
226
|
try {
|
|
227
227
|
spreadOver10Cents = this.bookCache.spreadOver(event.asset_id, 0.1);
|
|
228
228
|
} catch (err: any) {
|
|
229
|
-
logger.
|
|
229
|
+
logger.debug({
|
|
230
230
|
message: 'Skipping derived future price calculation for price_change: error calculating spread',
|
|
231
231
|
asset_id: event.asset_id,
|
|
232
232
|
event: event,
|
|
@@ -240,7 +240,7 @@ export class GroupSocket {
|
|
|
240
240
|
try {
|
|
241
241
|
newPrice = this.bookCache.midpoint(event.asset_id);
|
|
242
242
|
} catch (err: any) {
|
|
243
|
-
logger.
|
|
243
|
+
logger.debug({
|
|
244
244
|
message: 'Skipping derived future price calculation for price_change: error calculating midpoint',
|
|
245
245
|
asset_id: event.asset_id,
|
|
246
246
|
event: event,
|
|
@@ -251,7 +251,7 @@ export class GroupSocket {
|
|
|
251
251
|
|
|
252
252
|
const bookEntry: BookEntry | null = this.bookCache.getBookEntry(event.asset_id);
|
|
253
253
|
if (!bookEntry) {
|
|
254
|
-
logger.
|
|
254
|
+
logger.debug({
|
|
255
255
|
message: 'Skipping derived future price calculation price_change: book not found for asset',
|
|
256
256
|
asset_id: event.asset_id,
|
|
257
257
|
event: event,
|
|
@@ -293,7 +293,7 @@ export class GroupSocket {
|
|
|
293
293
|
try {
|
|
294
294
|
spreadOver10Cents = this.bookCache.spreadOver(event.asset_id, 0.1);
|
|
295
295
|
} catch (err: any) {
|
|
296
|
-
logger.
|
|
296
|
+
logger.debug({
|
|
297
297
|
message: 'Skipping derived future price calculation for last_trade_price: error calculating spread',
|
|
298
298
|
asset_id: event.asset_id,
|
|
299
299
|
event: event,
|
|
@@ -308,7 +308,7 @@ export class GroupSocket {
|
|
|
308
308
|
|
|
309
309
|
const bookEntry: BookEntry | null = this.bookCache.getBookEntry(event.asset_id);
|
|
310
310
|
if (!bookEntry) {
|
|
311
|
-
logger.
|
|
311
|
+
logger.debug({
|
|
312
312
|
message: 'Skipping derived future price calculation last_trade_price: book not found for asset',
|
|
313
313
|
asset_id: event.asset_id,
|
|
314
314
|
event: event,
|