@nevuamarkets/poly-websockets 0.1.1 → 0.1.3

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.
Files changed (2) hide show
  1. package/README.md +17 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -22,22 +22,24 @@ npm install @nevuamarkets/poly-websockets
22
22
  ## Quick Start
23
23
 
24
24
  ```typescript
25
- import { WSSubscriptionManager, WebSocketHandlers } from '@nevuamarkets/poly-websockets';
26
-
27
- // Define your event handlers
28
- const handlers: WebSocketHandlers = {
29
- onPolymarketPriceUpdate: async (events) => {
30
- events.forEach(event => {
31
- console.log(`Price update for ${event.asset_id}: $${event.price}`);
32
- });
25
+ import {
26
+ WSSubscriptionManager,
27
+ WebSocketHandlers
28
+ } from '@nevuamarkets/poly-websockets';
29
+
30
+ // Create the subscription manager with your own handlers
31
+ const manager = new WSSubscriptionManager({
32
+ onBook: async (events: BookEvent[]) => {
33
+ for (const event of events) {
34
+ console.log('book event', JSON.stringify(event, null, 2))
35
+ }
33
36
  },
34
- onError: async (error) => {
35
- console.error('WebSocket error:', error);
37
+ onPriceChange: async (events: PriceChangeEvent[]) => {
38
+ for (const event of events) {
39
+ console.log('price change event', JSON.stringify(event, null, 2))
40
+ }
36
41
  }
37
- };
38
-
39
- // Create the subscription manager
40
- const manager = new WSSubscriptionManager(handlers);
42
+ });
41
43
 
42
44
  // Subscribe to assets
43
45
  await manager.addSubscriptions(['asset-id-1', 'asset-id-2']);
@@ -148,10 +150,7 @@ const manager = new WSSubscriptionManager(handlers, {
148
150
 
149
151
  ## Examples
150
152
 
151
- Check the [examples](./examples) folder for complete working examples including:
152
- - Basic price monitoring
153
- - Market data aggregation
154
- - Real-time trading interfaces
153
+ Check the [examples](./examples) folder for complete working examples
155
154
 
156
155
  ## Error Handling
157
156
 
@@ -164,7 +163,6 @@ The library includes error handling:
164
163
  Respects Polymarket's API rate limits:
165
164
  - Default: 5 requests per second burst limit
166
165
  - Configurable through custom Bottleneck instances
167
- - Automatic backoff on rate limit hits
168
166
 
169
167
  ## License
170
168
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nevuamarkets/poly-websockets",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Plug-and-play Polymarket WebSocket price alerts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",