Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
maxima-net committed Aug 23, 2022
1 parent cd915de commit ce2c372
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/exchange/ratesProvider/binance/binanceRatesProvider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BigNumber from 'bignumber.js';

import type { Currency } from '../../../common';
import { HttpClient } from '../../../core';
import type { RatesProvider } from '../ratesProvider';
import type { BinanceErrorDto, BinanceRatesDto } from './dtos';
Expand All @@ -14,7 +15,7 @@ export class BinanceRatesProvider implements RatesProvider {
this.httpClient = new HttpClient(BinanceRatesProvider.baseUrl);
}

async getPrice(quoteCurrency: string, baseCurrency: string): Promise<BigNumber | undefined> {
async getPrice(quoteCurrency: Currency['id'], baseCurrency: Currency['id']): Promise<BigNumber | undefined> {
const urlPath = `/v3/ticker/price?symbol=${quoteCurrency}${baseCurrency}`;
const responseDto = await this.httpClient.request<BinanceRatesDto | BinanceErrorDto>({ urlPath }, false);

Expand Down
3 changes: 2 additions & 1 deletion src/exchange/ratesProvider/kraken/krakenRatesProvider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import BigNumber from 'bignumber.js';

import type { Currency } from '../../../common';
import { HttpClient } from '../../../core';
import type { RatesProvider } from '../ratesProvider';
import type { KrakenRatesDto } from './dtos';
Expand All @@ -13,7 +14,7 @@ export class KrakenRatesProvider implements RatesProvider {
this.httpClient = new HttpClient(KrakenRatesProvider.baseUrl);
}

async getPrice(quoteCurrency: string, baseCurrency: string): Promise<BigNumber | undefined> {
async getPrice(quoteCurrency: Currency['id'], baseCurrency: Currency['id']): Promise<BigNumber | undefined> {
const symbol = `${quoteCurrency}${baseCurrency}`;
const urlPath = `/0/public/Ticker?pair=${symbol}`;
const responseDto = await this.httpClient.request<KrakenRatesDto>({ urlPath }, false);
Expand Down

0 comments on commit ce2c372

Please sign in to comment.