diff --git a/src/explorer/stockProvider.ts b/src/explorer/stockProvider.ts index 112c251e..81bfb810 100644 --- a/src/explorer/stockProvider.ts +++ b/src/explorer/stockProvider.ts @@ -160,7 +160,7 @@ export class StockProvider implements TreeDataProvider { } getAStockNodes(stocks: Promise): Promise { const aStocks: Promise = stocks.then((res: LeekTreeItem[]) => { - const arr = res.filter((item: LeekTreeItem) => /^(sh|sz)/.test(item.type || '')); + const arr = res.filter((item: LeekTreeItem) => /^(sh|sz|bj)/.test(item.type || '')); return arr; }); diff --git a/src/explorer/stockService.ts b/src/explorer/stockService.ts index 6557ca9f..a17b5504 100644 --- a/src/explorer/stockService.ts +++ b/src/explorer/stockService.ts @@ -120,7 +120,7 @@ export default class StockService extends LeekService { let stockItem: any; let fixedNumber = 2; if (params.length > 1) { - if (/^(sh|sz)/.test(code)) { + if (/^(sh|sz|bj)/.test(code)) { let open = params[1]; let yestclose = params[2]; let price = params[3]; @@ -552,7 +552,7 @@ export default class StockService extends LeekService { const stocks = stockResponse.data.stocks || []; stocks.forEach((item: any) => { const { code, name } = item; - if (code.startsWith('SH') || code.startsWith('SZ')) { + if (code.startsWith('SH') || code.startsWith('SZ') || code.startsWith('BJ')) { const _code = code.toLowerCase(); result.push({ label: `${_code} | ${name}`, diff --git a/src/shared/leekConfig.ts b/src/shared/leekConfig.ts index ff46cf78..2d2b104b 100644 --- a/src/shared/leekConfig.ts +++ b/src/shared/leekConfig.ts @@ -224,7 +224,7 @@ export class LeekFundConfig extends BaseConfig { // 找到前一个同市场的股票 for (let index = currentIndex - 1; index >= 0; index--) { const previousCode = configArr[index]; - if (/^(sh|sz)/.test(code) && /^(sh|sz)/.test(previousCode)) { + if (/^(sh|sz|bj)/.test(code) && /^(sh|sz|bj)/.test(previousCode)) { previousIndex = index; break; } @@ -270,7 +270,7 @@ export class LeekFundConfig extends BaseConfig { //找到后一个同市场的股票 for (let index = currentIndex + 1; index < configArr.length; index++) { const nextCode = configArr[index]; - if (/^(sh|sz)/.test(code) && /^(sh|sz)/.test(nextCode)) { + if (/^(sh|sz|bj)/.test(code) && /^(sh|sz|bj)/.test(nextCode)) { nextIndex = index; break; } diff --git a/src/shared/leekTreeItem.ts b/src/shared/leekTreeItem.ts index ba652827..fee9cb26 100644 --- a/src/shared/leekTreeItem.ts +++ b/src/shared/leekTreeItem.ts @@ -217,7 +217,7 @@ export class LeekTreeItem extends TreeItem { const isFuture = /nf_/.test(code) || /hf_/.test(code); - // type字段:国内期货前缀 `nf_` 。股票的 type 是交易所 (sz,sh) + // type字段:国内期货前缀 `nf_` 。股票的 type 是交易所 (sz,sh,bj) const typeText = type; const symbolText = isFuture ? name : symbol; diff --git a/src/shared/typed.ts b/src/shared/typed.ts index 2170be44..a9faa1a1 100644 --- a/src/shared/typed.ts +++ b/src/shared/typed.ts @@ -1,5 +1,5 @@ // 支持的股票类型 -export const STOCK_TYPE = ['sh', 'sz', 'hk', 'gb', 'us']; +export const STOCK_TYPE = ['sh', 'sz', 'bj', 'hk', 'gb', 'us']; export enum SortType { NORMAL = 0, // 基金默认顺序 diff --git a/src/shared/utils.ts b/src/shared/utils.ts index b2c5c8f7..b590e3bd 100644 --- a/src/shared/utils.ts +++ b/src/shared/utils.ts @@ -341,7 +341,7 @@ export function allMarkets(): Array { const stocks: Array = LeekFundConfig.getConfig('leek-fund.stocks'); stocks.forEach((item: string) => { let market = StockCategory.NODATA; - if (/^(sh|sz)/.test(item)) { + if (/^(sh|sz|bj)/.test(item)) { market = StockCategory.A; } else if (/^(hk)/.test(item)) { market = StockCategory.HK;