Skip to content

Commit

Permalink
feat: 增加上海证券交易所上市公司公告披露 (#5579)
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyqiu authored Sep 2, 2020
1 parent b24cc24 commit 2e2aecd
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,12 @@ type 为 all 时,category 参数不支持 cost 和 free

</Route>

## 上海证券交易所

### 上市公司信息最新公告披露

<Route author="alienmao" example="/sse/disclosure/beginDate=2018-08-18&endDate=2020-08-25&productId=600696" path="/sse/disclosure/:query?" :paramsDesc="['筛选条件,见示例']" />

## 上证债券信息网

### 可转换公司债券公告
Expand Down
3 changes: 3 additions & 0 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -2022,6 +2022,9 @@ router.get('/sse/convert/:query?', require('./routes/sse/convert'));
router.get('/sse/renewal', require('./routes/sse/renewal'));
router.get('/sse/inquire', require('./routes/sse/inquire'));

// 上海证券交易所
router.get('/sse/disclosure/:query?', require('./routes/sse/disclosure'));

// 深圳证券交易所
router.get('/szse/notice', require('./routes/szse/notice'));
router.get('/szse/inquire/:type', require('./routes/szse/inquire'));
Expand Down
34 changes: 34 additions & 0 deletions lib/routes/sse/disclosure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const got = require('@/utils/got');

module.exports = async (ctx) => {
const query = ctx.params.query || ''; // beginDate=2018-08-18&endDate=2020-09-01&productId=600696
const pageUrl = 'http://www.sse.com.cn/disclosure/listedinfo/announcement/';
const host = `http://www.sse.com.cn`;

const response = await got({
method: 'get',
url: `http://query.sse.com.cn/security/stock/queryCompanyBulletin.do?isPagination=true&keyWord=&securityType=0101%2C120100%2C020100%2C020200%2C120200&reportType2=&reportType=ALL&pageHelp.pageSize=25&pageHelp.pageCount=50&pageHelp.pageNo=1&pageHelp.beginPage=1&pageHelp.cacheSize=1&pageHelp.endPage=5&_=1598437657897&${query.replace(
/([\u4e00-\u9fa5])/g,
(str) => encodeURIComponent(str)
)}`,
headers: {
Referer: 'http://www.sse.com.cn/disclosure/listedinfo/announcement/',
},
});

const items = response.data.result.map((item) => {
const single = {
title: item.TITLE,
description: `${host}${item.URL}`,
pubDate: new Date(item.SSEDate).toUTCString(),
link: `${host}${item.URL}`,
};
return single;
});

ctx.state.data = {
title: '上海证券交易所 - 上市公司信息 - 最新公告',
link: pageUrl,
item: items,
};
};

0 comments on commit 2e2aecd

Please sign in to comment.