@bcswaper/apis
Version:
bcswaper apis
1 lines • 403 B
JavaScript
export class TickerHandler{constructor(c="ETH-USD",t){this.currentPrice=0,this.symbol=c,this.clientCallBackFuncs=t}async resolve(c){if(0===c?.length)return;const t=Number(c[0].last);await this.resetPrice(t)}async resetPrice(c){c!==this.currentPrice&&(this.currentPrice=c,this.clientCallBackFuncs.tickFunc&&await this.clientCallBackFuncs.tickFunc(this.currentPrice))}getPrice(){return this.currentPrice}}