Skip to content

Commit

Permalink
Merge pull request coinbase#216 from blair/bookbuilder-bids-asks-are-…
Browse files Browse the repository at this point in the history
…readonly

BookBuilder: make bids and asks readonly.
  • Loading branch information
fb55 authored Apr 10, 2018
2 parents 7c368c9 + 71de334 commit a26436f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/BookBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ export class AggregatedLevelWithOrders extends AggregatedLevel implements PriceL
*/
export class BookBuilder extends EventEmitter implements Orderbook {
public sequence: number = -1;
protected bids: RBTree<AggregatedLevelWithOrders>;
protected asks: RBTree<AggregatedLevelWithOrders>;
protected readonly bids: RBTree<AggregatedLevelWithOrders> = PriceTreeFactory<AggregatedLevelWithOrders>();
protected readonly asks: RBTree<AggregatedLevelWithOrders> = PriceTreeFactory<AggregatedLevelWithOrders>();
protected _bidsTotal: BigJS = ZERO;
protected _bidsValueTotal: BigJS = ZERO;
protected _asksTotal: BigJS = ZERO;
Expand All @@ -166,8 +166,8 @@ export class BookBuilder extends EventEmitter implements Orderbook {
}

clear() {
this.bids = PriceTreeFactory<AggregatedLevelWithOrders>();
this.asks = PriceTreeFactory<AggregatedLevelWithOrders>();
this.bids.clear();
this.asks.clear();
this._bidsTotal = ZERO;
this._asksTotal = ZERO;
this._bidsValueTotal = ZERO;
Expand Down

0 comments on commit a26436f

Please sign in to comment.