Skip to content

Commit

Permalink
fix: simplelist fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungGwan123 committed Nov 28, 2024
1 parent 0424aca commit 89d5389
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/server/src/upbit/coin-list.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ export class CoinListService {
.map((coin) => this.toSimpleCoinDto(coin));
}

async getSimpleCoin(markets: string[]): Promise<any[]> {
async getSimpleCoin(markets: string[] | string): Promise<any[]> {
const krwCoinInfo = await this.waitForKrwCoinInfo();
if (!markets.length) return [];

return krwCoinInfo
if(typeof markets === "string"){
return krwCoinInfo.filter(krw=> krw.market === markets)
.map((coin) => this.toSimpleCoinDto(coin));
}else{
return krwCoinInfo
.filter((coin) => markets.some(market=> market===coin.market))
.map((coin) => this.toSimpleCoinDto(coin));
}
}

private toSimpleCoinDto(coin: any): any {
Expand Down

0 comments on commit 89d5389

Please sign in to comment.