Skip to content

Commit

Permalink
Fix kraken dto parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
maxima-net committed Aug 23, 2022
1 parent 89f7116 commit f6dbaa9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/exchange/ratesProvider/kraken/krakenRatesProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ export class KrakenRatesProvider implements RatesProvider {
const urlPath = `/0/public/Ticker?pair=${symbol}`;
const responseDto = await this.httpClient.request<KrakenRatesDto>({ urlPath }, false);

return this.mapRatesDtoToPrice(responseDto, symbol);
return this.mapRatesDtoToPrice(responseDto);
}

private mapRatesDtoToPrice(dto: KrakenRatesDto, symbol: string): BigNumber | undefined {
private mapRatesDtoToPrice(dto: KrakenRatesDto): BigNumber | undefined {
if (dto.error.length)
return undefined;

const tickerInfo = dto.result[symbol];
const symbol = Object.keys(dto.result)[0];
const tickerInfo = symbol ? dto.result[symbol] : undefined;
if (!tickerInfo)
return undefined;

Expand Down

0 comments on commit f6dbaa9

Please sign in to comment.