@0xarchive/sdk 0.3.4 → 0.3.6
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 +3 -3
- package/dist/index.d.mts +389 -389
- package/dist/index.d.ts +389 -389
- package/dist/index.js +65 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ const client = new OxArchive({ apiKey: 'ox_your_api_key' });
|
|
|
21
21
|
|
|
22
22
|
// Get current order book
|
|
23
23
|
const orderbook = await client.orderbook.get('BTC');
|
|
24
|
-
console.log(`BTC mid price: ${orderbook.
|
|
24
|
+
console.log(`BTC mid price: ${orderbook.midPrice}`);
|
|
25
25
|
|
|
26
26
|
// Get historical order book snapshots
|
|
27
27
|
const history = await client.orderbook.history('ETH', {
|
|
@@ -158,7 +158,7 @@ ws.subscribeAllTickers();
|
|
|
158
158
|
|
|
159
159
|
// Handle real-time data with typed callbacks
|
|
160
160
|
ws.onOrderbook((coin, data) => {
|
|
161
|
-
console.log(`${coin} mid price: ${data.
|
|
161
|
+
console.log(`${coin} mid price: ${data.midPrice}`);
|
|
162
162
|
});
|
|
163
163
|
|
|
164
164
|
ws.onTrades((coin, trades) => {
|
|
@@ -185,7 +185,7 @@ ws.connect();
|
|
|
185
185
|
|
|
186
186
|
// Handle replay data - this is where historical records arrive
|
|
187
187
|
ws.onHistoricalData((coin, timestamp, data) => {
|
|
188
|
-
console.log(`${new Date(timestamp).toISOString()}: ${data.
|
|
188
|
+
console.log(`${new Date(timestamp).toISOString()}: ${data.midPrice}`);
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
// Replay lifecycle events
|