@@ -387,6 +387,7 @@ A `snapshot` represents the state of the order book at a specific point in time.
387
387
388
388
- ` asks ` : List of ask orders, each with a ` price ` and a list of associated ` orders ` .
389
389
- ` bids ` : List of bid orders, each with a ` price ` and a list of associated ` orders ` .
390
+ - ` stopBook ` : an object with ` bids ` and ` asks ` properties related to every ` StopOrder ` in the orderbook.
390
391
- ` ts ` : A timestamp indicating when the snapshot was taken, in Unix timestamp format.
391
392
- ` lastOp ` : The id of the last operation included in the snapshot
392
393
@@ -405,7 +406,7 @@ await saveLog(order.log)
405
406
// ... after some time take a snapshot of the order book and save it on the database
406
407
407
408
const snapshot = ob .snapshot ()
408
- await saveSnapshot (snapshot)
409
+ await saveSnapshot (JSON . stringify ( snapshot) )
409
410
410
411
// If you want you can safely remove all logs preceding the `lastOp` id of the snapshot, and continue to save each subsequent log to the database
411
412
await removePreviousLogs (snapshot .lastOp )
@@ -414,7 +415,7 @@ await removePreviousLogs(snapshot.lastOp)
414
415
const logs = await getLogs ()
415
416
const snapshot = await getSnapshot ()
416
417
417
- const ob = new OrderBook ({ snapshot, journal: log, enableJournaling: true })
418
+ const ob = new OrderBook ({ snapshot: JSON . parse (snapshot) , journal: log, enableJournaling: true })
418
419
```
419
420
420
421
### Journal Logs
0 commit comments