@nevuamarkets/poly-websockets 0.1.0 → 0.1.2

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 +12 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,7 +7,7 @@ Powering [Nevua Markets](https://nevua.markets)
7
7
  ## Installation
8
8
 
9
9
  ```bash
10
- npm install poly-websockets
10
+ npm install @nevuamarkets/poly-websockets
11
11
  ```
12
12
 
13
13
  ## Features
@@ -24,20 +24,19 @@ npm install poly-websockets
24
24
  ```typescript
25
25
  import { WSSubscriptionManager, WebSocketHandlers } from '@nevuamarkets/poly-websockets';
26
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
- });
27
+ // Create the subscription manager with your own handlers
28
+ const manager = new WSSubscriptionManager({
29
+ onBook: async (events: BookEvent[]) => {
30
+ for (const event of events) {
31
+ console.log('book event', JSON.stringify(event, null, 2))
32
+ }
33
33
  },
34
- onError: async (error) => {
35
- console.error('WebSocket error:', error);
34
+ onPriceChange: async (events: PriceChangeEvent[]) => {
35
+ for (const event of events) {
36
+ console.log('price change event', JSON.stringify(event, null, 2))
37
+ }
36
38
  }
37
- };
38
-
39
- // Create the subscription manager
40
- const manager = new WSSubscriptionManager(handlers);
39
+ });
41
40
 
42
41
  // Subscribe to assets
43
42
  await manager.addSubscriptions(['asset-id-1', 'asset-id-2']);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nevuamarkets/poly-websockets",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Plug-and-play Polymarket WebSocket price alerts",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",