Skip to content

Commit

Permalink
Merge pull request #17 from coinsambacom/fix/kraken-xbt
Browse files Browse the repository at this point in the history
Fix: fix XBT in kraken
  • Loading branch information
itxtoledo authored Nov 2, 2023
2 parents 10e8d20 + f69a5f7 commit be533fa
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/connectors/kraken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@ export class kraken<T = any> extends Exchange<T> {
}

async getTicker(base: string, quote: string): Promise<ITicker> {
if (base == "BTC") base = "XBT";
let requestBase = base;

if (requestBase === "BTC") {
requestBase = "XBT";
}

const { result: res } = await this.fetch<IKrakenTickerRes>(
this.baseUrl + "/Ticker?pair=" + base + quote,
this.baseUrl + "/Ticker?pair=" + requestBase + quote,
);

const ticker = res[Object.keys(res)[0] as string] as IKrakenTicker;
Expand All @@ -73,9 +78,14 @@ export class kraken<T = any> extends Exchange<T> {
}

async getBook(base: string, quote: string): Promise<IOrderbook> {
if (base == "BTC") base = "XBT";
let requestBase = base;

if (requestBase === "BTC") {
requestBase = "XBT";
}

const { result: res } = await this.fetch<IKrakenBookRes>(
this.baseUrl + "/Depth?pair=" + base + quote,
this.baseUrl + "/Depth?pair=" + requestBase + quote,
);

const book = res[Object.keys(res)[0] as string] as IKrakenOrderbook;
Expand Down

0 comments on commit be533fa

Please sign in to comment.