mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-06-13 15:10:53 +00:00
add symbol change history from nasdaq
This commit is contained in:
@@ -248,6 +248,11 @@ def economist_wordlbrief(category=''):
|
||||
from rsshub.spiders.economist.worldbrief import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/nasdaq/symbol_change')
|
||||
def nasdaq_symbol_change(category=''):
|
||||
from rsshub.spiders.nasdaq.symbol_change import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/futu/live/<string:lang>')
|
||||
def futu_live(lang=''):
|
||||
from rsshub.spiders.futu.live import ctx
|
||||
|
||||
31
rsshub/spiders/nasdaq/symbol_change.py
Normal file
31
rsshub/spiders/nasdaq/symbol_change.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import json
|
||||
import requests
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'https://api.nasdaq.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post['effective'] + ',' + post['oldSymbol'] + ' -> ' + post['newSymbol']
|
||||
item['description'] = item['title'] + '。公司:' + post['companyName']
|
||||
item['link'] = post['url']
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
url = f'https://www.nasdaq.com/market-activity/stocks/symbol-change-history'
|
||||
DEFAULT_HEADERS.update({'Referer': f'https://www.chaindd.com/column/{category}'})
|
||||
print(url)
|
||||
posts = requests.get(
|
||||
url,
|
||||
headers=DEFAULT_HEADERS,
|
||||
).text
|
||||
posts = json.loads(posts)['data']['rows']
|
||||
return {
|
||||
'title': 'Stock Symbol Change History - Nasdaq',
|
||||
'link': f'https://www.nasdaq.com/market-activity/stocks/symbol-change-history',
|
||||
'description': 'View the history of stock symbol changes on Nasdaq. Stay informed on corporate actions, mergers, and rebrandings that result in symbol updates',
|
||||
'author': 'hillerliao',
|
||||
'items': list(map(parse, posts)),
|
||||
}
|
||||
@@ -42,6 +42,18 @@
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
<!--item info start-->
|
||||
<div class="card text-left">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">Symbol Change History - Nasdaq</h4>
|
||||
<h6 class="text-muted">World Brief <a href="https://github.com/hillerliao" target="_blank" class="badge badge-secondary">by hillerliao</a></h6>
|
||||
<p class="card-text">举例:<a href="https://pyrsshub.vercel.app/nasdaq/symbol_change" target="_blank">https://pyrsshub.vercel.app/nasdaq/symbol_change</a></p>
|
||||
<p class="card-text">路由:<code>/nasdaq/symbol_change</code></p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
<!--item info start-->
|
||||
<div class="card text-left">
|
||||
<div class="card-body">
|
||||
|
||||
Reference in New Issue
Block a user