Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/exchanges/src/client/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { pro as ccxt } from "ccxt";
import { exchanges as ccxt } from "ccxt";
import { ExchangeCode } from "@opentrader/types";

/**
Expand All @@ -11,12 +11,13 @@ import { ExchangeCode } from "@opentrader/types";
/**
* Map exchange code to CCXT instance class name
*/
export const exchangeCodeMapCCXT: Record<ExchangeCode, keyof typeof ccxt> = {
export const exchangeCodeMapCCXT: Record<ExchangeCode, string> = {
[ExchangeCode.OKX]: "okx",
[ExchangeCode.BYBIT]: "bybit",
[ExchangeCode.BITGET]: "bitget",
[ExchangeCode.BINANCE]: "binance",
[ExchangeCode.KRAKEN]: "kraken",
[ExchangeCode.COINBASE]: "coinbase",
[ExchangeCode.COINMATE]: "coinmate",
[ExchangeCode.GATEIO]: "gateio",
};
2 changes: 1 addition & 1 deletion packages/exchanges/src/exchanges/ccxt/exchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class CCXTExchange implements IExchange {
this.ccxt =
ccxtClassName in pro
? new pro[ccxtClassName as keyof typeof pro](ccxtCredentials)
: new exchanges[ccxtClassName](ccxtCredentials);
: new exchanges[ccxtClassName as keyof typeof exchanges](ccxtCredentials);

this.ccxt.fetchImplementation = fetcher; // #57
// #88 Fixes: 'e instanceof this.AbortError' is not an object
Expand Down
1 change: 1 addition & 0 deletions packages/exchanges/src/exchanges/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const exchanges: Record<ExchangeCode, ReturnType<typeof createExchange>>
[ExchangeCode.BINANCE]: createExchange(ExchangeCode.BINANCE),
[ExchangeCode.KRAKEN]: createExchange(ExchangeCode.KRAKEN),
[ExchangeCode.COINBASE]: createExchange(ExchangeCode.COINBASE),
[ExchangeCode.COINMATE]: createExchange(ExchangeCode.COINMATE),
[ExchangeCode.GATEIO]: createExchange(ExchangeCode.GATEIO),
} as const;

Expand Down
1 change: 1 addition & 0 deletions packages/types/src/common/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ExchangeCode = {
BINANCE: "BINANCE",
KRAKEN: "KRAKEN",
COINBASE: "COINBASE",
COINMATE: "COINMATE",
GATEIO: "GATEIO",
BITGET: "BITGET",
} as const;
Expand Down