UNPKG

@bcswaper/apis

Version:

bcswaper apis

1 lines 576 B
import{conerr}from"../utils";import{ClientSettings}from"../context";export class TradesHandler{constructor(t){this.symbol=t,this.trades=[]}async initialize(t){const{id:e,contents:s}=t;s.trades&&(this.trades=s.trades)}async update(t){const{id:e,contents:s}=t;s.trades?(this.trades.unshift(s.trades),this.trades.length>ClientSettings.ListLenths&&this.trades.pop()):conerr("got empty contents for trades channel.")}getTrades(){return this.trades}}export var TradeType;!function(t){t.LIMIT="LIMIT",t.LIQUIDATED="LIQUIDATED",t.DELEVERAGED="DELEVERAGED"}(TradeType||(TradeType={}));