├── Fama-French-choose-stock-master
├── Fama.py
├── README.md
├── getCapitalStock.py
├── getSZ50Data.py
├── getStockData.py
└── getStockFinance.py
├── README.md
├── Scrapy
├── stock_apple
│ ├── .idea
│ │ ├── misc.xml
│ │ ├── modules.xml
│ │ ├── stock_apple.iml
│ │ └── workspace.xml
│ ├── apple
│ │ ├── apple
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── __init__.cpython-36.pyc
│ │ │ │ ├── items.cpython-36.pyc
│ │ │ │ ├── pipelines.cpython-36.pyc
│ │ │ │ └── settings.cpython-36.pyc
│ │ │ ├── items.py
│ │ │ ├── middlewares.py
│ │ │ ├── pipelines.py
│ │ │ ├── settings.py
│ │ │ └── spiders
│ │ │ │ ├── __init__.py
│ │ │ │ ├── __pycache__
│ │ │ │ ├── __init__.cpython-36.pyc
│ │ │ │ ├── netease.cpython-36.pyc
│ │ │ │ └── sina.cpython-36.pyc
│ │ │ │ ├── netease.py
│ │ │ │ └── sina.py
│ │ ├── scrapy.cfg
│ │ └── sina
│ │ │ ├── scrapy.cfg
│ │ │ └── sina
│ │ │ ├── __init__.py
│ │ │ ├── items.py
│ │ │ ├── middlewares.py
│ │ │ ├── pipelines.py
│ │ │ ├── settings.py
│ │ │ └── spiders
│ │ │ └── __init__.py
│ └── sina
│ │ ├── scrapy.cfg
│ │ └── sina
│ │ ├── __init__.py
│ │ ├── items.py
│ │ ├── middlewares.py
│ │ ├── pipelines.py
│ │ ├── settings.py
│ │ └── spiders
│ │ └── __init__.py
├── stock_bulletin
│ ├── .idea
│ │ ├── misc.xml
│ │ ├── modules.xml
│ │ ├── stock_bulletin.iml
│ │ └── workspace.xml
│ └── bulletin
│ │ ├── bulletin
│ │ ├── __init__.py
│ │ ├── __pycache__
│ │ │ ├── __init__.cpython-36.pyc
│ │ │ ├── getcode.cpython-36.pyc
│ │ │ ├── items.cpython-36.pyc
│ │ │ ├── pipelines.cpython-36.pyc
│ │ │ └── settings.cpython-36.pyc
│ │ ├── getcode.py
│ │ ├── items.py
│ │ ├── middlewares.py
│ │ ├── pipelines.py
│ │ ├── settings.py
│ │ ├── spiders
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── __init__.cpython-36.pyc
│ │ │ │ └── sina.cpython-36.pyc
│ │ │ └── sina.py
│ │ └── stock_code.txt
│ │ └── scrapy.cfg
└── stockappl
│ ├── .idea
│ ├── misc.xml
│ ├── modules.xml
│ ├── stockappl.iml
│ └── workspace.xml
│ ├── scrapy.cfg
│ └── stockappl
│ ├── __init__.py
│ ├── __pycache__
│ ├── __init__.cpython-36.pyc
│ ├── getcode.cpython-36.pyc
│ ├── items.cpython-36.pyc
│ ├── pipelines.cpython-36.pyc
│ └── settings.cpython-36.pyc
│ ├── getcode.py
│ ├── items.py
│ ├── middlewares.py
│ ├── pipelines.py
│ ├── settings.py
│ ├── spiders
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-36.pyc
│ │ ├── netease.cpython-36.pyc
│ │ └── sina.cpython-36.pyc
│ ├── netease.py
│ └── sina.py
│ └── stock_code.txt
├── news-emotion-master
├── .idea
│ ├── dictionaries
│ │ └── AsuraDong.xml
│ ├── misc.xml
│ ├── modules.xml
│ ├── news_emotion.iml
│ ├── vcs.xml
│ └── workspace.xml
├── README.md
├── __init__.py
├── __pycache__
│ ├── ml_model.cpython-36.pyc
│ ├── news.cpython-36.pyc
│ ├── operate_data.cpython-36.pyc
│ └── supplier_news.cpython-36.pyc
├── clean_data
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-36.pyc
│ │ ├── clean_html.cpython-36.pyc
│ │ ├── langconv.cpython-36.pyc
│ │ └── zh_wiki.cpython-36.pyc
│ ├── clean_html.py
│ ├── langconv.py
│ └── zh_wiki.py
├── data
│ ├── emdict
│ │ ├── collect_dict.py
│ │ ├── material
│ │ │ ├── NTUSD_simplified
│ │ │ │ ├── NTUSD_negative_simplified.txt
│ │ │ │ ├── NTUSD_positive_simplified.txt
│ │ │ │ ├── neg.txt
│ │ │ │ └── pos.txt
│ │ │ ├── __pycache__
│ │ │ │ └── emotion_word.cpython-36.pyc
│ │ │ ├── emotion_word.py
│ │ │ ├── stopword.txt
│ │ │ └── 台湾大学NTUSD - 简体中文情感极性词典.rar
│ │ ├── negword.plk
│ │ ├── posword.plk
│ │ ├── stopword
│ │ ├── stopword.plk
│ │ └── userdict
│ └── trainset
│ │ ├── README.md
│ │ ├── neg_2406_04_29.txt
│ │ ├── neg_2592_05_04.txt
│ │ ├── neg_2593_05_04.txt
│ │ ├── neg_2612_05_05.txt
│ │ ├── neg_2617_05_05.txt
│ │ ├── neg_2621_05_05.txt
│ │ ├── neg_2625_05_05.txt
│ │ ├── neg_2635_05_05.txt
│ │ ├── neg_2641_05_05.txt
│ │ ├── neg_2667_05_05.txt
│ │ ├── neu_589528.txt
│ │ ├── neu_589538.txt
│ │ ├── neu_591877.txt
│ │ ├── neu_591904.txt
│ │ ├── neu_591908.txt
│ │ ├── neu_591920.txt
│ │ ├── neu_591925.txt
│ │ ├── neu_591936.txt
│ │ ├── neu_591954.txt
│ │ ├── neu_591962.txt
│ │ ├── pos_594613.txt
│ │ ├── pos_594817.txt
│ │ ├── pos_595052.txt
│ │ ├── pos_595121.txt
│ │ ├── pos_595219.txt
│ │ ├── pos_595249.txt
│ │ ├── pos_595252.txt
│ │ ├── pos_595330.txt
│ │ ├── pos_595408.txt
│ │ └── pos_595491.txt
├── demo.py
├── loocv_model.py
├── ml_model.py
├── model
│ └── wordfreq_logistic.ml
├── news.py
├── operate_data.py
├── other
│ ├── get_data
│ │ └── GetData.py
│ ├── more_process.py
│ ├── paper
│ │ ├── A Study of Synthetic Oversampling for Twitter Imbalanced Sentiment Analysis.pdf
│ │ ├── generate_sample.py
│ │ ├── run.py
│ │ └── testresult.png
│ └── twotag.py
├── result
│ ├── log
│ │ ├── 3plus3arr.plk
│ │ ├── best_model
│ │ │ ├── PR.json
│ │ │ └── error_tag.json
│ │ ├── logfile.plk
│ │ └── ml_rate.plk
│ ├── show
│ │ ├── result.csv
│ │ └── result.xlsx
│ └── vector
│ │ ├── resultX.npz
│ │ └── resultY.npz
├── run_best.py
└── supplier_news.py
└── 数据报告.docx
/Fama-French-choose-stock-master/README.md:
--------------------------------------------------------------------------------
1 | # Fama-French-choose-stock
2 | 基于Python环境下设计的
3 | 样本数据采集自网易财经
4 | Fama.py是主要计算脚本
5 | 其他皆为获取数据的脚本
6 | 分别是获取股票股本,股票收盘价,股票净资产
7 | 需要搭建数据库,数据表的设计可以参考代码中字段
8 | 语言:python3.6
9 | 需要安装的库:numpy,pandas,stats models,sql等(可在代码中查看)
10 | 代码中有注释,可自行研究或做参考。
11 |
--------------------------------------------------------------------------------
/Fama-French-choose-stock-master/getCapitalStock.py:
--------------------------------------------------------------------------------
1 | # coding:utf-8
2 | import requests
3 | from bs4 import BeautifulSoup
4 | import time
5 | import pandas as pd
6 | import pymysql.cursors
7 | #功能:获取指定股票日期的每日收盘价
8 | headers = {
9 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.1708.400 QQBrowser/9.5.9635.400'
10 | }
11 |
12 | #爬取财务数据
13 | def spiderStockFinance(stockCode):
14 |
15 | url = 'http://quotes.money.163.com/f10/gdfx_'+stockCode+'.html#01d01'
16 | #print(url)
17 |
18 | data = requests.get(url, headers=headers)
19 | soup = BeautifulSoup(data.text, 'lxml')
20 |
21 | table = soup.findAll('table', {'class': 'table_bg001 border_box'})[0]
22 | rows = table.findAll('tr')
23 | #rowsData=[]
24 |
25 | #rowsData = rowsData[rows[0:1],rows[9:10],rows[17:18]]
26 | #print(rows[0:1])
27 | #print(rowsData)#净利润和净资产
28 | #返回某股票的财务报表
29 |
30 | return rows[1:2]
31 |
32 | def Format(rows,stockCode):
33 | #print(rows[0:1])
34 | for row in rows:
35 | csvRow = []
36 | for cell in row.findAll('td'):
37 | csvRow.append(cell.get_text().replace(',', ''))
38 | #print(csvRow[1])
39 | #print(csvRow3)
40 | toMysql(csvRow,stockCode)
41 |
42 |
43 | def toMysql(rows,stockCode):
44 | #获取数据库的链接
45 | stockCodeStr = str(stockCode)
46 | #print(stockCode)
47 | conn = pymysql.connect(host='localhost',
48 | port=3306,
49 | user = 'root',
50 | password = '1378215200zad',
51 | db = 'testdata',
52 | charset = 'utf8mb4')
53 | #print('conn ok')
54 | try:
55 | #获取会话指针
56 | with conn.cursor() as cursor:
57 | #创建sql语句
58 | sql = "insert into `capitalstock`(`code`,`capitalstock`) values(%s,%s)"
59 |
60 | #执行sql语句
61 |
62 | cursor.execute(sql,(stockCodeStr,rows[1]))
63 | #提交
64 | conn.commit()
65 | print(stockCodeStr+' commit ok')
66 | finally:
67 | conn.close()
68 |
69 | def main():
70 | #上证50成分股列表
71 | stocklist = ['600000', '600010', '600015', '600016', '600019',
72 | '600028', '600030', '600031', '600036', '600048',
73 | '600050', '600104', '600111', '600123', '600256',
74 | '600348', '600362', '600383', '600489', '600518',
75 | '600519', '600547', '600549', '600585', '600837',
76 | '600887', '600999', '601006', '601088', '601166',
77 | '601169', '601288', '601299', '601318', '601328',
78 | '601336', '601398', '601601', '601628', '601668',
79 | '601669', '601688', '601699', '601766', '601788',
80 | '601818', '601857', '601899', '601901', '601989']
81 | for i in range(0,50):
82 | #print(i)
83 | rows =spiderStockFinance(stocklist[i])
84 | Format(rows,stocklist[i])
85 |
86 | if __name__ == '__main__':
87 | main()
88 |
--------------------------------------------------------------------------------
/Fama-French-choose-stock-master/getSZ50Data.py:
--------------------------------------------------------------------------------
1 | # coding:utf-8
2 | import requests
3 | from bs4 import BeautifulSoup
4 | import time
5 | import pandas as pd
6 | import pymysql.cursors
7 | #功能:获取市场在2013-2016的收盘价
8 | #报文头部
9 | headers = {
10 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.1708.400 QQBrowser/9.5.9635.400'
11 | }
12 |
13 |
14 | #爬取数据
15 | def spider(year,season):
16 | #字符化处理
17 | yearStr = str(year)
18 | seasonStr = str(season)
19 | url = 'http://quotes.money.163.com/trade/lsjysj_zhishu_000016.html?year=' + yearStr + '&season=' + seasonStr
20 | #print(url)
21 |
22 | data = requests.get(url, headers=headers)
23 | soup = BeautifulSoup(data.text, 'lxml')
24 |
25 | table = soup.findAll('table', {'class': 'table_bg001 border_box limit_sale'})[0]
26 | rows = table.findAll('tr')
27 | # print(rows[:0:-1])
28 | #返回一个季度的交易数据
29 | return rows[:0:-1]
30 |
31 | #------------将获取的html提取并格式化
32 | def Format(rows):
33 | #print(stockCode)
34 | for row in rows:
35 | csvRow = []
36 | for cell in row.findAll('td'):
37 | csvRow.append(cell.get_text().replace(',', ''))
38 |
39 | # print(csvRow[1])
40 | toMysql(csvRow)
41 |
42 | #------------------------将获得的指数数据存放到数据库
43 | def toMysql(rows):
44 |
45 | # 数据库的链接
46 | conn = pymysql.connect(host='localhost',
47 | port=3306,
48 | user='root',
49 | password='',
50 | db='testdata',
51 | charset='utf8mb4')
52 |
53 | try:
54 | #获取会话指针
55 | with conn.cursor() as cursor:
56 | #创建sql语句
57 | sql = "insert into `sz50data`(`date`,`close`) values(%s,%s)"
58 |
59 | #执行sql语句
60 | cursor.execute(sql,(rows[0],rows[4]))
61 | #提交
62 | conn.commit()
63 | #print('sql commit ok')
64 | finally:
65 | conn.close()
66 |
67 | #获取指定股票指定日期的每日行情
68 | def getSZ50Data(beginYear, endYear):
69 | for year in range(beginYear, endYear+1):
70 | for season in range(1,5):
71 | rows = spider(year, season)
72 | if(rows != []):
73 | Format(rows)
74 |
75 | print('上证50-',year,'-',season,'done')
76 | print('ok')
77 |
78 | def main():
79 |
80 | #获取上证50指数数据
81 | getSZ50Data(2013,2017)
82 |
83 |
84 |
85 | # ps:删除数据库某个表的所有数据并将ID置1 TURNCATE TABLE 表名
86 | if __name__ == '__main__':
87 | main()
88 |
--------------------------------------------------------------------------------
/Fama-French-choose-stock-master/getStockData.py:
--------------------------------------------------------------------------------
1 | # coding:utf-8
2 | import requests
3 | from bs4 import BeautifulSoup
4 | import time
5 | import pandas as pd
6 | import pymysql.cursors
7 | #功能:获取指定股票日期的每日收盘价
8 | #报文头部
9 | headers = {
10 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.1708.400 QQBrowser/9.5.9635.400'
11 | }
12 |
13 |
14 | #爬取数据
15 | def spider(stockCode,year,season):
16 | #字符化处理
17 | stockCodeStr = str(stockCode)
18 | yearStr = str(year)
19 | seasonStr = str(season)
20 | url = 'http://quotes.money.163.com/trade/lsjysj_' + stockCodeStr + '.html?year=' + yearStr + '&season=' + seasonStr
21 | #print(url)
22 |
23 | data = requests.get(url, headers=headers)
24 | soup = BeautifulSoup(data.text, 'lxml')
25 |
26 | table = soup.findAll('table', {'class': 'table_bg001'})[0]
27 | rows = table.findAll('tr')
28 | # print(rows[:0:-1])
29 | #返回一个季度的交易数据
30 | return rows[:0:-1]
31 |
32 | #------------将获取的html提取并格式化
33 | def Format(rows,stockCode,assets):
34 | #print(stockCode)
35 | for row in rows:
36 | csvRow = []
37 | for cell in row.findAll('td'):
38 | csvRow.append(cell.get_text().replace(',', ''))
39 |
40 | #print(csvRow[1])
41 | toMysql(csvRow,stockCode,assets)
42 |
43 | #---------------从数据库获取指定股票的股本数据
44 | def getCaptailStock(stockCode):
45 | # 数据库的链接
46 | conn = pymysql.connect(host='localhost',
47 | port=3306,
48 | user='root',
49 | password='1378215200zad',
50 | db='testdata',
51 | charset='utf8mb4')
52 | try:
53 | # 获取会话指针
54 | with conn.cursor() as cursor:
55 | # 创建sql语句
56 | sql = "SELECT `id`, `code`, `capitalstock` FROM `capitalstock` WHERE `code`= %s"
57 |
58 | # 执行sql语句
59 | cursor.execute(sql, (stockCode))
60 | result = cursor.fetchall()
61 | return result[0][2]
62 | # 提交
63 | conn.commit()
64 | finally:
65 | conn.close()
66 |
67 | #获得财务报表的净资产
68 | def getAssets(stockCode,year,season):
69 | # 数据库的链接
70 | conn = pymysql.connect(host='localhost',
71 | port=3306,
72 | user='root',
73 | password='1378215200zad',
74 | db='testdata',
75 | charset='utf8mb4')
76 | year = str(year)
77 | if (season == 1):
78 | date = year + '-03-31'
79 | if (season == 2):
80 | date = year + '-06-30'
81 | if (season == 3):
82 | date = year + '-09-30'
83 | if (season == 4):
84 | date = year + '-12-31'
85 | #print(date)
86 | #print(stockCode)
87 | try:
88 | # 获取会话指针
89 | with conn.cursor() as cursor:
90 | # 创建sql语句
91 | sql = "SELECT `id`, `code`, `date`, `assets` FROM `finance` WHERE `code` = %s AND `date`= %s"
92 |
93 | # 执行sql语句
94 | cursor.execute(sql, (stockCode,date))
95 | result = cursor.fetchall()
96 | #print(result)
97 | return result[0][3]
98 | # 提交
99 | conn.commit()
100 | finally:
101 | conn.close()
102 | #------------------------将获得的股票数据存放到数据库
103 | def toMysql(rows,stockCode,assets):
104 |
105 | # 数据库的链接
106 | conn = pymysql.connect(host='localhost',
107 | port=3306,
108 | user='root',
109 | password='',
110 | db='testdata',
111 | charset='utf8mb4')
112 |
113 | captailStock = getCaptailStock(stockCode)
114 | captailStock = float(captailStock)
115 | rows[4] = float(rows[4])
116 | marketcap = rows[4]*captailStock
117 | bm = marketcap/assets
118 | try:
119 | #获取会话指针
120 | with conn.cursor() as cursor:
121 | #创建sql语句
122 | sql = "insert into `stockdata`(`code`,`date`,`close`,`marketcap`,`bm`) values(%s,%s,%s,%s,%s)"
123 |
124 | #执行sql语句
125 | cursor.execute(sql,(stockCode,rows[0],rows[4],marketcap,bm))
126 | #提交
127 | conn.commit()
128 | #print('sql commit ok')
129 | finally:
130 | conn.close()
131 |
132 | #获取指定股票指定日期的每日行情
133 | def getStockData(stockCode, beginYear, endYear):
134 | for year in range(beginYear, endYear+1):
135 | for season in range(1,5):
136 | rows = spider(stockCode, year, season)
137 | assets = getAssets(stockCode,year,season)
138 | if(rows != []):
139 | Format(rows,stockCode,assets)
140 |
141 | print(stockCode,'-',year,'-',season,'done')
142 | print('ok')
143 |
144 | def main():
145 | #上证50成分股列表
146 | stocklist = ['600000', '600010', '600015', '600016', '600019',
147 | '600028', '600030', '600031', '600036', '600048',
148 | '600050', '600104', '600111', '600123', '600256',
149 | '600348', '600362', '600383', '600489', '600518',
150 | '600519', '600547', '600549', '600585', '600837',
151 | '600887', '600999', '601006', '601088', '601166',
152 | '601169', '601288', '601318', '601328',
153 | '601336', '601398', '601601', '601628', '601668',
154 | '601669', '601688', '601699', '601766', '601788',
155 | '601818', '601857', '601899', '601901', '601989']
156 | #获取列表中所有股票的数据
157 | for i in range(0,49):
158 | getStockData(stocklist[i],2013,2016)
159 |
160 |
161 |
162 | # ps:删除数据库某个表的所有数据并将ID置1 TURNCATE TABLE 表名
163 | if __name__ == '__main__':
164 | main()
165 |
--------------------------------------------------------------------------------
/Fama-French-choose-stock-master/getStockFinance.py:
--------------------------------------------------------------------------------
1 | # coding:utf-8
2 | import requests
3 | from bs4 import BeautifulSoup
4 | import time
5 | import pandas as pd
6 | import pymysql.cursors
7 | #功能:获取指定股票日期的每日收盘价
8 | headers = {
9 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.1708.400 QQBrowser/9.5.9635.400'
10 | }
11 |
12 | #爬取财务数据
13 | def spiderStockFinance(stockCode):
14 |
15 | url = 'http://quotes.money.163.com/f10/zycwzb_'+stockCode+'.html#01c02'
16 | #print(url)
17 |
18 | data = requests.get(url, headers=headers)
19 | soup = BeautifulSoup(data.text, 'lxml')
20 |
21 | table = soup.findAll('table', {'class': 'table_bg001 border_box limit_sale scr_table'})[0]
22 | rows = table.findAll('tr')
23 | #rowsData=[]
24 |
25 | #rowsData = rowsData[rows[0:1],rows[9:10],rows[17:18]]
26 | #print(rows[0:1])
27 | #print(rowsData)#净利润和净资产
28 | #返回某股票的财务报表
29 |
30 | return rows[0:]
31 |
32 | def Format(rows,stockCode):
33 |
34 | for row in rows[0:1]:
35 | csvRow1 = []
36 | for cell in row.findAll('th'):
37 | csvRow1.append(cell.get_text().replace(',', ''))
38 | for row in rows[18:19]:
39 | csvRow2 = []
40 | for cell in row.findAll('td'):
41 | csvRow2.append(cell.get_text().replace(',', ''))
42 | #print(csvRow2)
43 | #print(csvRow3)
44 | toMysql(csvRow1[1:17],csvRow2[1:17],stockCode)
45 |
46 |
47 | def toMysql(rows1,rows2,stockCode):
48 | #获取数据库的链接
49 | stockCodeStr = str(stockCode)
50 | #print(stockCode)
51 | conn = pymysql.connect(host='localhost',
52 | port=3306,
53 | user = 'root',
54 | password = '1378215200zad',
55 | db = 'testdata',
56 | charset = 'utf8mb4')
57 | #print('conn ok')
58 | try:
59 | #获取会话指针
60 | with conn.cursor() as cursor:
61 | #创建sql语句
62 | sql = "insert into `finance`(`code`,`date`,`assets`) values(%s,%s,%s)"
63 |
64 | #执行sql语句
65 | for i in range(0,len(rows1)):
66 | cursor.execute(sql,(stockCodeStr,rows1[i],rows2[i]))
67 | #提交
68 | conn.commit()
69 | print(stockCodeStr+' commit ok')
70 | finally:
71 | conn.close()
72 |
73 | def main():
74 | #上证50成分股列表
75 | stocklist = ['600000', '600010', '600015', '600016', '600019',
76 | '600028', '600030', '600031', '600036', '600048',
77 | '600050', '600104', '600111', '600123', '600256',
78 | '600348', '600362', '600383', '600489', '600518',
79 | '600519', '600547', '600549', '600585', '600837',
80 | '600887', '600999', '601006', '601088', '601166',
81 | '601169', '601288', '601318', '601328',
82 | '601336', '601398', '601601', '601628', '601668',
83 | '601669', '601688', '601699', '601766', '601788',
84 | '601818', '601857', '601899', '601901', '601989']
85 | for i in range(0,49):
86 | #print(i)
87 | rows =spiderStockFinance(stocklist[i])
88 | Format(rows,stocklist[i])
89 |
90 | if __name__ == '__main__':
91 | main()
92 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Financial_Analysis
2 | - 基于分布式爬虫,采集互联网公开来源的金融类新闻和文档类文本;
3 | - 基于文本挖掘技术,进行无监督/半监督学习的数据ETL与特征工程;
4 | - 基于金融数据挖掘技术,进行宏观经济分析,基本面分析与行业分析
5 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/.idea/stock_apple.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/__init__.py
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/__pycache__/items.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/__pycache__/items.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/__pycache__/pipelines.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/__pycache__/pipelines.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/__pycache__/settings.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/__pycache__/settings.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/items.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your scraped items
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/items.html
7 |
8 | import scrapy
9 | from scrapy import Item, Field
10 |
11 |
12 |
13 | class AppleItem(scrapy.Item):
14 | # define the fields for your item here like:
15 | # name = scrapy.Field()
16 | title = Field()
17 | news = Field()
18 | datetime = Field()
19 | pass
20 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/middlewares.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your spider middleware
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/spider-middleware.html
7 |
8 | from scrapy import signals
9 |
10 |
11 | class AppleSpiderMiddleware(object):
12 | # Not all methods need to be defined. If a method is not defined,
13 | # scrapy acts as if the spider middleware does not modify the
14 | # passed objects.
15 |
16 | @classmethod
17 | def from_crawler(cls, crawler):
18 | # This method is used by Scrapy to create your spiders.
19 | s = cls()
20 | crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
21 | return s
22 |
23 | def process_spider_input(self, response, spider):
24 | # Called for each response that goes through the spider
25 | # middleware and into the spider.
26 |
27 | # Should return None or raise an exception.
28 | return None
29 |
30 | def process_spider_output(self, response, result, spider):
31 | # Called with the results returned from the Spider, after
32 | # it has processed the response.
33 |
34 | # Must return an iterable of Request, dict or Item objects.
35 | for i in result:
36 | yield i
37 |
38 | def process_spider_exception(self, response, exception, spider):
39 | # Called when a spider or process_spider_input() method
40 | # (from other spider middleware) raises an exception.
41 |
42 | # Should return either None or an iterable of Response, dict
43 | # or Item objects.
44 | pass
45 |
46 | def process_start_requests(self, start_requests, spider):
47 | # Called with the start requests of the spider, and works
48 | # similarly to the process_spider_output() method, except
49 | # that it doesn’t have a response associated.
50 |
51 | # Must return only requests (not items).
52 | for r in start_requests:
53 | yield r
54 |
55 | def spider_opened(self, spider):
56 | spider.logger.info('Spider opened: %s' % spider.name)
57 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/pipelines.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define your item pipelines here
4 | #
5 | # Don't forget to add your pipeline to the ITEM_PIPELINES setting
6 | # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
7 | import pymongo
8 |
9 | class ApplePipeline(object):
10 | collection_name = 'news'
11 |
12 | def __init__(self, mongo_uri, mongo_db):
13 | self.mongo_uri = mongo_uri
14 | self.mongo_db = mongo_db
15 |
16 | @classmethod
17 | def from_crawler(cls, crawler):
18 | return cls(
19 | mongo_uri=crawler.settings.get('MONGO_URI'),
20 | mongo_db=crawler.settings.get('MONGO_DATABASE', 'items')
21 | )
22 |
23 | def open_spider(self, spider):
24 | self.client = pymongo.MongoClient(self.mongo_uri)
25 | self.db = self.client[self.mongo_db]
26 |
27 | def close_spider(self, spider):
28 | self.client.close()
29 |
30 | def process_item(self, item, spider):
31 | # collection_name = item.__class__.__name__
32 | # self.db[collection_name].insert(dict(item))
33 | self.db[self.collection_name].update({'title': item['title']}, {'$set': dict(item)}, True)
34 | return item
35 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/settings.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Scrapy settings for apple project
4 | #
5 | # For simplicity, this file contains only settings considered important or
6 | # commonly used. You can find more settings consulting the documentation:
7 | #
8 | # http://doc.scrapy.org/en/latest/topics/settings.html
9 | # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
10 | # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
11 |
12 | BOT_NAME = 'apple'
13 |
14 | SPIDER_MODULES = ['apple.spiders']
15 | NEWSPIDER_MODULE = 'apple.spiders'
16 |
17 |
18 | # Crawl responsibly by identifying yourself (and your website) on the user-agent
19 | #USER_AGENT = 'apple (+http://www.yourdomain.com)'
20 |
21 | # Obey robots.txt rules
22 | ROBOTSTXT_OBEY = False
23 |
24 | # Configure maximum concurrent requests performed by Scrapy (default: 16)
25 | #CONCURRENT_REQUESTS = 32
26 |
27 | # Configure a delay for requests for the same website (default: 0)
28 | # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
29 | # See also autothrottle settings and docs
30 | #DOWNLOAD_DELAY = 3
31 | # The download delay setting will honor only one of:
32 | #CONCURRENT_REQUESTS_PER_DOMAIN = 16
33 | #CONCURRENT_REQUESTS_PER_IP = 16
34 |
35 | # Disable cookies (enabled by default)
36 | #COOKIES_ENABLED = False
37 |
38 | # Disable Telnet Console (enabled by default)
39 | #TELNETCONSOLE_ENABLED = False
40 |
41 | # Override the default request headers:
42 | DEFAULT_REQUEST_HEADERS = {
43 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
44 | 'Accept-Language': 'en',
45 | 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6',
46 | }
47 |
48 | # Enable or disable spider middlewares
49 | # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
50 | #SPIDER_MIDDLEWARES = {
51 | # 'apple.middlewares.AppleSpiderMiddleware': 543,
52 | #}
53 |
54 | # Enable or disable downloader middlewares
55 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
56 | #DOWNLOADER_MIDDLEWARES = {
57 | # 'apple.middlewares.MyCustomDownloaderMiddleware': 543,
58 | #}
59 |
60 | # Enable or disable extensions
61 | # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
62 | #EXTENSIONS = {
63 | # 'scrapy.extensions.telnet.TelnetConsole': None,
64 | #}
65 |
66 | # Configure item pipelines
67 | # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
68 | ITEM_PIPELINES = {
69 | 'apple.pipelines.ApplePipeline': 300,
70 | }
71 |
72 | # Enable and configure the AutoThrottle extension (disabled by default)
73 | # See http://doc.scrapy.org/en/latest/topics/autothrottle.html
74 | #AUTOTHROTTLE_ENABLED = True
75 | # The initial download delay
76 | #AUTOTHROTTLE_START_DELAY = 5
77 | # The maximum download delay to be set in case of high latencies
78 | #AUTOTHROTTLE_MAX_DELAY = 60
79 | # The average number of requests Scrapy should be sending in parallel to
80 | # each remote server
81 | #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
82 | # Enable showing throttling stats for every response received:
83 | #AUTOTHROTTLE_DEBUG = False
84 |
85 | # Enable and configure HTTP caching (disabled by default)
86 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
87 | #HTTPCACHE_ENABLED = True
88 | #HTTPCACHE_EXPIRATION_SECS = 0
89 | #HTTPCACHE_DIR = 'httpcache'
90 | #HTTPCACHE_IGNORE_HTTP_CODES = []
91 | #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
92 |
93 | MONGO_URI = 'localhost'
94 | MONGO_DATABASE = 'apple'
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/spiders/__init__.py:
--------------------------------------------------------------------------------
1 | # This package will contain the spiders of your Scrapy project
2 | #
3 | # Please refer to the documentation for information on how to create and manage
4 | # your spiders.
5 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/spiders/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/spiders/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/spiders/__pycache__/netease.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/spiders/__pycache__/netease.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/spiders/__pycache__/sina.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/apple/spiders/__pycache__/sina.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/spiders/netease.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import scrapy
3 | from scrapy import Spider, Request
4 | from apple.items import AppleItem
5 |
6 |
7 |
8 | class NeteaseSpider(scrapy.Spider):
9 | name = 'netease'
10 | allowed_domains = ['money.163.com']
11 | start_url = 'http://quotes.money.163.com/usstock/AAPL_news.html?page={index}'
12 |
13 |
14 | def start_requests(self):
15 | for stock_index in range(0, 711):
16 | yield Request(url=self.start_url.format(index=stock_index), callback=self.parse_stock, dont_filter=True)
17 |
18 |
19 |
20 | def parse_stock(self, response):
21 | title = response.xpath('//dt/a/text()').extract()
22 | url = response.xpath('//dt/a/@href').extract()
23 | date = response.xpath('//div[@class="time icon_news_pills_time"]/span/text()').extract()
24 | # print(title)
25 | # print(url)
26 | # print(date)
27 | for x, y, z in zip(title, url, date):
28 | # print(x)
29 | # print(y)
30 | yield Request(y, callback=lambda response, TITLE=x, DATE=z: self.getApple(response, TITLE, DATE), dont_filter=True)
31 |
32 | pass
33 |
34 |
35 | def getApple(self, response, TITLE, DATE):
36 | news = response.xpath('//div[@class="post_text"]/p/text()').extract()
37 | str = "".join(news)
38 | # print(str)
39 | # print(DATE)
40 |
41 | item = AppleItem()
42 | item['title'] = TITLE
43 | item['news'] = str
44 | item['datetime'] = DATE
45 | yield item
46 |
47 | pass
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/apple/spiders/sina.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import scrapy
3 | from scrapy import Spider, Request
4 | from apple.items import AppleItem
5 | import re
6 |
7 |
8 |
9 | class SinaSpider(scrapy.Spider):
10 | name = 'sina'
11 | allowed_domains = ['finance.sina.com.cn']
12 | start_url = 'http://biz.finance.sina.com.cn/usstock/usstock_news.php?pageIndex={index}&symbol=AAPL&type=1'
13 |
14 |
15 | def start_requests(self):
16 | for stock_index in range(1, 100):
17 | yield Request(url=self.start_url.format(index=stock_index), callback=self.parse_stock, dont_filter=True)
18 |
19 |
20 |
21 | def parse_stock(self, response):
22 | title = response.xpath('//a[@type-stastics="cj"]/text()').extract()
23 | url = response.xpath('//a[@type-stastics="cj"]/@href').extract()
24 | date = response.xpath('//span[@class="xb_list_r"]/text()').extract()
25 | date = date[9:17]
26 | print("0000000000000000000000000000000000000")
27 | print(date)
28 | print(title)
29 | # print(url)
30 | for x, y, z in zip(title, url, date):
31 | # print(x)
32 | # print(y)
33 | yield Request(y, callback=lambda response, TITLE=x, DATE=z: self.getApple(response, TITLE, DATE), dont_filter=True)
34 |
35 | pass
36 |
37 | def getApple(self, response, TITLE, DATE):
38 | # t = response.xpath('//h1[@class="main-title"]/text()').extract()
39 | # print(TITLE)
40 | news = response.xpath('//p/text()').extract()
41 | str = "".join(news)
42 | # print(str)
43 | # print(TITLE)
44 | # print(DATE)
45 |
46 | item = AppleItem()
47 | item['title'] = TITLE
48 | item['news'] = str
49 | item['datetime'] = DATE
50 | yield item
51 |
52 | pass
53 |
54 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/scrapy.cfg:
--------------------------------------------------------------------------------
1 | # Automatically created by: scrapy startproject
2 | #
3 | # For more information about the [deploy] section see:
4 | # https://scrapyd.readthedocs.org/en/latest/deploy.html
5 |
6 | [settings]
7 | default = apple.settings
8 |
9 | [deploy]
10 | #url = http://localhost:6800/
11 | project = apple
12 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/sina/scrapy.cfg:
--------------------------------------------------------------------------------
1 | # Automatically created by: scrapy startproject
2 | #
3 | # For more information about the [deploy] section see:
4 | # https://scrapyd.readthedocs.org/en/latest/deploy.html
5 |
6 | [settings]
7 | default = sina.settings
8 |
9 | [deploy]
10 | #url = http://localhost:6800/
11 | project = sina
12 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/sina/sina/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/apple/sina/sina/__init__.py
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/sina/sina/items.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your scraped items
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/items.html
7 |
8 | import scrapy
9 |
10 |
11 | class SinaItem(scrapy.Item):
12 | # define the fields for your item here like:
13 | # name = scrapy.Field()
14 | pass
15 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/sina/sina/middlewares.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your spider middleware
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/spider-middleware.html
7 |
8 | from scrapy import signals
9 |
10 |
11 | class SinaSpiderMiddleware(object):
12 | # Not all methods need to be defined. If a method is not defined,
13 | # scrapy acts as if the spider middleware does not modify the
14 | # passed objects.
15 |
16 | @classmethod
17 | def from_crawler(cls, crawler):
18 | # This method is used by Scrapy to create your spiders.
19 | s = cls()
20 | crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
21 | return s
22 |
23 | def process_spider_input(self, response, spider):
24 | # Called for each response that goes through the spider
25 | # middleware and into the spider.
26 |
27 | # Should return None or raise an exception.
28 | return None
29 |
30 | def process_spider_output(self, response, result, spider):
31 | # Called with the results returned from the Spider, after
32 | # it has processed the response.
33 |
34 | # Must return an iterable of Request, dict or Item objects.
35 | for i in result:
36 | yield i
37 |
38 | def process_spider_exception(self, response, exception, spider):
39 | # Called when a spider or process_spider_input() method
40 | # (from other spider middleware) raises an exception.
41 |
42 | # Should return either None or an iterable of Response, dict
43 | # or Item objects.
44 | pass
45 |
46 | def process_start_requests(self, start_requests, spider):
47 | # Called with the start requests of the spider, and works
48 | # similarly to the process_spider_output() method, except
49 | # that it doesn’t have a response associated.
50 |
51 | # Must return only requests (not items).
52 | for r in start_requests:
53 | yield r
54 |
55 | def spider_opened(self, spider):
56 | spider.logger.info('Spider opened: %s' % spider.name)
57 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/sina/sina/pipelines.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define your item pipelines here
4 | #
5 | # Don't forget to add your pipeline to the ITEM_PIPELINES setting
6 | # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
7 |
8 |
9 | class SinaPipeline(object):
10 | def process_item(self, item, spider):
11 | return item
12 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/sina/sina/settings.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Scrapy settings for sina project
4 | #
5 | # For simplicity, this file contains only settings considered important or
6 | # commonly used. You can find more settings consulting the documentation:
7 | #
8 | # http://doc.scrapy.org/en/latest/topics/settings.html
9 | # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
10 | # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
11 |
12 | BOT_NAME = 'sina'
13 |
14 | SPIDER_MODULES = ['sina.spiders']
15 | NEWSPIDER_MODULE = 'sina.spiders'
16 |
17 |
18 | # Crawl responsibly by identifying yourself (and your website) on the user-agent
19 | #USER_AGENT = 'sina (+http://www.yourdomain.com)'
20 |
21 | # Obey robots.txt rules
22 | ROBOTSTXT_OBEY = True
23 |
24 | # Configure maximum concurrent requests performed by Scrapy (default: 16)
25 | #CONCURRENT_REQUESTS = 32
26 |
27 | # Configure a delay for requests for the same website (default: 0)
28 | # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
29 | # See also autothrottle settings and docs
30 | #DOWNLOAD_DELAY = 3
31 | # The download delay setting will honor only one of:
32 | #CONCURRENT_REQUESTS_PER_DOMAIN = 16
33 | #CONCURRENT_REQUESTS_PER_IP = 16
34 |
35 | # Disable cookies (enabled by default)
36 | #COOKIES_ENABLED = False
37 |
38 | # Disable Telnet Console (enabled by default)
39 | #TELNETCONSOLE_ENABLED = False
40 |
41 | # Override the default request headers:
42 | #DEFAULT_REQUEST_HEADERS = {
43 | # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
44 | # 'Accept-Language': 'en',
45 | #}
46 |
47 | # Enable or disable spider middlewares
48 | # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
49 | #SPIDER_MIDDLEWARES = {
50 | # 'sina.middlewares.SinaSpiderMiddleware': 543,
51 | #}
52 |
53 | # Enable or disable downloader middlewares
54 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
55 | #DOWNLOADER_MIDDLEWARES = {
56 | # 'sina.middlewares.MyCustomDownloaderMiddleware': 543,
57 | #}
58 |
59 | # Enable or disable extensions
60 | # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
61 | #EXTENSIONS = {
62 | # 'scrapy.extensions.telnet.TelnetConsole': None,
63 | #}
64 |
65 | # Configure item pipelines
66 | # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
67 | #ITEM_PIPELINES = {
68 | # 'sina.pipelines.SinaPipeline': 300,
69 | #}
70 |
71 | # Enable and configure the AutoThrottle extension (disabled by default)
72 | # See http://doc.scrapy.org/en/latest/topics/autothrottle.html
73 | #AUTOTHROTTLE_ENABLED = True
74 | # The initial download delay
75 | #AUTOTHROTTLE_START_DELAY = 5
76 | # The maximum download delay to be set in case of high latencies
77 | #AUTOTHROTTLE_MAX_DELAY = 60
78 | # The average number of requests Scrapy should be sending in parallel to
79 | # each remote server
80 | #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
81 | # Enable showing throttling stats for every response received:
82 | #AUTOTHROTTLE_DEBUG = False
83 |
84 | # Enable and configure HTTP caching (disabled by default)
85 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
86 | #HTTPCACHE_ENABLED = True
87 | #HTTPCACHE_EXPIRATION_SECS = 0
88 | #HTTPCACHE_DIR = 'httpcache'
89 | #HTTPCACHE_IGNORE_HTTP_CODES = []
90 | #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
91 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/apple/sina/sina/spiders/__init__.py:
--------------------------------------------------------------------------------
1 | # This package will contain the spiders of your Scrapy project
2 | #
3 | # Please refer to the documentation for information on how to create and manage
4 | # your spiders.
5 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/sina/scrapy.cfg:
--------------------------------------------------------------------------------
1 | # Automatically created by: scrapy startproject
2 | #
3 | # For more information about the [deploy] section see:
4 | # https://scrapyd.readthedocs.org/en/latest/deploy.html
5 |
6 | [settings]
7 | default = sina.settings
8 |
9 | [deploy]
10 | #url = http://localhost:6800/
11 | project = sina
12 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/sina/sina/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_apple/sina/sina/__init__.py
--------------------------------------------------------------------------------
/Scrapy/stock_apple/sina/sina/items.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your scraped items
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/items.html
7 |
8 | import scrapy
9 |
10 |
11 | class SinaItem(scrapy.Item):
12 | # define the fields for your item here like:
13 | # name = scrapy.Field()
14 | pass
15 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/sina/sina/middlewares.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your spider middleware
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/spider-middleware.html
7 |
8 | from scrapy import signals
9 |
10 |
11 | class SinaSpiderMiddleware(object):
12 | # Not all methods need to be defined. If a method is not defined,
13 | # scrapy acts as if the spider middleware does not modify the
14 | # passed objects.
15 |
16 | @classmethod
17 | def from_crawler(cls, crawler):
18 | # This method is used by Scrapy to create your spiders.
19 | s = cls()
20 | crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
21 | return s
22 |
23 | def process_spider_input(self, response, spider):
24 | # Called for each response that goes through the spider
25 | # middleware and into the spider.
26 |
27 | # Should return None or raise an exception.
28 | return None
29 |
30 | def process_spider_output(self, response, result, spider):
31 | # Called with the results returned from the Spider, after
32 | # it has processed the response.
33 |
34 | # Must return an iterable of Request, dict or Item objects.
35 | for i in result:
36 | yield i
37 |
38 | def process_spider_exception(self, response, exception, spider):
39 | # Called when a spider or process_spider_input() method
40 | # (from other spider middleware) raises an exception.
41 |
42 | # Should return either None or an iterable of Response, dict
43 | # or Item objects.
44 | pass
45 |
46 | def process_start_requests(self, start_requests, spider):
47 | # Called with the start requests of the spider, and works
48 | # similarly to the process_spider_output() method, except
49 | # that it doesn’t have a response associated.
50 |
51 | # Must return only requests (not items).
52 | for r in start_requests:
53 | yield r
54 |
55 | def spider_opened(self, spider):
56 | spider.logger.info('Spider opened: %s' % spider.name)
57 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/sina/sina/pipelines.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define your item pipelines here
4 | #
5 | # Don't forget to add your pipeline to the ITEM_PIPELINES setting
6 | # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
7 |
8 |
9 | class SinaPipeline(object):
10 | def process_item(self, item, spider):
11 | return item
12 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/sina/sina/settings.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Scrapy settings for sina project
4 | #
5 | # For simplicity, this file contains only settings considered important or
6 | # commonly used. You can find more settings consulting the documentation:
7 | #
8 | # http://doc.scrapy.org/en/latest/topics/settings.html
9 | # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
10 | # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
11 |
12 | BOT_NAME = 'sina'
13 |
14 | SPIDER_MODULES = ['sina.spiders']
15 | NEWSPIDER_MODULE = 'sina.spiders'
16 |
17 |
18 | # Crawl responsibly by identifying yourself (and your website) on the user-agent
19 | #USER_AGENT = 'sina (+http://www.yourdomain.com)'
20 |
21 | # Obey robots.txt rules
22 | ROBOTSTXT_OBEY = True
23 |
24 | # Configure maximum concurrent requests performed by Scrapy (default: 16)
25 | #CONCURRENT_REQUESTS = 32
26 |
27 | # Configure a delay for requests for the same website (default: 0)
28 | # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
29 | # See also autothrottle settings and docs
30 | #DOWNLOAD_DELAY = 3
31 | # The download delay setting will honor only one of:
32 | #CONCURRENT_REQUESTS_PER_DOMAIN = 16
33 | #CONCURRENT_REQUESTS_PER_IP = 16
34 |
35 | # Disable cookies (enabled by default)
36 | #COOKIES_ENABLED = False
37 |
38 | # Disable Telnet Console (enabled by default)
39 | #TELNETCONSOLE_ENABLED = False
40 |
41 | # Override the default request headers:
42 | #DEFAULT_REQUEST_HEADERS = {
43 | # 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
44 | # 'Accept-Language': 'en',
45 | #}
46 |
47 | # Enable or disable spider middlewares
48 | # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
49 | #SPIDER_MIDDLEWARES = {
50 | # 'sina.middlewares.SinaSpiderMiddleware': 543,
51 | #}
52 |
53 | # Enable or disable downloader middlewares
54 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
55 | #DOWNLOADER_MIDDLEWARES = {
56 | # 'sina.middlewares.MyCustomDownloaderMiddleware': 543,
57 | #}
58 |
59 | # Enable or disable extensions
60 | # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
61 | #EXTENSIONS = {
62 | # 'scrapy.extensions.telnet.TelnetConsole': None,
63 | #}
64 |
65 | # Configure item pipelines
66 | # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
67 | #ITEM_PIPELINES = {
68 | # 'sina.pipelines.SinaPipeline': 300,
69 | #}
70 |
71 | # Enable and configure the AutoThrottle extension (disabled by default)
72 | # See http://doc.scrapy.org/en/latest/topics/autothrottle.html
73 | #AUTOTHROTTLE_ENABLED = True
74 | # The initial download delay
75 | #AUTOTHROTTLE_START_DELAY = 5
76 | # The maximum download delay to be set in case of high latencies
77 | #AUTOTHROTTLE_MAX_DELAY = 60
78 | # The average number of requests Scrapy should be sending in parallel to
79 | # each remote server
80 | #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
81 | # Enable showing throttling stats for every response received:
82 | #AUTOTHROTTLE_DEBUG = False
83 |
84 | # Enable and configure HTTP caching (disabled by default)
85 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
86 | #HTTPCACHE_ENABLED = True
87 | #HTTPCACHE_EXPIRATION_SECS = 0
88 | #HTTPCACHE_DIR = 'httpcache'
89 | #HTTPCACHE_IGNORE_HTTP_CODES = []
90 | #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
91 |
--------------------------------------------------------------------------------
/Scrapy/stock_apple/sina/sina/spiders/__init__.py:
--------------------------------------------------------------------------------
1 | # This package will contain the spiders of your Scrapy project
2 | #
3 | # Please refer to the documentation for information on how to create and manage
4 | # your spiders.
5 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/.idea/stock_bulletin.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/__init__.py
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/getcode.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/getcode.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/items.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/items.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/pipelines.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/pipelines.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/settings.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/__pycache__/settings.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/getcode.py:
--------------------------------------------------------------------------------
1 | def GET_CODE():
2 | f = open('bulletin/stock_code.txt')
3 | STOCK_CODE = []
4 | for line in f.readlines():
5 | line = line.replace('\n', '')
6 | STOCK_CODE.append(line)
7 | f.close()
8 | return STOCK_CODE
9 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/items.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your scraped items
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/items.html
7 |
8 | import scrapy
9 | from scrapy import Item, Field
10 |
11 | class BulletinItem(scrapy.Item):
12 | # define the fields for your item here like:
13 | # name = scrapy.Field()
14 | code = Field()
15 | title = Field()
16 | bulletin = Field()
17 | pass
18 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/middlewares.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your spider middleware
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/spider-middleware.html
7 |
8 | from scrapy import signals
9 |
10 |
11 | class BulletinSpiderMiddleware(object):
12 | # Not all methods need to be defined. If a method is not defined,
13 | # scrapy acts as if the spider middleware does not modify the
14 | # passed objects.
15 |
16 | @classmethod
17 | def from_crawler(cls, crawler):
18 | # This method is used by Scrapy to create your spiders.
19 | s = cls()
20 | crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
21 | return s
22 |
23 | def process_spider_input(self, response, spider):
24 | # Called for each response that goes through the spider
25 | # middleware and into the spider.
26 |
27 | # Should return None or raise an exception.
28 | return None
29 |
30 | def process_spider_output(self, response, result, spider):
31 | # Called with the results returned from the Spider, after
32 | # it has processed the response.
33 |
34 | # Must return an iterable of Request, dict or Item objects.
35 | for i in result:
36 | yield i
37 |
38 | def process_spider_exception(self, response, exception, spider):
39 | # Called when a spider or process_spider_input() method
40 | # (from other spider middleware) raises an exception.
41 |
42 | # Should return either None or an iterable of Response, dict
43 | # or Item objects.
44 | pass
45 |
46 | def process_start_requests(self, start_requests, spider):
47 | # Called with the start requests of the spider, and works
48 | # similarly to the process_spider_output() method, except
49 | # that it doesn’t have a response associated.
50 |
51 | # Must return only requests (not items).
52 | for r in start_requests:
53 | yield r
54 |
55 | def spider_opened(self, spider):
56 | spider.logger.info('Spider opened: %s' % spider.name)
57 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/pipelines.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define your item pipelines here
4 | #
5 | # Don't forget to add your pipeline to the ITEM_PIPELINES setting
6 | # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
7 | import pymongo
8 |
9 | class MongoPipeline(object):
10 | collection_name = 'bulletin'
11 |
12 | def __init__(self, mongo_uri, mongo_db):
13 | self.mongo_uri = mongo_uri
14 | self.mongo_db = mongo_db
15 |
16 | @classmethod
17 | def from_crawler(cls, crawler):
18 | return cls(
19 | mongo_uri=crawler.settings.get('MONGO_URI'),
20 | mongo_db=crawler.settings.get('MONGO_DATABASE', 'items')
21 | )
22 |
23 | def open_spider(self, spider):
24 | self.client = pymongo.MongoClient(self.mongo_uri)
25 | self.db = self.client[self.mongo_db]
26 |
27 | def close_spider(self, spider):
28 | self.client.close()
29 |
30 | def process_item(self, item, spider):
31 | # collection_name = item.__class__.__name__
32 | # self.db[collection_name].insert(dict(item))
33 | self.db[self.collection_name].update({'bulletin': item['bulletin']}, {'$set': dict(item)}, True)
34 | return item
35 |
36 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/settings.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Scrapy settings for bulletin project
4 | #
5 | # For simplicity, this file contains only settings considered important or
6 | # commonly used. You can find more settings consulting the documentation:
7 | #
8 | # http://doc.scrapy.org/en/latest/topics/settings.html
9 | # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
10 | # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
11 |
12 | BOT_NAME = 'bulletin'
13 |
14 | SPIDER_MODULES = ['bulletin.spiders']
15 | NEWSPIDER_MODULE = 'bulletin.spiders'
16 |
17 |
18 | # Crawl responsibly by identifying yourself (and your website) on the user-agent
19 | #USER_AGENT = 'bulletin (+http://www.yourdomain.com)'
20 |
21 | # Obey robots.txt rules
22 | ROBOTSTXT_OBEY = False
23 |
24 | # Configure maximum concurrent requests performed by Scrapy (default: 16)
25 | #CONCURRENT_REQUESTS = 32
26 |
27 | # Configure a delay for requests for the same website (default: 0)
28 | # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
29 | # See also autothrottle settings and docs
30 | #DOWNLOAD_DELAY = 3
31 | # The download delay setting will honor only one of:
32 | #CONCURRENT_REQUESTS_PER_DOMAIN = 16
33 | #CONCURRENT_REQUESTS_PER_IP = 16
34 |
35 | # Disable cookies (enabled by default)
36 | #COOKIES_ENABLED = False
37 |
38 | # Disable Telnet Console (enabled by default)
39 | #TELNETCONSOLE_ENABLED = False
40 |
41 | # Override the default request headers:
42 | DEFAULT_REQUEST_HEADERS = {
43 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
44 | 'Accept-Language': 'en',
45 | 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6',
46 | }
47 |
48 | # Enable or disable spider middlewares
49 | # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
50 | #SPIDER_MIDDLEWARES = {
51 | # 'bulletin.middlewares.BulletinSpiderMiddleware': 543,
52 | #}
53 |
54 | # Enable or disable downloader middlewares
55 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
56 | #DOWNLOADER_MIDDLEWARES = {
57 | # 'bulletin.middlewares.MyCustomDownloaderMiddleware': 543,
58 | #}
59 |
60 | # Enable or disable extensions
61 | # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
62 | #EXTENSIONS = {
63 | # 'scrapy.extensions.telnet.TelnetConsole': None,
64 | #}
65 |
66 | # Configure item pipelines
67 | # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
68 | ITEM_PIPELINES = {
69 | 'bulletin.pipelines.MongoPipeline': 300,
70 | }
71 |
72 | # Enable and configure the AutoThrottle extension (disabled by default)
73 | # See http://doc.scrapy.org/en/latest/topics/autothrottle.html
74 | #AUTOTHROTTLE_ENABLED = True
75 | # The initial download delay
76 | #AUTOTHROTTLE_START_DELAY = 5
77 | # The maximum download delay to be set in case of high latencies
78 | #AUTOTHROTTLE_MAX_DELAY = 60
79 | # The average number of requests Scrapy should be sending in parallel to
80 | # each remote server
81 | #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
82 | # Enable showing throttling stats for every response received:
83 | #AUTOTHROTTLE_DEBUG = False
84 |
85 | # Enable and configure HTTP caching (disabled by default)
86 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
87 | #HTTPCACHE_ENABLED = True
88 | #HTTPCACHE_EXPIRATION_SECS = 0
89 | #HTTPCACHE_DIR = 'httpcache'
90 | #HTTPCACHE_IGNORE_HTTP_CODES = []
91 | #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
92 |
93 | MONGO_URI = 'localhost'
94 | MONGO_DATABASE = 'sina_bulletin'
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/spiders/__init__.py:
--------------------------------------------------------------------------------
1 | # This package will contain the spiders of your Scrapy project
2 | #
3 | # Please refer to the documentation for information on how to create and manage
4 | # your spiders.
5 |
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/spiders/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/spiders/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/spiders/__pycache__/sina.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stock_bulletin/bulletin/bulletin/spiders/__pycache__/sina.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/spiders/sina.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import scrapy
3 | from scrapy import Spider, Request
4 | from bulletin.getcode import GET_CODE
5 | from bulletin.items import BulletinItem
6 | import re
7 |
8 |
9 | class SinaSpider(scrapy.Spider):
10 | name = 'sina'
11 | allowed_domains = ['finance.sina.com.cn']
12 | start_url = 'http://vip.stock.finance.sina.com.cn/corp/go.php/vCB_Bulletin/stockid/{code}/page_type/ndbg.phtml'
13 |
14 |
15 | def start_requests(self):
16 | code = GET_CODE()
17 | for stock_code in list(code):
18 | yield Request(url=self.start_url.format(code=stock_code), callback=lambda response, CODE=stock_code: self.parse_stock(response, CODE), dont_filter=True)
19 | #yield Request(url='http://vip.stock.finance.sina.com.cn/corp/go.php/vCB_Bulletin/stockid/000049/page_type/ndbg.phtml', callback=self.parse_stock)
20 |
21 |
22 |
23 | def parse_stock(self, response, CODE):
24 | html = response.text
25 | target = r'&id=[_0-9_]{6,7}'
26 | target_list = re.findall(target, html)
27 | print(target_list)
28 | for each in target_list:
29 | target_url = 'http://vip.stock.finance.sina.com.cn/corp/view/vCB_AllBulletinDetail.php?stockid=' + CODE + each
30 | yield Request(target_url, callback=lambda response, news_code=CODE: self.getBulletin(response, CODE), dont_filter=True)
31 | pass
32 |
33 | def getBulletin(self, response, CODE):
34 | title = response.xpath('//th[@style="text-align:center"]/text()').extract_first()
35 | text = response.xpath('//pre/text()').extract_first()
36 |
37 | item = BulletinItem()
38 | item['code'] = CODE
39 | item['title'] = title
40 | item['bulletin'] = text
41 |
42 | yield item
43 | #print(response.xpath('//th[@style="text-align:center"]/text()').extract_first())
44 | #print(response.xpath('//pre/text()').extract_first())
45 | #pass
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/bulletin/stock_code.txt:
--------------------------------------------------------------------------------
1 | 000049
2 | 000823
3 | 002384
4 | 300433
5 | 002475
6 | 300136
7 | 002241
8 | 002456
--------------------------------------------------------------------------------
/Scrapy/stock_bulletin/bulletin/scrapy.cfg:
--------------------------------------------------------------------------------
1 | # Automatically created by: scrapy startproject
2 | #
3 | # For more information about the [deploy] section see:
4 | # https://scrapyd.readthedocs.org/en/latest/deploy.html
5 |
6 | [settings]
7 | default = bulletin.settings
8 |
9 | [deploy]
10 | #url = http://localhost:6800/
11 | project = bulletin
12 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/.idea/stockappl.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/scrapy.cfg:
--------------------------------------------------------------------------------
1 | # Automatically created by: scrapy startproject
2 | #
3 | # For more information about the [deploy] section see:
4 | # https://scrapyd.readthedocs.org/en/latest/deploy.html
5 |
6 | [settings]
7 | default = stockappl.settings
8 |
9 | [deploy]
10 | #url = http://localhost:6800/
11 | project = stockappl
12 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/__init__.py
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/__pycache__/getcode.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/__pycache__/getcode.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/__pycache__/items.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/__pycache__/items.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/__pycache__/pipelines.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/__pycache__/pipelines.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/__pycache__/settings.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/__pycache__/settings.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/getcode.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | #STOCK_CODE = ['sz300207']
4 |
5 | def GET_CODE():
6 | f = open('stockappl/stock_code.txt')
7 | STOCK_CODE = []
8 | for line in f.readlines():
9 | line = line.replace('\n', '')
10 | STOCK_CODE.append(line)
11 | f.close()
12 | return STOCK_CODE
13 |
14 |
15 |
16 | # if __name__ == '__main__':
17 | # f = open('stock_code.txt')
18 | # STOCK_CODE = []
19 | # for line in f.readlines():
20 | # # print(line,end = '')
21 | # line = line.replace('\n', '')
22 | # STOCK_CODE.append(line)
23 | # print(STOCK_CODE)
24 | # f.close()
25 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/items.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your scraped items
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/items.html
7 |
8 | import scrapy
9 | from scrapy import Item, Field
10 |
11 |
12 | class StockapplItem(scrapy.Item):
13 | # define the fields for your item here like:
14 | # name = scrapy.Field()
15 | symbol = Field()
16 | title = Field()
17 |
18 | datetime = Field()
19 | news = Field()
20 |
21 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/middlewares.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define here the models for your spider middleware
4 | #
5 | # See documentation in:
6 | # http://doc.scrapy.org/en/latest/topics/spider-middleware.html
7 |
8 | from scrapy import signals
9 |
10 |
11 | class StockapplSpiderMiddleware(object):
12 | # Not all methods need to be defined. If a method is not defined,
13 | # scrapy acts as if the spider middleware does not modify the
14 | # passed objects.
15 |
16 | @classmethod
17 | def from_crawler(cls, crawler):
18 | # This method is used by Scrapy to create your spiders.
19 | s = cls()
20 | crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
21 | return s
22 |
23 | def process_spider_input(self, response, spider):
24 | # Called for each response that goes through the spider
25 | # middleware and into the spider.
26 |
27 | # Should return None or raise an exception.
28 | return None
29 |
30 | def process_spider_output(self, response, result, spider):
31 | # Called with the results returned from the Spider, after
32 | # it has processed the response.
33 |
34 | # Must return an iterable of Request, dict or Item objects.
35 | for i in result:
36 | yield i
37 |
38 | def process_spider_exception(self, response, exception, spider):
39 | # Called when a spider or process_spider_input() method
40 | # (from other spider middleware) raises an exception.
41 |
42 | # Should return either None or an iterable of Response, dict
43 | # or Item objects.
44 | pass
45 |
46 | def process_start_requests(self, start_requests, spider):
47 | # Called with the start requests of the spider, and works
48 | # similarly to the process_spider_output() method, except
49 | # that it doesn’t have a response associated.
50 |
51 | # Must return only requests (not items).
52 | for r in start_requests:
53 | yield r
54 |
55 | def spider_opened(self, spider):
56 | spider.logger.info('Spider opened: %s' % spider.name)
57 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/pipelines.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Define your item pipelines here
4 | #
5 | # Don't forget to add your pipeline to the ITEM_PIPELINES setting
6 | # See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
7 |
8 | import pymongo
9 |
10 |
11 | class MongoPipeline(object):
12 | collection_name = 'stock'
13 |
14 | def __init__(self, mongo_uri, mongo_db):
15 | self.mongo_uri = mongo_uri
16 | self.mongo_db = mongo_db
17 | #self.client.admin.authenticate(settings['MINGO_USER'], settings['MONGO_PSW'])
18 |
19 | @classmethod
20 | def from_crawler(cls, crawler):
21 | return cls(
22 | mongo_uri=crawler.settings.get('MONGO_URI'),
23 | mongo_db=crawler.settings.get('MONGO_DATABASE')
24 | )
25 |
26 | def open_spider(self, spider):
27 | self.client = pymongo.MongoClient(self.mongo_uri)
28 | # self.db_auth = self.client.admin
29 | # self.db_auth.authenticate("OAA", "1378215200zad")
30 | self.db = self.client[self.mongo_db]
31 |
32 | def close_spider(self, spider):
33 | self.client.close()
34 |
35 | def process_item(self, item, spider):
36 | # collection_name = item.__class__.__name__
37 | #self.db[self.collection_name].insert(dict(item))
38 | self.db[self.collection_name].update({'title': item['title']}, {'$set': dict(item)}, True)
39 | #self.db[self.collection_name].update({'url_token': item['url_token']}, dict(item), True)
40 | return item
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | # class MongoPipeline(object):
50 | # def process_item(self, item, spider):
51 | # return item
52 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/settings.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 |
3 | # Scrapy settings for stockappl project
4 | #
5 | # For simplicity, this file contains only settings considered important or
6 | # commonly used. You can find more settings consulting the documentation:
7 | #
8 | # http://doc.scrapy.org/en/latest/topics/settings.html
9 | # http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
10 | # http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
11 |
12 | BOT_NAME = 'stockappl'
13 |
14 | SPIDER_MODULES = ['stockappl.spiders']
15 | NEWSPIDER_MODULE = 'stockappl.spiders'
16 |
17 |
18 | # Crawl responsibly by identifying yourself (and your website) on the user-agent
19 | #USER_AGENT = 'stockappl (+http://www.yourdomain.com)'
20 |
21 | # Obey robots.txt rules
22 | ROBOTSTXT_OBEY = False
23 |
24 | # Configure maximum concurrent requests performed by Scrapy (default: 16)
25 | #CONCURRENT_REQUESTS = 32
26 |
27 | # Configure a delay for requests for the same website (default: 0)
28 | # See http://scrapy.readthedocs.org/en/latest/topics/settings.html#download-delay
29 | # See also autothrottle settings and docs
30 | #DOWNLOAD_DELAY = 3
31 | # The download delay setting will honor only one of:
32 | #CONCURRENT_REQUESTS_PER_DOMAIN = 16
33 | #CONCURRENT_REQUESTS_PER_IP = 16
34 |
35 | # Disable cookies (enabled by default)
36 | #COOKIES_ENABLED = False
37 |
38 | # Disable Telnet Console (enabled by default)
39 | #TELNETCONSOLE_ENABLED = False
40 |
41 | # Override the default request headers:
42 | DEFAULT_REQUEST_HEADERS = {
43 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
44 | 'Accept-Language': 'en',
45 | 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6',
46 | }
47 |
48 | # Enable or disable spider middlewares
49 | # See http://scrapy.readthedocs.org/en/latest/topics/spider-middleware.html
50 | #SPIDER_MIDDLEWARES = {
51 | # 'stockappl.middlewares.StockapplSpiderMiddleware': 543,
52 | #}
53 |
54 | # Enable or disable downloader middlewares
55 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html
56 | #DOWNLOADER_MIDDLEWARES = {
57 | # 'stockappl.middlewares.MyCustomDownloaderMiddleware': 543,
58 | #}
59 |
60 | # Enable or disable extensions
61 | # See http://scrapy.readthedocs.org/en/latest/topics/extensions.html
62 | #EXTENSIONS = {
63 | # 'scrapy.extensions.telnet.TelnetConsole': None,
64 | #}
65 |
66 | # Configure item pipelines
67 | # See http://scrapy.readthedocs.org/en/latest/topics/item-pipeline.html
68 | ITEM_PIPELINES = {
69 | 'stockappl.pipelines.MongoPipeline': 300,
70 | }
71 |
72 | # Enable and configure the AutoThrottle extension (disabled by default)
73 | # See http://doc.scrapy.org/en/latest/topics/autothrottle.html
74 | #AUTOTHROTTLE_ENABLED = True
75 | # The initial download delay
76 | #AUTOTHROTTLE_START_DELAY = 5
77 | # The maximum download delay to be set in case of high latencies
78 | #AUTOTHROTTLE_MAX_DELAY = 60
79 | # The average number of requests Scrapy should be sending in parallel to
80 | # each remote server
81 | #AUTOTHROTTLE_TARGET_CONCURRENCY = 1.0
82 | # Enable showing throttling stats for every response received:
83 | #AUTOTHROTTLE_DEBUG = False
84 |
85 | # Enable and configure HTTP caching (disabled by default)
86 | # See http://scrapy.readthedocs.org/en/latest/topics/downloader-middleware.html#httpcache-middleware-settings
87 | #HTTPCACHE_ENABLED = True
88 | #HTTPCACHE_EXPIRATION_SECS = 0
89 | #HTTPCACHE_DIR = 'httpcache'
90 | #HTTPCACHE_IGNORE_HTTP_CODES = []
91 | #HTTPCACHE_STORAGE = 'scrapy.extensions.httpcache.FilesystemCacheStorage'
92 |
93 | MONGO_URI = 'localhost'
94 | MONGO_DATABASE = 'sina'
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/spiders/__init__.py:
--------------------------------------------------------------------------------
1 | # This package will contain the spiders of your Scrapy project
2 | #
3 | # Please refer to the documentation for information on how to create and manage
4 | # your spiders.
5 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/spiders/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/spiders/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/spiders/__pycache__/netease.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/spiders/__pycache__/netease.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/spiders/__pycache__/sina.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/Scrapy/stockappl/stockappl/spiders/__pycache__/sina.cpython-36.pyc
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/spiders/netease.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import scrapy
3 | from scrapy import Spider, Request
4 | from stockappl.getcode import GET_CODE
5 | from stockappl.items import StockapplItem
6 |
7 |
8 | class NeteaseSpider(scrapy.Spider):
9 | name = 'netease'
10 | allowed_domains = ['money.163.com']
11 | start_url = 'http://quotes.money.163.com/f10/gsxw_{code},{index}.html'
12 |
13 |
14 | def start_requests(self):
15 | code = GET_CODE()
16 | for stock_code in list(code):
17 | CODE = stock_code[2:]
18 | print("0000000000000000000000000")
19 | print(CODE)
20 | for stock_index in range(0, 10):
21 | yield Request(url=self.start_url.format(code=CODE, index=stock_index), callback=lambda response, sz_code=stock_code: self.parse_stock(response, sz_code), dont_filter=True)
22 |
23 | pass
24 |
25 | def parse_stock(self, response, sz_code):
26 | title = response.xpath('//td[@class="td_text"]/a/text()').extract()
27 | url = response.xpath('//td[@class="td_text"]/a/@href').extract()
28 | date = response.xpath('//td[@class="align_c"]/text()').extract()
29 |
30 | for x, y, z in zip(title, url, date):
31 | yield Request(y, callback=lambda response, TITLE=x, DATE=z, CODE=sz_code: self.getNews(response, TITLE, DATE, CODE), dont_filter=True)
32 | pass
33 |
34 | def getNews(self, response, TITLE, DATE, CODE):
35 | # print(TITLE)
36 | # print(DATE)
37 | # print(CODE)
38 | news = response.xpath('//div[@class="post_text"]/p/text()').extract()
39 | str = "".join(news)
40 | #print(str)
41 |
42 | item = StockapplItem()
43 | item['symbol'] = CODE
44 | item['title'] = TITLE
45 | item['datetime'] = DATE
46 | item['news'] = str
47 | yield item
48 | pass
49 |
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/spiders/sina.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | import scrapy
3 | from scrapy import Spider, Request
4 | from stockappl.getcode import GET_CODE
5 | from stockappl.items import StockapplItem
6 |
7 |
8 |
9 | import re
10 | from bs4 import BeautifulSoup,BeautifulStoneSoup
11 | import chardet
12 |
13 | class SinaSpider(scrapy.Spider):
14 | name = 'sina'
15 | allowed_domains = ['finance.sina.com.cn']
16 | #start_urls = ['http://finance.sina.com.cn/']
17 | start_url = "http://vip.stock.finance.sina.com.cn/corp/view/vCB_AllNewsStock.php?symbol={code}&Page={index}"
18 | #start_url = "http://finance.sina.com.cn"
19 | #start_url = "http://vip.stock.finance.sina.com.cn/corp/view/vCB_AllNewsStock.php?symbol=sz000823&Page=1"
20 |
21 |
22 |
23 | def start_requests(self):
24 | #sina_url = '{url}sz300207&Page=1'.format(url=self.start_url)
25 | #sina_url = '{url}'.format(url=self.start_url) + code + '&Page=' + index
26 | code = GET_CODE()
27 | for stock_code in list(code):
28 | for stock_index in range(1, 10):
29 | yield Request(url=self.start_url.format(code=stock_code, index=stock_index), callback=lambda response, CODE=stock_code: self.parse_stock(response, CODE), dont_filter=True)
30 |
31 |
32 | def parse_stock(self, response, CODE):
33 | data = response.text
34 | soup = BeautifulSoup(data, "html5lib")
35 | paper_name = soup.html.body.select('div .datelist')[0].ul.find_all('a')
36 | tableData = []
37 | for e in paper_name:
38 | b = e.previous_sibling
39 | a = re.search(r'\d{4}(\-)\d{1,2}(\-)\d{1,2}', b)
40 |
41 | tableData.append({
42 | 'symbol': CODE,
43 | 'title': e.string,
44 | 'url': e['href'],
45 | 'datetime': a.group()
46 | })
47 |
48 | yield Request(url=e['href'], callback=lambda response, news_code=CODE, news_title=e.string, news_date=a.group(): self.getNews(response, news_code, news_title, news_date), dont_filter=True)
49 |
50 | #print(response.text)
51 | pass
52 |
53 | def getNews(self, response, newcode, newtitle, newdate):
54 | news = response.body
55 | htmlchardet = chardet.detect(news)
56 | print(htmlchardet["encoding"])
57 |
58 | # fopen1 = urlopen(newsurl).info()
59 | # print(fopen1)
60 | if htmlchardet["encoding"] == "Windows-1254":
61 | htmlchardet["encoding"] = "utf-8"
62 |
63 | if htmlchardet["encoding"] == "ascii":
64 | htmlchardet["encoding"] = "GB2312"
65 |
66 | # res = requests.get(newsurl)
67 | # res.encoding = htmlchardet["encoding"]
68 | soup = BeautifulSoup(response.text, 'html.parser', from_encoding=htmlchardet["encoding"])
69 | # , from_encoding='gb2312'
70 | try:
71 | print(soup.title.text)
72 | except (AttributeError, UnicodeEncodeError, TypeError) as e:
73 | pass
74 |
75 | newtext = []
76 |
77 | tt = soup.find_all('p')
78 | for t in tt:
79 | # print(t.text)
80 | newtext.append(t.text)
81 |
82 | news = ''.join(newtext)
83 |
84 | item = StockapplItem()
85 | item['symbol'] = newcode
86 | item['title'] = newtitle
87 | item['datetime'] = newdate
88 | item['news'] = news
89 |
90 | yield item
91 | #print(item)
92 |
93 |
94 | # f = open(newcode + '_' + newdate + '.txt', 'wt', encoding="utf-8")
95 | # try:
96 | # f.write(news)
97 | # except (AttributeError, UnicodeEncodeError, TypeError) as e:
98 | # pass
99 | #
100 | #
101 | # f.close()
102 | #pass
--------------------------------------------------------------------------------
/Scrapy/stockappl/stockappl/stock_code.txt:
--------------------------------------------------------------------------------
1 | sz000049
2 | sz000823
3 | sz002384
4 | sz300433
5 | sz002475
6 | sz300136
7 | sz002241
8 | sz002456
--------------------------------------------------------------------------------
/news-emotion-master/.idea/dictionaries/AsuraDong.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/news-emotion-master/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/news-emotion-master/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/news-emotion-master/.idea/news_emotion.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/news-emotion-master/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/news-emotion-master/README.md:
--------------------------------------------------------------------------------
1 | ## 0.快速开始
2 | - 挑战杯项目:金融文本情感分析模型 || Challenge Cup Project: Financial Text Emotion Analysis Model
3 | - 金融领域短文本情感分析
4 | - 配置要求:`python 3.x`
5 |
6 | ## 1.使用方法
7 | ### 1.0 下载
8 | ```shell
9 | sudo git clone https://github.com/AsuraDong/news-emotion.git news_emotion
10 | mv -R ./news_emotion/ 你的程序路径/
11 | ```
12 |
13 | ### 1.1 文件结构
14 |
15 | ```python
16 | clean_data/ # 清洗数据
17 | __init__.py
18 | clean_html.py # 清洗网页标签
19 | langconv.py # 简体和繁体转化
20 | zh_wiki.py # 简体和繁体转化
21 | data/ # 存放训练集和词典
22 | emdict/ # 存放词典
23 | material/
24 | emotion_word.py # 知网情感词典
25 | stopword.txt # 中文停用词典
26 | NTUSD_simplified/ # 台湾大学NTUSD情感词典
27 | ...
28 | collect_dict.py # 生成之后程序需要的plk和用户词典
29 | trainset/ # 存放训练集
30 | ...
31 | model/ # 我们训练好的model模型
32 | wordfreq_logistic.ml
33 | other/ # 根据具体情况自行添加
34 | ...
35 | result/ #结果展示
36 | log/
37 | best_model/ # 针对最好的模型的详细信息
38 | PR.json
39 | error_tag.json
40 | ml_rate.plk
41 | logfile.plk
42 | 3plus3arr.plk
43 | show/ # 组合模型的全部结果
44 | result.csv
45 | result.xlsx
46 | vector/ # 文本翻译后的词向量
47 | result.csv
48 | result.xlsx
49 | __init__.py
50 | loocv_model.py # 对组合模型进行留一验证,并且将结果写入csv和excel文件
51 | ml_model.py # 集成sklearn常用的自然语言的机器学习模型
52 | operate_data.py # 将文本处理成词向量,并且保存了logfile.plk
53 | README.md
54 | demo.py # 使用者(非开发者)调用框架的样例
55 | run_best.py # 人工找出loocv_model.py的最好结果后,进行最好模型的更详细分析
56 | ```
57 |
58 | ### 1.2 使用方法
59 | **请参照`demo.py`的代码**
60 | 1. 打开`demo.py`
61 | 2. 如果:
62 | - **直接使用我们训练好的模型,在`if __name__=='__main__':`里面输入:**
63 | ```python
64 | od.loadStopwords()
65 | od.loadEmotionwords()
66 | od.loadWords(od.stopList)
67 | od.loadDocument(od.stopList)
68 | ##### 单例模式 #####
69 | predictor = Predictor()
70 | predictor.load_model()
71 | predictor.set_mode(mode="wordfreq") # 以上代码是初始化配置,只需要调用一次
72 |
73 | ##### 下面的代码可以循环调用 #####
74 | news = " 《经济通通讯社13日专讯》日股早市偏软,日经225指数报18312跌239点。 美元兑日圆疲软,新报108﹒78╱80。(tt)" # 这是您的新闻样本
75 |
76 | predictor.set_news(news=news)
77 | predictor.trans_vec()
78 |
79 | tag = predictor() # 分类结果
80 | ```
81 |
82 | - 需要重新训练模型,那么在配置好`1.1`的文件后,在`if __name__=='__main__':`里面输入:
83 | ```python
84 | best_vector = "wordfreq"
85 | best_model = 1 # linearLogistic
86 | save_model(best_vector, best_model)
87 | ##### 单例模式 #####
88 | predictor = Predictor()
89 | predictor.load_model()
90 | predictor.set_mode(mode="wordfreq") # 以上代码是初始化配置,只需要调用一次
91 |
92 | ##### 下面的代码可以循环调用 #####
93 | news = " 《经济通通讯社13日专讯》日股早市偏软,日经225指数报18312跌239点。 美元兑日圆疲软,新报108﹒78╱80。(tt)" # 这是您的新闻样本
94 |
95 | predictor.set_news(news=news)
96 | predictor.trans_vec()
97 |
98 | tag = predictor()
99 | ```
100 | 3. 成功后,相信你也差不多理解框架的用法,请尽情使用吧。
101 |
102 | ## 2. 联系我
103 |
104 | WeChat:IT_xxx
105 | QQ:2592324965
106 | **Email:xiaochiyijiu@163.com**
--------------------------------------------------------------------------------
/news-emotion-master/__init__.py:
--------------------------------------------------------------------------------
1 | from .clean_data import cleanHtml # 下层已经做好了__init__.py文件, 所以可以将下一层当做包直接引用
2 | __all__ = [
3 | 'cleanHtml', # python3打包必须加引号
4 | ]
--------------------------------------------------------------------------------
/news-emotion-master/__pycache__/ml_model.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/__pycache__/ml_model.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/__pycache__/news.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/__pycache__/news.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/__pycache__/operate_data.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/__pycache__/operate_data.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/__pycache__/supplier_news.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/__pycache__/supplier_news.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/clean_data/__init__.py:
--------------------------------------------------------------------------------
1 | from .clean_html import cleanHtml # clean_data成功有了cleanHtml, 上层可以引用了
--------------------------------------------------------------------------------
/news-emotion-master/clean_data/__pycache__/__init__.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/clean_data/__pycache__/__init__.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/clean_data/__pycache__/clean_html.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/clean_data/__pycache__/clean_html.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/clean_data/__pycache__/langconv.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/clean_data/__pycache__/langconv.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/clean_data/__pycache__/zh_wiki.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/clean_data/__pycache__/zh_wiki.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/clean_data/clean_html.py:
--------------------------------------------------------------------------------
1 | """
2 | 清洗网页标签
3 | 全角和半角的转换
4 | """
5 |
6 | #encoding:utf-8
7 | import re
8 |
9 | # 网页中的字符实体
10 | # 需要更多的补充
11 | html_char = {}
12 | html_char['"'] = html_char['"']='"'
13 | html_char['''] = html_char['''] = "'"
14 | html_char['&'] = html_char['&'] = '&'
15 | html_char['<'] = html_char['<'] = '<'
16 | html_char['>'] = html_char['>'] = '>'
17 | html_char[' '] = html_char[' ']= ' '
18 |
19 | def Q2B(_char):
20 | """
21 | 全角字符转半角字符
22 | :param _char: 待转换字符
23 | :return: 转化后的字符
24 | """
25 | if 65281<=ord(_char)<=65374:
26 | _char = chr(ord(_char)-65248)
27 | elif ord(_char)==12288:
28 | _char = chr(32)
29 | return _char
30 |
31 | def isQ(Char):
32 | """
33 | 判断是否是全角字符
34 | :param Char: 待判断字符
35 | :return: bool值
36 | """
37 | return True if (65281<=ord(Char)<=65374 or ord(Char)==12288) else False
38 |
39 | def B2Q(_char):
40 | """
41 | 半角字符转全角字符
42 | :param _char: 待转换字符
43 | :return: 转化后的字符
44 | """
45 | if 33<=ord(_char)<=126:
46 | _char = chr(ord(_char)+65248)
47 | elif ord(_char)==32:
48 | _char = chr(12288)
49 | return _char
50 |
51 | # 类似 isQ(Char)
52 | def isB(Char):
53 | return True if (33<=ord(Char)<=126 or ord(Char)==32) else False
54 |
55 |
56 | def cleanHtml(html_str,special_char=None,to_char=None):
57 | """
58 | 清洗html标签
59 | :param html_str: html文本
60 | :param special_char: 自定义的需要处理的特殊字符列表(迭代器类型)
61 | :param to_char: special_char的转化目标
62 | :return: html中的正文部分
63 | """
64 |
65 | # 如果有需要处理的额外字符
66 | if special_char:
67 | special_rule = re.compile('|'.join(set(special_char))) # '|'在正则表达式中代表'或'。所有的特殊字符都要替换
68 | if not to_char:
69 | to_char = ''
70 |
71 | #CDATA 部分由 "" 结束:
72 | cdata_rule = re.compile(r'',re.I | re.S)
73 |
74 | #去除脚本(随时会出现)
75 | script_rule = re.compile(r'',re.I | re.S)
76 |
77 | #取出..和中间的内容,style也在里面,不需要再写了
78 | head_rule = re.compile(r'',re.I | re.S)
79 |
80 | #为了以防一些文本不是全部截取html代码,还是写一下以防万一
81 | style_rule = re.compile(r'',re.I | re.S)
82 |
83 | #处理注释
84 | comment_rule = re.compile(r'',re.I | re.S)
85 |
86 | #处理换行
87 | br_rule = re.compile(r'
',re.I)
88 |
89 | #html标签
90 | html_rule = re.compile(r'<.*?/{0,1}>',re.I)
91 |
92 | if special_char:
93 | raw = special_rule.sub(to_char,html_str)
94 | else:
95 | raw = html_str
96 |
97 | raw = cdata_rule.sub('',raw)
98 | raw = script_rule.sub('',raw)
99 | raw = head_rule.sub('',raw)
100 | raw = style_rule.sub('',raw)
101 | raw = comment_rule.sub('',raw)
102 | raw = br_rule.sub('\n',raw)
103 | raw = html_rule.sub('',raw)
104 |
105 | global html_char
106 | letter_char = re.compile(r'(&[a-z]+;)|(\d+;)',re.I)
107 | for _,__ in letter_char.findall(raw): # _,__分别对应两种形式的字符实体
108 | if _ not in html_char.keys() and __ not in html_char.keys(): # 针对字符实体不在html_char的情况
109 | continue
110 | if _ in html_char.keys():
111 | raw = re.sub(_,html_char[_],raw)
112 | else:
113 | raw = re.sub(__, html_char[__], raw)
114 |
115 | raw_list = list(raw)
116 | for i in range(len(raw_list)):
117 | if isQ(raw_list[i]):
118 | raw_list[i] = Q2B(raw_list[i])
119 | raw = ''.join(raw_list)
120 |
121 | return raw
122 |
123 | # 测试函数
124 | def test():
125 | # 下面是一段html的测试代码
126 | test_html = """
127 |
128 |
151 | """
152 |
153 | print(cleanHtml(test_html,'】15'))
154 |
155 | if __name__=='__main__':
156 | test()
--------------------------------------------------------------------------------
/news-emotion-master/clean_data/langconv.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | from copy import deepcopy
5 | import re
6 |
7 | try:
8 | import psyco
9 | psyco.full()
10 | except:
11 | pass
12 |
13 | try:
14 | from zh_wiki import zh2Hant, zh2Hans
15 | except ImportError:
16 | from .zh_wiki import zh2Hant, zh2Hans
17 |
18 | import sys
19 | py3k = sys.version_info >= (3, 0, 0)
20 |
21 | if py3k:
22 | UEMPTY = ''
23 | else:
24 | _zh2Hant, _zh2Hans = {}, {}
25 | for old, new in ((zh2Hant, _zh2Hant), (zh2Hans, _zh2Hans)):
26 | for k, v in old.items():
27 | new[k.decode('utf8')] = v.decode('utf8')
28 | zh2Hant = _zh2Hant
29 | zh2Hans = _zh2Hans
30 | UEMPTY = ''.decode('utf8')
31 |
32 | # states
33 | (START, END, FAIL, WAIT_TAIL) = list(range(4))
34 | # conditions
35 | (TAIL, ERROR, MATCHED_SWITCH, UNMATCHED_SWITCH, CONNECTOR) = list(range(5))
36 |
37 | MAPS = {}
38 |
39 | class Node(object):
40 | def __init__(self, from_word, to_word=None, is_tail=True,
41 | have_child=False):
42 | self.from_word = from_word
43 | if to_word is None:
44 | self.to_word = from_word
45 | self.data = (is_tail, have_child, from_word)
46 | self.is_original = True
47 | else:
48 | self.to_word = to_word or from_word
49 | self.data = (is_tail, have_child, to_word)
50 | self.is_original = False
51 | self.is_tail = is_tail
52 | self.have_child = have_child
53 |
54 | def is_original_long_word(self):
55 | return self.is_original and len(self.from_word)>1
56 |
57 | def is_follow(self, chars):
58 | return chars != self.from_word[:-1]
59 |
60 | def __str__(self):
61 | return '' % (repr(self.from_word),
62 | repr(self.to_word), self.is_tail, self.have_child)
63 |
64 | __repr__ = __str__
65 |
66 | class ConvertMap(object):
67 | def __init__(self, name, mapping=None):
68 | self.name = name
69 | self._map = {}
70 | if mapping:
71 | self.set_convert_map(mapping)
72 |
73 | def set_convert_map(self, mapping):
74 | convert_map = {}
75 | have_child = {}
76 | max_key_length = 0
77 | for key in sorted(mapping.keys()):
78 | if len(key)>1:
79 | for i in range(1, len(key)):
80 | parent_key = key[:i]
81 | have_child[parent_key] = True
82 | have_child[key] = False
83 | max_key_length = max(max_key_length, len(key))
84 | for key in sorted(have_child.keys()):
85 | convert_map[key] = (key in mapping, have_child[key],
86 | mapping.get(key, UEMPTY))
87 | self._map = convert_map
88 | self.max_key_length = max_key_length
89 |
90 | def __getitem__(self, k):
91 | try:
92 | is_tail, have_child, to_word = self._map[k]
93 | return Node(k, to_word, is_tail, have_child)
94 | except:
95 | return Node(k)
96 |
97 | def __contains__(self, k):
98 | return k in self._map
99 |
100 | def __len__(self):
101 | return len(self._map)
102 |
103 | class StatesMachineException(Exception): pass
104 |
105 | class StatesMachine(object):
106 | def __init__(self):
107 | self.state = START
108 | self.final = UEMPTY
109 | self.len = 0
110 | self.pool = UEMPTY
111 |
112 | def clone(self, pool):
113 | new = deepcopy(self)
114 | new.state = WAIT_TAIL
115 | new.pool = pool
116 | return new
117 |
118 | def feed(self, char, map):
119 | node = map[self.pool+char]
120 |
121 | if node.have_child:
122 | if node.is_tail:
123 | if node.is_original:
124 | cond = UNMATCHED_SWITCH
125 | else:
126 | cond = MATCHED_SWITCH
127 | else:
128 | cond = CONNECTOR
129 | else:
130 | if node.is_tail:
131 | cond = TAIL
132 | else:
133 | cond = ERROR
134 |
135 | new = None
136 | if cond == ERROR:
137 | self.state = FAIL
138 | elif cond == TAIL:
139 | if self.state == WAIT_TAIL and node.is_original_long_word():
140 | self.state = FAIL
141 | else:
142 | self.final += node.to_word
143 | self.len += 1
144 | self.pool = UEMPTY
145 | self.state = END
146 | elif self.state == START or self.state == WAIT_TAIL:
147 | if cond == MATCHED_SWITCH:
148 | new = self.clone(node.from_word)
149 | self.final += node.to_word
150 | self.len += 1
151 | self.state = END
152 | self.pool = UEMPTY
153 | elif cond == UNMATCHED_SWITCH or cond == CONNECTOR:
154 | if self.state == START:
155 | new = self.clone(node.from_word)
156 | self.final += node.to_word
157 | self.len += 1
158 | self.state = END
159 | else:
160 | if node.is_follow(self.pool):
161 | self.state = FAIL
162 | else:
163 | self.pool = node.from_word
164 | elif self.state == END:
165 | # END is a new START
166 | self.state = START
167 | new = self.feed(char, map)
168 | elif self.state == FAIL:
169 | raise StatesMachineException('Translate States Machine '
170 | 'have error with input data %s' % node)
171 | return new
172 |
173 | def __len__(self):
174 | return self.len + 1
175 |
176 | def __str__(self):
177 | return '' % (
178 | id(self), self.pool, self.state, self.final)
179 | __repr__ = __str__
180 |
181 | class Converter(object):
182 | def __init__(self, to_encoding):
183 | self.to_encoding = to_encoding
184 | self.map = MAPS[to_encoding]
185 | self.start()
186 |
187 | def feed(self, char):
188 | branches = []
189 | for fsm in self.machines:
190 | new = fsm.feed(char, self.map)
191 | if new:
192 | branches.append(new)
193 | if branches:
194 | self.machines.extend(branches)
195 | self.machines = [fsm for fsm in self.machines if fsm.state != FAIL]
196 | all_ok = True
197 | for fsm in self.machines:
198 | if fsm.state != END:
199 | all_ok = False
200 | if all_ok:
201 | self._clean()
202 | return self.get_result()
203 |
204 | def _clean(self):
205 | if len(self.machines):
206 | self.machines.sort(key=lambda x: len(x))
207 | # self.machines.sort(cmp=lambda x,y: cmp(len(x), len(y)))
208 | self.final += self.machines[0].final
209 | self.machines = [StatesMachine()]
210 |
211 | def start(self):
212 | self.machines = [StatesMachine()]
213 | self.final = UEMPTY
214 |
215 | def end(self):
216 | self.machines = [fsm for fsm in self.machines
217 | if fsm.state == FAIL or fsm.state == END]
218 | self._clean()
219 |
220 | def convert(self, string):
221 | self.start()
222 | for char in string:
223 | self.feed(char)
224 | self.end()
225 | return self.get_result()
226 |
227 | def get_result(self):
228 | return self.final
229 |
230 |
231 | def registery(name, mapping):
232 | global MAPS
233 | MAPS[name] = ConvertMap(name, mapping)
234 |
235 | registery('zh-hant', zh2Hant)
236 | registery('zh-hans', zh2Hans)
237 | del zh2Hant, zh2Hans
238 |
239 |
240 | def run():
241 | import sys
242 | from optparse import OptionParser
243 | parser = OptionParser()
244 | parser.add_option('-e', type='string', dest='encoding',
245 | help='encoding')
246 | parser.add_option('-f', type='string', dest='file_in',
247 | help='input file (- for stdin)')
248 | parser.add_option('-t', type='string', dest='file_out',
249 | help='output file')
250 | (options, args) = parser.parse_args()
251 | if not options.encoding:
252 | parser.error('encoding must be set')
253 | if options.file_in:
254 | if options.file_in == '-':
255 | file_in = sys.stdin
256 | else:
257 | file_in = open(options.file_in)
258 | else:
259 | file_in = sys.stdin
260 | if options.file_out:
261 | if options.file_out == '-':
262 | file_out = sys.stdout
263 | else:
264 | file_out = open(options.file_out, 'wb')
265 | else:
266 | file_out = sys.stdout
267 |
268 | c = Converter(options.encoding)
269 | for line in file_in:
270 | # print >> file_out, c.convert(line.rstrip('\n').decode(
271 | file_out.write(c.convert(line.rstrip('\n').decode(
272 | 'utf8')).encode('utf8'))
273 |
274 |
275 | if __name__ == '__main__':
276 | run()
277 |
278 |
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/collect_dict.py:
--------------------------------------------------------------------------------
1 | """
2 | 收集、生成、存储金融词典
3 | """
4 | #encoding:utf-8
5 | import os
6 | import pickle
7 | # em是知网的情感词和程度词
8 | try:
9 | from material import emotion_word as em
10 | except Exception as error:
11 | from .material import emotion_word as em
12 |
13 | __posdict_path = os.path.join('material','NTUSD_simplified','pos.txt') # 积极情感词路径
14 | __negdict_path = os.path.join('material','NTUSD_simplified','neg.txt') # 消极情感词路径
15 | __stopdict_path = os.path.join('material','stopword.txt') # 停用词(垃圾词)路径
16 | __jieba_weight = 1000000 # 添加的新词的权重
17 |
18 | def collectEmotionWord(posdict_path,negdict_path):
19 | """
20 | 针对情感词
21 | :param posdict_path: 积极情感词路径
22 | :param negdict_path: 消极情感词路径
23 | :return: 积极词列表和消极词列表
24 | """
25 | posSet = set()
26 | negSet = set()
27 | ########## 收集台湾大学NTUSD和知网的积极情感词 ##########
28 | with open(posdict_path, 'r', encoding='utf-8')as f:
29 | for line in f.readlines():
30 | word = line.strip('\n').strip()
31 | if word:
32 | posSet.add(line.strip('\n').strip())
33 | for word in em.pos_emotion:
34 | posSet.add(word)
35 | for word in em.pos_envalute:
36 | posSet.add(word)
37 |
38 | ########## 收集台湾大学NTUSD和知网的消极情感词 ##########
39 | with open(negdict_path, 'r', encoding='utf-8')as f:
40 | for line in f.readlines():
41 | word = line.strip('\n').strip()
42 | if word:
43 | negSet.add(line.strip('\n').strip())
44 | for word in em.neg_emotion:
45 | negSet.add(word)
46 | for word in em.neg_envalute:
47 | negSet.add(word)
48 |
49 | return list(posSet),list(negSet)
50 |
51 |
52 | def collectStopWord(stopdict_path,*emotion):
53 | """
54 | 针对停用词
55 | :param stopdict_path: 停用词路径
56 | :param emotion: 情感词集合
57 | :return: 停用词列表
58 | """
59 | em_dict = set() # 收集情感词
60 | for em in emotion:
61 | for word in em:
62 | em_dict.add(word)
63 |
64 | stopSet = set()
65 | ########## 收集N-gram和停用词典的垃圾词 ##########
66 | with open(stopdict_path, 'r', encoding='utf-8') as f:
67 | for line in f.readlines():
68 | word = line.strip('\n').strip()
69 | if word and (word not in em_dict): # 过滤情感词
70 | stopSet.add(line.strip('\n').strip())
71 | return list(stopSet)
72 |
73 |
74 | def saveDict(**args):
75 | """
76 | 存储训练好的词典
77 | :param args: 键值对,形式:key(文件名)-value(存储内容)
78 | :return: None
79 | """
80 | for (name,mdict) in args.items():
81 | try:
82 | if not isinstance(mdict,list):
83 | raise TypeError("目前仅支持list类型")
84 | except Exception as error:
85 | pass
86 | else:
87 | with open(name,'w',encoding='utf-8') as f:
88 | f.write('\n'.join(mdict))
89 |
90 | # 作用同:saveDict(**args)
91 | def savePickle(**args):
92 | for (name,mdict) in args.items():
93 | try:
94 | if not isinstance(mdict,list):
95 | raise TypeError("目前仅支持list类型")
96 | except Exception as error:
97 | pass
98 | else:
99 | with open(name+'.plk','wb') as f:
100 | pickle.dump(mdict,f)
101 |
102 | def addWeight(emdict):
103 | """
104 | 为生成的用户词典增加权重(jieba词库分词需要)
105 | :param emdict: 不带权重的词列表
106 | :return: 带有权重的词列表
107 | """
108 | global __jieba_weight
109 | return list(map(lambda word:str(word)+" "+str(__jieba_weight),emdict))
110 |
111 | # 主函数
112 | def main():
113 | pos_dict, neg_dict = collectEmotionWord(posdict_path=__posdict_path, negdict_path=__negdict_path) # 积极和消极词典
114 | pos_w_dict, neg_w_dict = addWeight(pos_dict), addWeight(neg_dict) # 带有权重的积极和消极词典
115 | stop_dict = collectStopWord(__stopdict_path, pos_dict, neg_dict) # 停用词典
116 | savePickle(stopword = stop_dict,negword = neg_dict,posword = pos_dict)
117 | saveDict(userdict=pos_w_dict + neg_w_dict, stopword=stop_dict)
118 |
119 | if __name__=='__main__':
120 | main()
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/material/NTUSD_simplified/NTUSD_negative_simplified.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/data/emdict/material/NTUSD_simplified/NTUSD_negative_simplified.txt
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/material/NTUSD_simplified/NTUSD_positive_simplified.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/data/emdict/material/NTUSD_simplified/NTUSD_positive_simplified.txt
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/material/__pycache__/emotion_word.cpython-36.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/data/emdict/material/__pycache__/emotion_word.cpython-36.pyc
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/material/台湾大学NTUSD - 简体中文情感极性词典.rar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/data/emdict/material/台湾大学NTUSD - 简体中文情感极性词典.rar
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/negword.plk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/data/emdict/negword.plk
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/posword.plk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/data/emdict/posword.plk
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/stopword:
--------------------------------------------------------------------------------
1 | 不若
2 | 引起
3 | 尔等
4 | 急升
5 | 原来
6 | 距
7 | 默默地
8 | 大多
9 | 【
10 | 继而
11 | 自后
12 | 甭
13 | 这儿
14 | 概
15 | 简直
16 | 即如
17 | 全都
18 | 彼
19 | 更大
20 | 看来
21 | '
22 | 不变
23 | .一
24 | 境外机构
25 | 日渐
26 | 不外乎
27 | 沪股
28 | ′|
29 | 大凡
30 | 连
31 | 表示
32 | 以为
33 | 有时
34 | 哪怕
35 | 在于
36 | ——
37 | 另方面
38 | 维持
39 | 大批
40 | 分别
41 | 每当
42 | 组成
43 | 屡次
44 | 加入
45 | 尽量
46 | 某个
47 | 她是
48 | 不然的话
49 | 究竟
50 | 不光
51 | 局外
52 | 即若
53 | 多数
54 | 财报
55 | 不敢
56 | ”,
57 | 尽早
58 | 连袂
59 | 一般
60 | 他
61 | +
62 | 不料
63 | 他是
64 | 大概
65 | 它的
66 | 香港文汇报
67 | 方
68 | 一片
69 | 成年累月
70 | 自从
71 | 介于
72 | 惯常
73 | 请勿
74 | 要不然
75 | 就要
76 | 随
77 | 充其极
78 | 大略
79 | 资本市场
80 | 忽然
81 | 近年来
82 | 处理
83 | 互
84 | 乃至
85 | 一何
86 | 吱
87 | 不至于
88 | 比
89 | 况且
90 | 互联网金融
91 | ②
92 | 至若
93 | 因
94 | 叮当
95 | 新盘
96 | 且
97 | 〔
98 | 正值
99 | 这就是说
100 | 倍加
101 | 刚才
102 | 好象
103 | 双方
104 | 从新
105 | 什麽
106 | 到
107 | 就地
108 | 比如说
109 | 然后
110 | 就是说
111 | 几经
112 | 及
113 | 自个儿
114 | 过于
115 | 余外
116 | //
117 | 总的来说
118 | ”
119 | 临到
120 | ×
121 | 起初
122 | 得
123 | 大举
124 | 大牛
125 | 云尔
126 | 的话
127 | 莫
128 | 反映
129 | 千万千万
130 | >>
131 | [
132 | ∪φ∈
133 | 当儿
134 | 腾
135 | 今
136 | 凭借
137 | 上来
138 | 大事
139 | 反应
140 | 任
141 | 连连
142 | 另一个
143 | 将要
144 | 关于
145 | 都
146 | 若夫
147 | 多次
148 | 》),
149 | 此外
150 | 资产负债表
151 | 倘或
152 | 保管
153 | 些
154 | 并且
155 | 跟
156 | 倘若
157 | 少数
158 | 别人
159 | 为此
160 | 」
161 | 不特
162 | 构成
163 | 自各儿
164 | 打开天窗说亮话
165 | 一直
166 | 金融改革
167 | 至于
168 | ~
169 | 一
170 | 打从
171 | 就此
172 | 扑通
173 | 当即
174 | 可是
175 | 大
176 | 立地
177 | 特殊
178 | 较比
179 | 哩
180 | 再则
181 | 常
182 | 0
183 | 把
184 | 从速
185 | 纵
186 | 既然
187 | 以免
188 | 具体说来
189 | 多多少少
190 | 个人
191 | 从事
192 | 至
193 | 出去
194 | 吧
195 | 先生
196 | 赶早不赶晚
197 | 那边
198 | 莫不
199 | 则甚
200 | 这么样
201 | 半
202 | 那么些
203 | 惟其
204 | 并
205 | 别
206 | 缕缕
207 | 里面
208 | 甚么
209 | 趁
210 | 采取
211 | 以下
212 | 以至
213 | 一番
214 | ⑥
215 | 尽快
216 | ■
217 | 联袂
218 | 别的
219 | 不怎么
220 | 两者
221 | 连日来
222 | 二来
223 | 财华智库网
224 | 深入
225 | 是不是
226 | 不由得
227 | 4
228 | 对待
229 | 遵循
230 | 莫非
231 | 成心
232 | 周围
233 | 深股
234 | 总的说来
235 | 依照
236 | 继之
237 | 权时
238 | 自家
239 | 一方面
240 | 这点
241 | 姑且
242 | 为主
243 | 和
244 | 大量
245 | 迄
246 | 第二
247 | 中国证券报
248 | 她的
249 | 普遍
250 | 叫做
251 | 有关
252 | =
253 | 到处
254 | 岂止
255 | 认为
256 | 仍然
257 | 中间
258 | 谁人
259 | |
260 | 多多
261 | 看样子
262 | 互相
263 | 切切
264 | Δ
265 | 奈
266 | 连日
267 | 不论
268 | 从此
269 | ③
270 | 因着
271 | 然後
272 | 决非
273 | 犹且
274 | 极大
275 | 甚至于
276 | 诸
277 | 朝着
278 | 意思
279 | 、
280 | 达旦
281 | 乘虚
282 | 大面儿上
283 | 再次
284 | 那麽
285 | 全然
286 | 依靠
287 | …………………………………………………③
288 | ③]
289 | 下面
290 | 怎麽
291 | 这边
292 | 得出
293 | 般的
294 | 除外
295 | 打
296 | 而已
297 | 用
298 | 除开
299 | 如其
300 | 中国证券
301 | 牛熊
302 | 出现
303 | 不必
304 | 尔尔
305 | 得起
306 | 不然
307 | 为什麽
308 | 不
309 | 喂
310 | 譬如
311 | 这么点儿
312 | 行动
313 | 没奈何
314 | 其中
315 | 同
316 | 贼死
317 | 皆可
318 | 造成
319 | 相对而言
320 | 我的
321 | 自己
322 | 遭到
323 | 亦
324 | 接著
325 | 为什么
326 | 已矣
327 | }
328 | 前此
329 | 借此
330 | 目前
331 | 着呢
332 | 瑟瑟
333 | 切
334 | 这时
335 | 如常
336 | 看见
337 | 立马
338 | 矣哉
339 | 召开
340 | 拿
341 | 任务
342 | 譬喻
343 | 可以
344 | 自
345 | 光是
346 | 除此
347 | 挨个
348 | 之前
349 | 彻夜
350 | 微信
351 | 待
352 | 宁肯
353 | 以外
354 | 重新
355 | 毕竟
356 | 凭
357 | 因而
358 | 此中
359 | 乐视
360 | 觉得
361 | 甚且
362 | 强调
363 | *
364 | 趁热
365 | 今後
366 | 故而
367 | 本地
368 | 赶快
369 | γ
370 | 牛证
371 | 嘻
372 | 主张
373 | 上去
374 | 接连不断
375 | ......
376 | 从今以后
377 | 以前
378 | 设若
379 | 顿时
380 | 8
381 | 与否
382 | 平均市盈率
383 | 待到
384 | 怎么
385 | 不独
386 | 内地投资者
387 | 由是
388 | 还是
389 | 尽管
390 | 颇
391 | 川普
392 | 难怪
393 | ′∈
394 | 日股
395 | 充其量
396 | 呕
397 | 大大
398 | 在
399 | 及至
400 | 从中
401 | 且说
402 | 唯有
403 | 汝
404 | 非独
405 | 熊证
406 | 各地
407 | 又
408 | 不止一次
409 | 反倒
410 | 常常
411 | 难说
412 | 市场人士
413 | 不久
414 | 趁势
415 | 是否
416 | 己
417 | 于是
418 | 】
419 | 累年
420 | 当着
421 | 好的
422 | 总之
423 | %
424 | 之
425 | 替代
426 | 产生
427 | 如
428 | 与其说
429 | 具有
430 | 此次
431 | “
432 | 但是
433 | 元/吨
434 | 部分
435 | 凡
436 | 边
437 | 举凡
438 | 凡是
439 | 极其
440 | 对
441 | 否则
442 | 第
443 | 固然
444 | 乒
445 | 咱们
446 | 这些
447 | 总的来看
448 | 普通
449 | 相同
450 | 理当
451 | 独自
452 | 亲口
453 | 着
454 | 方面
455 | φ
456 | 哪天
457 | 多亏
458 | 然
459 | "
460 | 那
461 | 比起
462 | 末##末
463 | 切不可
464 | 何
465 | 眨眼
466 | 不止
467 | 谁料
468 | 上面
469 | 哪边
470 | 继后
471 | 对于
472 | 能否
473 | 要么
474 | 哪儿
475 | 无论
476 | 于
477 | 您们
478 | 如何
479 | 欧股
480 | 不怕
481 | 当前
482 | 资金净流
483 | 竟而
484 | 成年
485 | 必然
486 | 处在
487 | 具体地说
488 | 不常
489 | 啪达
490 | 退市制度
491 | 嗬
492 | 可好
493 | (
494 | 另行
495 | 仍旧
496 | 形成
497 | 矣乎
498 | 交口
499 | 进入
500 | 日见
501 | 理应
502 | 诚然
503 | 基金管理人
504 | 后面
505 | 不仅仅
506 | 当头
507 | 莫不然
508 | 这般
509 | 趁机
510 | 挨次
511 | 那里
512 | 基于
513 | 简言之
514 | 有
515 | 该当
516 | ②c
517 | 必将
518 | 3
519 | .日
520 | 仅仅
521 | 冲
522 | 行为
523 | 嘎登
524 | 还要
525 | 三天两头
526 | 不迭
527 | .数
528 | 扩大
529 | 曾
530 | 所
531 | 今天
532 | 要不是
533 | 本着
534 | 使用
535 | 其一
536 | 照
537 | 出
538 | φ.
539 | 恍然
540 | 为何
541 | 全体
542 | 属于
543 | 不单
544 | 移动互联网
545 | 练习
546 | 截至
547 | 忽地
548 | 富力
549 | 不尽然
550 | 责任公司
551 | 之所以
552 | 纵令
553 | 这一来
554 | 动辄
555 | 而后
556 | 难得
557 | 针对
558 | 从古至今
559 | 怎么样
560 | 平素
561 | 联系
562 | 尚且
563 | 随时
564 | 来自
565 | 一次
566 | 亲手
567 | 既
568 | 省得
569 | 曾经
570 | 吗
571 | 轰然
572 | 呐
573 | 往往
574 | 既是
575 | 你
576 | 连声
577 | 基本上
578 | 恰似
579 | 与
580 | 鄙人
581 | 任凭
582 | 保持
583 | 遇到
584 | 巴巴
585 | 倘然
586 | 你的
587 | 只是
588 | 大约
589 | 临
590 | 后者
591 | 呀
592 | 今后
593 | 先後
594 | 借以
595 | 来讲
596 | 以致
597 | 但
598 | 如下
599 | 做到
600 | 为
601 | 恒大
602 | 我
603 | 偶而
604 | 绝非
605 | 儿
606 | 赶
607 | 还
608 | 最近
609 | 反倒是
610 | 既往
611 | 除此之外
612 | 才
613 | 便于
614 | 随后
615 | A
616 | 挨着
617 | 截然
618 | 略微
619 | ……
620 | 前面
621 | 按
622 | 以后
623 | 兮
624 | 云云
625 | 要不
626 | 匆匆
627 | 全部
628 | 同样
629 | 要是
630 | 转变
631 | 归根到底
632 | 左右
633 | 反而
634 | 带
635 | 若果
636 | 不能不
637 | 立时
638 | 差一点
639 | →
640 | 微博
641 | 6
642 | 由
643 | 数/
644 | ①
645 | 正巧
646 | 即是说
647 | 开始
648 | 谁知
649 | 结构性产品
650 | 呢
651 | 时候
652 | 且不说
653 | 咳
654 | 个
655 | 长期以来
656 | 基本
657 | 逐渐
658 | 那些
659 | 似的
660 | 只
661 | 公开发行股
662 | 庶几
663 | 沿
664 | 它
665 | 而论
666 | 加之
667 | 以便
668 | 何须
669 | 内地投资
670 | 给
671 | 哼唷
672 | 非得
673 | 虽说
674 | 规定
675 | 初
676 | 当口儿
677 | 趁早
678 | 另外
679 | 弹指之间
680 | 很少
681 | 孰料
682 | 一旦
683 | 以及
684 | 据我所知
685 | 比及
686 | 如上
687 | 研究中心
688 | 挨门逐户
689 | 一.
690 | 每个
691 | 人家
692 | 慢说
693 | 得了
694 | 2
695 | 很
696 | 除此而外
697 | 归根结底
698 | 单单
699 | 几乎
700 | 是
701 | 正如
702 | 就是
703 | 欤
704 | 嗯
705 | 您
706 | 傥然
707 | 其他
708 | 不日
709 | 尔后
710 | 再有
711 | 并没有
712 | 并无
713 | 鉴于
714 | 甚至
715 | 下去
716 | 其后
717 | ⑩
718 | 默然
719 | 顷刻之间
720 | 庶乎
721 | 一则通过
722 | 呃
723 | 不惟
724 | 按理
725 | &
726 | 尽管如此
727 | 结果
728 | 分期
729 | 具体
730 | 非常
731 | 在下
732 | 心里
733 | 整个
734 | 必定
735 | 用来
736 | 各种
737 | 几时
738 | 归
739 | 本人
740 | 必须
741 | ..
742 | 若
743 | 现代
744 | 随着
745 | _
746 | 为止
747 | 大多数
748 | sup
749 | 起先
750 | 怎奈
751 | 〕
752 | 哼
753 | 附近
754 | 彼此
755 | 碰巧
756 | 决不
757 | ]
758 | 根据
759 | 仍
760 | `
761 | 除了
762 | ...................
763 | 乘隙
764 | 因了
765 | --
766 | 假使
767 | 的
768 | 一切
769 | 恰巧
770 | 转贴
771 | 有所
772 | 只消
773 | 就算
774 | 乘势
775 | :
776 | 一一
777 | 其它
778 | 像
779 | 大体
780 | 越是
781 | 勃然
782 | 遵照
783 | 通常
784 | 诸如
785 | 以来
786 | 如若
787 | $
788 | 见
789 | 梆
790 | 几番
791 | 不得不
792 | 上
793 | 叮咚
794 | 高管
795 | 甫
796 | 取得
797 | 再者
798 | 内
799 | 更为
800 | 特别是
801 | 近
802 | 如是
803 | 而
804 | 各位
805 | 归齐
806 | 及时
807 | 移动
808 | 之後
809 | 〈
810 | 你们
811 | ~~~~
812 | 呼哧
813 | 所幸
814 | 并不
815 | 沙沙
816 | 同时
817 | 非特
818 | 阿
819 | 也是
820 | 有的是
821 | 朝
822 | 别管
823 | 许多
824 | 它们
825 | 趁着
826 | 即或
827 | 立刻
828 | 偶尔
829 | 只有
830 | 但凡
831 | 〕〔
832 | 再者说
833 | 近几年来
834 | 共同
835 | —
836 | 略加
837 | 不只
838 | 那个
839 | 别是
840 | 穷年累月
841 | 论
842 | 何时
843 | 广泛
844 | 9
845 | 如前所述
846 | 哉
847 | 高低
848 | 彻底
849 | 向使
850 | 这么
851 | 香港证监会
852 | 换言之
853 | 转动
854 | 下来
855 | 直到
856 | 迫于
857 | 甚或
858 | 每时每刻
859 | 一边
860 | 顷刻
861 | 将近
862 | 做空
863 | Lex
864 | 即使
865 | 常言道
866 | 与其
867 | 共
868 | 陈年
869 | 不已
870 | 最大
871 | ,
872 | 咱
873 | 什么样
874 | 刚
875 | 最後
876 | 到底
877 | 那末
878 | 直接
879 | 而是
880 | 下列
881 | 房股
882 | 怎么办
883 | 今年
884 | 日益
885 | 到头
886 | 谨
887 | -
888 | 尔
889 | 基金经理人
890 | 加强
891 | 快要
892 | 这次
893 | 起见
894 | 砰
895 | 去
896 | 当时
897 | 彼时
898 | ./
899 | 一样
900 | 类如
901 | 不一
902 | 说来
903 | 饱
904 | 应当
905 | 如此
906 | 吧哒
907 | 等等
908 | /
909 | 有著
910 | 经
911 | 取道
912 | 别说
913 | 嗡
914 | 啐
915 | 简而言之
916 | 再
917 | 传闻
918 | 更加
919 | 进来
920 | 由于
921 | 连同
922 | 股神
923 | 人们
924 | 据说
925 | 顷刻间
926 | 恰如
927 | 啊
928 | 以故
929 | 并排
930 | 能够
931 | 如此等等
932 | 甚而
933 | 上述
934 | 旁人
935 | 假如
936 | 而言
937 | 看到
938 | 理该
939 | 逐步
940 | 来
941 | 吓
942 | 唉
943 | 』
944 | >
945 | 虽
946 | 万一
947 | 有的
948 | 他们
949 | 恰逢
950 | 起来
951 | 其
952 | 大致
953 | 公募基金
954 | 路经
955 | 即刻
956 | 诚如
957 | 加上
958 | 开外
959 | 正是
960 | 她
961 | 那么样
962 | 拦腰
963 | 此处
964 | 立即
965 | 猛然间
966 | ⑨
967 | 果然
968 | 看
969 | 哪些
970 | 致
971 | 比较
972 | 屡屡
973 | 另一方面
974 | 啷当
975 | 出于
976 | 嘿
977 | 从早到晚
978 | 哎
979 | Ψ
980 | 为着
981 | 倘使
982 | 大力
983 | 矣
984 | 放量
985 | 恰恰相反
986 | 也罢
987 | 据
988 | 岂但
989 | 那般
990 | 台股
991 | 哪样
992 | 总是
993 | ㈧
994 | 挨门挨户
995 | 啊哈
996 | 与此同时
997 | 则
998 | 先后
999 | 再说
1000 | 刚巧
1001 | )
1002 | 争取
1003 | 每
1004 | 顺着
1005 | 乘机
1006 | 挨家挨户
1007 | 较之
1008 | ;
1009 | 虽则
1010 | 起
1011 | 三番两次
1012 | 一起
1013 | 後面
1014 | 虽然
1015 | 长此下去
1016 | 无宁
1017 | 从小
1018 | 後来
1019 | 没
1020 | 沽空
1021 | 存在
1022 | 除
1023 | 起首
1024 | 等
1025 | 国企指数
1026 | 来得及
1027 | 当场
1028 | 孰知
1029 | 这麽
1030 | 应用
1031 | 哪个
1032 | 大张旗鼓
1033 | 啥
1034 | ④
1035 | 当下
1036 | 结合
1037 | 美股
1038 | 本身
1039 | 任何
1040 | 不可开交
1041 | 如果
1042 | 有些
1043 | 更
1044 | 从此以后
1045 | 到目前为止
1046 | 何以
1047 | 特点
1048 | 每年
1049 | 照着
1050 | 反过来说
1051 | 不可抗拒
1052 | 一转眼
1053 | 先不先
1054 | 此后
1055 | !
1056 | 即
1057 | 串行
1058 | 经过
1059 | 表明
1060 | 莫如
1061 | 岂
1062 | 从未
1063 | 几度
1064 | 倒是
1065 | 中小
1066 | 会
1067 | 除此以外
1068 | 后来
1069 | 到了儿
1070 | 却不
1071 | 人
1072 | 常言说得好
1073 | 川流不息
1074 | 不仅仅是
1075 | 使
1076 | 由此
1077 | 个别
1078 | 一则
1079 | 认识
1080 | В
1081 | 犹自
1082 | μ
1083 | 或则
1084 | 来说
1085 | 某些
1086 | 一下
1087 | 1
1088 | ‘
1089 | 诸位
1090 | 不消
1091 | 証券
1092 | 累次
1093 | 哦
1094 | 将才
1095 | 依
1096 | 向
1097 | 反之
1098 | 其次
1099 | 咋
1100 | 不拘
1101 | 往
1102 | 间或
1103 | 来不及
1104 | ?
1105 | 当庭
1106 | ...
1107 | 难道说
1108 | 等到
1109 | 中国人寿
1110 | 范围
1111 | 立
1112 | 或曰
1113 | 哪年
1114 | 已经
1115 | 来着
1116 | 嗳
1117 | 切勿
1118 | 所有
1119 | 莫若
1120 | 具体来说
1121 | 那儿
1122 | 方能
1123 | 多么
1124 | 哎哟
1125 | 极了
1126 | 并非
1127 | 〉
1128 | 或是
1129 | 沿着
1130 | 喏
1131 | 屡次三番
1132 | 《
1133 | 始而
1134 | 千
1135 | 那么
1136 | 乘
1137 | ∈[
1138 | 乃
1139 | 各级
1140 | 大不了
1141 | 也
1142 | 次第
1143 | 好在
1144 | 过来
1145 | 万
1146 | 顶多
1147 | 说说
1148 | 总而言之
1149 | 您是
1150 | 日复一日
1151 | 故
1152 | 常言说
1153 | 紧接着
1154 | 传说
1155 | 只当
1156 | 变成
1157 | 近来
1158 | 哪
1159 | ℃
1160 | 设使
1161 | 分头
1162 | 毫无例外
1163 | 宣布
1164 | 看起来
1165 | 藉以
1166 | 急匆匆
1167 | 凑巧
1168 | 过去
1169 | 因为
1170 | 者
1171 | 比如
1172 | 然而
1173 | 嘎嘎
1174 | 各
1175 | ^
1176 | 接着
1177 | 设或
1178 | 进而
1179 | 有及
1180 | 不同
1181 | ≈
1182 | 离
1183 | 切莫
1184 | 古来
1185 | 亲身
1186 | 依据
1187 | 之类
1188 | 私募基金
1189 | 即将
1190 | 难道
1191 | 企图
1192 | 比方
1193 | 略为
1194 | 迟早
1195 | 呆呆地
1196 | 俺
1197 | 八成
1198 | exp
1199 | 策略地
1200 | 后
1201 | 从
1202 | 假若
1203 | 如上所述
1204 | 它们的
1205 | 日臻
1206 | 逢
1207 | 看出
1208 | 既...又
1209 | 趁便
1210 | ://
1211 | 何乐而不为
1212 | 方才
1213 | 历
1214 | 恰恰
1215 | 全年
1216 | 加以
1217 | 此时
1218 | 屡
1219 | 而且
1220 | 哇
1221 | 大家
1222 | 不妨
1223 | ⑧
1224 | 而又
1225 | 我们
1226 | 借
1227 | 看上去
1228 | 一时
1229 | 那样
1230 | 们
1231 | ×××
1232 | 一天
1233 | @
1234 | 一个
1235 | 。
1236 | 接下来
1237 | 相对
1238 | 果真
1239 | 这里
1240 | 固
1241 | 从优
1242 | 你是
1243 | 以
1244 | 因此
1245 | 够瞧的
1246 | 传
1247 | 敢情
1248 | 相似
1249 | 反过来
1250 | 其余
1251 | 然则
1252 | 却
1253 | 除却
1254 | 不少
1255 | 来看
1256 | 即便
1257 | 各式
1258 | 亲眼
1259 | 必
1260 | 每逢
1261 | 已
1262 | 亿元人民币
1263 | 据悉
1264 | 作为
1265 | 反手
1266 | 亲自
1267 | 并肩
1268 | 喀
1269 | 还有
1270 | 由此可见
1271 | 大抵
1272 | 这么些
1273 | 呗
1274 | 是以
1275 | 分期分批
1276 | ———
1277 | 乌乎
1278 | 并不是
1279 | 之一
1280 | 》
1281 | 他人
1282 | 何止
1283 | 届时
1284 | 呵呵
1285 | 经常
1286 | 尤其
1287 | 代替
1288 | 综上所述
1289 | 马上
1290 | 不仅
1291 | 一些
1292 | 主要
1293 | 也就是说
1294 | 最后
1295 | 之后
1296 | 并没
1297 | 对应
1298 | 同一
1299 | 只要
1300 | 何处
1301 | 这会儿
1302 | 到头来
1303 | 嗡嗡
1304 | 被
1305 | 岂非
1306 | 反之亦然
1307 | 看看
1308 | 长话短说
1309 | 该
1310 | 只怕
1311 | 一来
1312 | 使得
1313 | 啊呀
1314 | 兼之
1315 | 纵然
1316 | 起头
1317 | 将
1318 | 上下
1319 | 自打
1320 | 证券交易所
1321 | 5
1322 | 据此
1323 | 继续
1324 | ──
1325 | 或
1326 | 或多或少
1327 | 乘胜
1328 | 从而
1329 | 那会儿
1330 | 让
1331 | 所以
1332 | 又及
1333 | ▲
1334 | 大都
1335 | 从不
1336 | 极为
1337 | 隔日
1338 | 哗啦
1339 | 可见
1340 | 比照
1341 | 这样
1342 | 若非
1343 | 从无到有
1344 | 进去
1345 | 共总
1346 | 纵使
1347 | <
1348 | 正在
1349 | 运用
1350 | 换句话说
1351 | 开展
1352 | 这种
1353 | 弗
1354 | 各个
1355 | 倍感
1356 | 较为
1357 | 千万
1358 | 例如
1359 | 伙同
1360 | 不曾
1361 | 股票型基金
1362 | 这个
1363 | 自身
1364 | 不外
1365 | 不问
1366 | 么
1367 | 反之则
1368 | 论说
1369 | 所在
1370 | 有着
1371 | 相应
1372 | 哪里
1373 | 种
1374 | 倘
1375 | 不再
1376 | 更进一步
1377 | 人民币汇率
1378 | 这
1379 | 当中
1380 | 人人
1381 | 喔唷
1382 | 某某
1383 | 呜
1384 | 竟
1385 | 处处
1386 | 市场流动性
1387 | 有点
1388 | 嘛
1389 | 年复一年
1390 | 就是了
1391 | 沽证
1392 | 不比
1393 | 如今
1394 | 此
1395 | 从古到今
1396 | 非但
1397 | 首先
1398 | .
1399 | 即令
1400 | 除非
1401 | 多少
1402 | ⑤
1403 | 喽
1404 | 啦
1405 | 随著
1406 | 极力
1407 | 若是
1408 | 哟
1409 | 抑或
1410 | 最
1411 | 乃至于
1412 | 以至于
1413 | 出来
1414 | 多
1415 | 如同
1416 | 律师事务所
1417 | 按照
1418 | 以上
1419 | 故此
1420 | 世纪经济报
1421 | 某
1422 | 不但
1423 | 地
1424 | 大体上
1425 | 话说
1426 | 除去
1427 | 敢于
1428 | 对方
1429 | 只限
1430 | 不时
1431 | 何况
1432 | 受到
1433 | 呸
1434 | 央企
1435 | 咧
1436 | 独
1437 | 叫
1438 | 绝顶
1439 | 它是
1440 | 每天
1441 | 怎
1442 | 各人
1443 | 此间
1444 | 于是乎
1445 | 靠
1446 | 另
1447 | 奇
1448 | 其二
1449 | #
1450 | 差不多
1451 | 尽然
1452 | ⑦
1453 | 几
1454 | 据称
1455 | 谁
1456 | 以後
1457 | 乎
1458 | 呜呼
1459 | …
1460 | 别处
1461 | 对比
1462 | 及其
1463 | 咦
1464 | 怪不得
1465 | 按说
1466 | sub
1467 | 广大
1468 | 各自
1469 | 哗
1470 | 毋宁
1471 | 什么
1472 | 我是
1473 | 了
1474 | ’
1475 | 总结
1476 | 抽冷子
1477 | 一面
1478 | 现在
1479 | 替
1480 | 再其次
1481 | 而况
1482 | 赖以
1483 | 前者
1484 | 多多益善
1485 | 房地产市场
1486 | ’‘
1487 | 7
1488 | 从头
1489 | 不经意
1490 | 咚
1491 | 隔夜
1492 | 俺们
1493 | 也好
1494 | 『
1495 | 至今
1496 | 或者
1497 | 当地
1498 | 此地
1499 | 每每
1500 | 她们
1501 | ↑
1502 | 呼啦
1503 | ·
1504 | ::
1505 | \
1506 | 非徒
1507 | 不过
1508 | 漫说
1509 | 无
1510 | 顷
1511 | 多年前
1512 | 如次
1513 | 从来
1514 | 真是
1515 | 应该
1516 | Ⅲ
1517 | 或许
1518 | 焉
1519 | 为了
1520 | 就
1521 | 三番五次
1522 | 而外
1523 | 多年来
1524 | 倒不如说
1525 | 十分
1526 | 不免
1527 | 较
1528 | 他的
1529 | 本
1530 | 另悉
1531 | 啊哟
1532 | 低开
1533 | 那时
1534 | 前后
1535 | 极
--------------------------------------------------------------------------------
/news-emotion-master/data/emdict/stopword.plk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/data/emdict/stopword.plk
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/README.md:
--------------------------------------------------------------------------------
1 | ### 用处
2 | > 存放训练集的文件夹
3 |
4 | ### 命名规则
5 | > 采用:`emotion_otherInfo`的命名。例如:`neg_1568_2017-6-9.txt` 、`neu_5963`。
6 |
7 | - 请采用`UTF-8`编码:尤其是针对图形文字,例如中文、日文等,保证兼容
8 | - 情感缩写:
9 | 情感 | 缩写
10 | - | -
11 | 积极 | pos
12 | 中性 | neu
13 | 消极 | neg
14 |
15 |
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2406_04_29.txt:
--------------------------------------------------------------------------------
1 | 据环球网29日消息,韩国外交部长官尹炳世、美国国务卿蒂勒森和日本外务大臣岸田文雄28日在美国纽约联合国总部举行韩美日外长会谈。三方在会谈上商定,将进一步加大对朝施压力度,强力应对来自朝鲜的核与导弹威胁。三国外长一致认为,通过采取强而有力的外交、军事行动,全力阻止朝鲜发起新一轮挑衅,如朝鲜再次发起挑衅,立即采取严厉的惩罚措施。更多精彩内容 请登陆财华智库网 (http://www.finet.com.cn) 财华香港网 (http://www.finet.hk)或现代电视 (http://www.fintv.com)
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2592_05_04.txt:
--------------------------------------------------------------------------------
1 | 《经济通通讯社4日专讯》美国联储局如预期维持利率不变,美元走强,国际金价跌至一个月低位。现货金盘中触及4月5日以来最低的1244﹒93美元。美国期金收跌0﹒7%,报1248﹒5美元。 A场黄金股跌,紫金矿业(02899)(沪:601899)A股跌1﹒2%,H股挫2﹒2%;湖南黄金(深:002155)挫3%,中金黄金(沪:600489)挫2﹒8%,赤峰黄金(沪:600988)挫2﹒4%。(vl)
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2593_05_04.txt:
--------------------------------------------------------------------------------
1 | 《经济通通讯社4日专讯》钢铁股个别发展,柳钢股份(沪:601003)升3﹒8%,河钢股份(深:000709)升2﹒3%,宝钢股份(沪:600019)跌近1%。 内地大宗商品期货早市初段急跌,其中铁矿石主力合约一度触及跌停。 重庆钢铁(01053)(沪:601005)决定终止重大资产重组,其H股现跌6﹒5%,报1﹒15港元,A股停牌。重钢将在召开投资者说明会后申请复牌;公司称,将继续围绕钢铁主业经营做好改善资本债务结构、降低生产成本等工作。(sc)
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2612_05_05.txt:
--------------------------------------------------------------------------------
1 | 井楠金融市场广州日报讯 (全媒体记者井楠)北京时间本周三到周四,美联储5月议息会议如期召开,如机构所料并没有加息。其在会后声明中表示,尽管美国第一季度经济指标不尽如人意,但美联储仍表示通胀已接近目标位,强调就业市场趋紧,暗示了可能会在6月份收紧货币政策,即加息。市场对此的理解是“态度偏向鹰派”。黄金4月涨幅被尽数回吐在此影响下,美元指数从周四凌晨开始攀升,至99.33;而以美元计算价格的避险资产——黄金却出现了最大为21美元/盎司的回调,瀑布式跳水,跌至1233美元/盎司的一个半月低位,4月涨幅被尽数回吐。现货白银更是下跌超过2%,跌至16.39美元/盎司的近四个月低位,并录得连续第12个交易日下挫,创下自2001年以来的最长下跌期。黄金市场的技术面与基本面均变得不利。技术面来看,昨日大跌后,金价已经跌穿了50和200日的移动均线,说明短期可能进一步下跌。基本面来看,美联储的货币政策有可能转向鹰派,加息预期将给金价带来巨大压力,而前期地缘政治动荡带来的避险需求高增,影响力已经有所减弱。金价是否会由此一蹶不振,仍需要观察,欧洲政治也是影响其价格走势的重要因素,目前不确定因素较多:美元虽然有所抬升,但没有迅速升破100大关,也有可能重回弱势。黑色系板块仍有续跌空间美联储会议对于原油与大宗商品市场也产生了利空影响,隔夜纽约油价继续下行,在48美元/桶以下位置波动,接近5个月新低。周四白天,原油、黄金均保持向下姿态。国内大宗商品市场周四开盘即暴跌,黑色系产品集体向下,4品种封底跌停。下午收盘,铁矿石、橡胶、热卷、甲醇期货的主力合约收于跌停,螺纹钢、焦煤、焦炭的单日下跌幅度超过了5.5%,沪镍、PVC的单日跌幅度超过4%,玻璃、沥青、沪铜的跌幅超过了3%。除了美联储鹰派言论带来的利空,产业链需求不足、供给依然较大、房产市场预期交易向下,也是大宗商品领头羊板块——黑色系产品连续下跌的重要原因。技术面来看,在连续下破重要技术关口后,黑色系产品已经进入了短线熊市,何时筑底仍不确定,仍有进一步下行空间。鉴于原油、黄金与大宗商品短线暴跌之后均前景不明,专业人士提醒散户投资者:抄底行为应谨慎。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2617_05_05.txt:
--------------------------------------------------------------------------------
1 | 本周三美国联准会的会后声明一如外界预期维持利率不变,但下个月升息1码的可能性再度提高,加上中国经济扩张态势恐放缓,预测美元走强机率增加,人民币偏向盘整趋贬,建议投资人以偏多策略操作大小美人。中国4月官方制造业与非制造业PMI双双回落,其中制造业PMI由51.8下降至51.2,非制造业PMI由55.1下降至54;而2日公布的财新中国制造业PMI亦由51.2下降至50.3,为去年10月以来最低,增速下滑走势也与官方数据相符。从以上数据显示,中国制造业与非制造业PMI数据,虽仍位于50荣枯线之上,但扩张态势放缓,恐让市场担忧中国经济增长所面临的下行压力。而本周三联准会结束为期两天的政策会议,一如外界所预期般维持利率不变,在会后声明中,联准会对美国第一季经济成长仅0.7%表示担忧,但认为该疲弱仅属暂时现象,决策委员预期在货币政策立场缓慢调整的情况下,美国经济活动将以温和速度扩张,劳工市场情况将进一步转强,中期而言,通货膨胀将持稳于2%。联准会声明公布后,美国公债殖利率同美元指数一并走高,市场预期联准会下个月升息1码的可能性,已由60%上升至75%。昨(4)日人民币最新中间价为6.8957,较3日下降0.0065,创4月12日以来新低,反应美元指数在联准会会议后转强的态势,加上中国第2季经济增长恐面临下行压力,以及联准会6月升息机率提升,进一步带动美元指数反弹转强预期下,人民币可能将往3月中间价高点6.9125修正。(永丰期货提供,涂忆君整理)
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2621_05_05.txt:
--------------------------------------------------------------------------------
1 | 国际金价在4月17日反弹至1297.4美元每盎司的年内高位后,随着法国大选避险情绪阶段性降温以及投资获利了结,黄金随后12个交易日回撤近4.5%至1240美元每盎司,目前进入震荡盘整期。当前市场环境下,黄金之所以能够成为投资的宠儿,主要受以下因素刺激:一是美国近期多项经济数据不及预期,使得美联储5月加息预期减弱,黄金的投资价值也在不断增加。二是受到美国空袭叙利亚、朝鲜半岛局部冲突风险提升、全球恐怖袭击升级等地缘政治的紧张加剧,黄金的避险价值开始受到市场资金的关注。三是全球经济复苏势头仍面临较大阻力,多个主要经济体的数据都不乐观,宽松的货币政策仍在全球范围内维持,且宽松程度需要加码的呼声也在不断增加,黄金的保值功能日益凸显。在种种因素的叠加下,彻底激活了市场对黄金的投资情绪。进入5、6月,由于美国现政策的不确定性、叙利亚和朝鲜局势仍未缓解、法国大选决胜局的不完全明朗、英国脱欧事件的持续发酵、市场对经济复苏的持续担忧以及美股屡创新高后的下跌风险,都将继续提振黄金的投资人气,预计金价后市将大概率继续震荡上行。工行账户贵金属财富管理新利器2017年,如果您看好黄金的投资机会,想要抓住这一市场机遇有所作为,不妨多关注工行账户贵金属产品。工行账户贵金属是工行为个人客户提供的,采取只计份额、不提取实物贵金属的方式,以人民币或美元买卖贵金属份额的投资交易产品。既可做多也可做空,交易方式灵活多样。是您进行价值投资、实现财富管理的利器。即日起至6月末,工行人民币黄金、白银交易点差低至0.1、0.008元/克,更多详情请关注工商银行官方网银。(本文不构成投资建议,相关产品信息、活动信息以工商银行官方网站公布的产品文件和活动公告为准。市场有风险,交易需谨慎。)(刘朋原)
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2625_05_05.txt:
--------------------------------------------------------------------------------
1 | ■本报见习记者 龚梦泽截至目前,国内上市航企2016年报已全部公布完毕。2016年被业界视作中国航空业盈利大年,处于十多年来低点的油价与不对冲航油成本的做法,推动航企净利润大幅增长。然而,在利润增长的同时,国内航企的负债规模也在迅速膨胀。《证券日报》记者根据同花顺数据统计,7家航企去年负债达到惊人的5576亿元,平均负债率为61%。其中,春秋航空、中国国航、南方航空和东方航空资产负债率超过60%,分别达到63%、66%、73%和76%。值得一提的是,与巨大负债相对应的是庞大的财务费用支出。最新数据显示,2017年一季度四家航空公司财务费用合计已超过230亿元,而同期归属于母公司股东的净利润合计仅67亿元。“为负债打工”成为了航空公司的常态。7家上市航企去年负债5576亿元《证券日报》记者根据同花顺数据统计,截至5月3日,已经发布2016年年报的7家上市航空公司负债达5576亿元,平均负债率为61%。目前,我国已形成了中央控股航空公司为第一梯队,地方航空公司为第二梯队,民营航空公司不断发展的竞争格局。具体来看,四大航空公司负债总额稳居前列,其中东方航空居首,达到1600亿元;中国国航、南方航空和海南航空分别为1477亿元、1458亿元和803亿元,同比分别增长1.2%、0.37%、6.62%和-7.54%;资产负债率方面,东方航空最高,达到76.15%,南方航空、中国国航和春秋航空分别为73%、66%和63%。事实上,国内航空公司的高负债并不是今年才有的情况,自从2014年以来,四大航空公司的负债总额一直都维持在5000亿元以上。记者通过翻查四大航空公司的财报发现,从2010年到2017年,四大航空公司的总负债增加了约1970亿元,平均每年增加330亿元。尽管各大航空公司实际上一直在努力降低负债水平,但普遍负债率依然高企。如果将四家公司当做一个整体计算,过去10年,航企负债率始终维持在70%以上,最高时甚至一度超过90%。有分析师对记者表示,国内航空公司目前多数还处于发展期,为了抢佔佔有率需要花费大量资本进行扩张。鉴于飞机等固定资产的折旧年限高,资产回报稳定,因此航空公司一般都会用飞机作为质押进行融资,从而导致国内航企普遍负债率高企。值得注意的是,海南航空是四家航企中唯一一家实现负债总计下降的航空公司。数据显示,海航集团整体年收入突破6000亿元,员工总人数超过41万人,而在快速发展的道路上,集团的资产负债率却实现“七连降”,其中旗下上市公司海南航空2016年的资产负债率为54%。记者了解到,海外并购是海航降成本的重要推手,一连串的海外并购由战略投资者、基金机构、信讬、银行等共同完成,借鉴了很多国际并购经验,并在一定程度上抵消了资产负债率的上升。上述人士还表示,各大公司的飞机储备会逐渐趋于饱和,随着飞机和基础设施的年限上升,以及公司发展扩张能量的下降,未来各大航空公司的负债率将会逐年下降。加速降低美元债事实上,航空业可以说是国内盈利受汇率因素影响最显著的行业之一。数据显示,沪深300指数包含的航空业上市公司,过去5年汇兑损益规模在全部300家公司中占比举足轻重。数据显示,2016年,由于四大航偿还了较多的美元负债,资产负债率和债务资本化比率分别为68.17%和56.65%,较2015年末分别下降5.15和7.42个百分点。根据国航年报显示,2016年公司一方面通过调整飞机引进模式,有效控制美元带息债务规模;另一方面积极调整债务币种结构,使公司美元带息债务规模及其比重显著下降。截至2016年末,中国国航美元债务占比为49.12%。南方航空则表示,因提前归还了18.37亿美元负债,其人民币融资比例由30.69%提高至51.16%;东方航空的美元债务占比也降低到了44.89%;海南航空截至2016年末的美元债务为282.5亿元,据此测算,其美元债务占比为35.19%。对此,业内人士向记者表示,航空企业拥有大量的美元债务,因此人民币汇率的变动对航企的盈利水平有较大影响。如果美联储加息的预期一旦确定,未提前锁定利率的美元负债势必面临利息增加的压力,彼时航企将不得不面临和汇率与利率的双重风险。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2635_05_05.txt:
--------------------------------------------------------------------------------
1 | 联储局一如市场所料维持利率不变,虽然第一季经济增长放缓,但议息声明称属短暂,暗示不会影响加息步伐,市场继续观望六月及九月加息机会较大。投资者可多加留意今日公布的失业率及非农就业职位变化,估计后者在没有异常天气影响下返回正常水平,约见17万个,料美汇短线在99水平徘徊。欧元区第一季度经济增长做好,支持欧元在近月高位徘徊,然而短线焦点落在周日法国大选上,料马克龙最终能胜出,但市场在初选后开始消化大选结果预期,估计欧元短线上升空间不多,料上试1.10后见调整。英国首相文翠珊正式解散议会并筹备大选,无进一步有关脱欧的消息下英镑在1.28至1.29区间整固。欧洲政治风险有所放缓,日圆回软,料美元兑日圆上试113.80,金价下试1,220美元。商品价格回落,尤其是黑色金属类别,拖累澳元及纽元走势,料分别下试,0.73及0.68。在美加贸易矛盾上,估计美元兑加元上试1.38。交通银行香港分行 袁沛仪
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2641_05_05.txt:
--------------------------------------------------------------------------------
1 | ☉记者 王宙洁美联储按兵不动美联储在北京时间周四凌晨宣布,维持联邦基金利率目标区间在0.75%至1%的水平不变,符合市场普遍预期。美联储在政策声明中还表示,消费者支出稳健、企业投资增加,且通胀接近美联储的目标水平,暗示暂时不会改变今年再加息两次的节奏。美联储今年3月宣布加息25个基点,并释放信号称考虑在今年稍晚开始缩减资产负债表。华盛顿邮报指出,大多数经济学家认为,经济数据的疲弱表现可能只是暂时性的。然而,如果一连串令人失望的数字继续出现,那么可能会说服美联储在经济进一步加强前暂缓加息。美联储强调说,加息步伐将取决于经济状况。但其他分析师警告说,提高利率太慢也会带来风险。如果美联储没有通过逐步提高利率来摆脱通货膨胀,那么这可能会使它在此后需要更快地加息,对企业和消费者而言这会带来不和谐的过渡。全球黄金需求量下滑世界黄金协会周四发布的报告显示,今年一季度,全球黄金需求量减少18%至1034.5吨,为2010年以来同期最低。各国央行对黄金的需求触及近6年最低,在一季度仅买入了76吨黄金,较上年同期减少约27%。此外,由于外界预期美联储可能最快于6月加息,美元指数一度在周四触及两周高点。当日,现货金价格盘中触及3月21日以来最低位1232.60美元。MarketWatch援引美国银行策略师的话分析说,尽管美国第一季度经济数据有所回落,美联储似乎仍将在2017年进一步加息两次并计划缩减资产负债表。实际利率上涨往往会降低持有黄金的机会成本,因为金属不会产生收益。较高的利率也可能提振美元的价值,这通常与黄金价格走势相反。波多黎各申请破产保护美国联邦领地波多黎各总督里卡多·罗塞略周三表示,已请求联邦监督委员会根据美国参议院去年通过的一项法案,对波多黎各债务进行重组并提供破产保护。由于美国政府原先对波多黎各提供的一些税收优惠政策到期终止,再加上全球金融危机的冲击,波多黎各经济持续多年衰退。当地政府常年靠大举发行市政债券来弥补财政缺口和提振经济,最后造成债务负担大幅攀升,目前高达700亿美元以上。路透社说,破产或许不会马上改变波多黎各民众的日常生活,但可能导致未来的退休金和职工福利被削减以及医疗和教育服务缩水。波多黎各有45%的人口生活贫困,近10年来经济处于衰退状态,失业率约为11%,过去10年来人口减少约一成。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neg_2667_05_05.txt:
--------------------------------------------------------------------------------
1 | 内地经济扩张速度放缓,加上金融严监管,流动性持续偏紧,股债商品期货齐挫,沪指连跌3日至3个半月新低。人民银行维持资金紧平衡,拆息继续全线上升。分析师指,在人民银行、中国银监会、中国证监会和中国保监会(一行三会)全面加强监管下,资金持续偏紧,大市反弹乏力,预计后市将延续反复走势。沪指昨小幅低开后反复波动,即市一度反弹0.2%,之后冲高回落,收报3127点,跌7点,跌幅0.3%,连跌3个交易日,为今年1月20日以来的3个半月新低;深证成指收报10147点,跌0.4%。两市成交合计4,531亿元(人民币,下同),较上日略有增加,其中沪市佔2,002亿元。雄安概念领涨 煤炭金属挫从盘面看,行业板块普遍下跌,航天航空、船舶制造、有色金属、煤炭等板块大跌,跌幅靠前;但水利建设、雄安概念、铁路基建、水泥建材、环保等板块逆市走强。展望后市,分析师指金融监管全面加强,资金持续撤离,经济增速预期放缓,短期后市将维持反复走势,但一带一路、雄安概念、国企混合制改革等板块将成市场反复炒作题材。在金融监管风暴下,国债期货昨高开后迅速掉头下行,午后跌幅扩大,最后全线大幅收跌。而商品期货昨日再掀跌停潮,黑色系集体重挫,铁矿石、橡胶、热卷、郑醇主力封住跌停。螺纹钢、焦炭收市均大跌逾6%,焦煤跌5.8%,沪镍跌4.4%。在金融监管风暴下,人民银行昨在公开市场进行500亿元逆回购,刚好对冲500亿元到期逆回购,实现零投放,维持市场资金紧平衡,加上周三到期的2,300亿元中期借贷便利(MLF)没有续做,上海银行间同业拆放利率(Shibor)继续全线上升,其中隔夜拆息升至2.8506厘,7天利率则升至2.927厘。传收紧IPO标准 当局否认针对市场关于新股首次新股发行(IPO)审核「内部标准」的3大传闻:要求企业上市辅导时间必须满18个月;主板中小板、创业板的盈利要求上调至5,000万和3,000万元;影视、传媒、娱乐(包括游戏)、文化和互联网企业原则上劝退。《上海证券报》昨引述关部门人士称,以上传闻均与事实不符,且相关部门并未对传闻所涉内容进行过修改研究。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_589528.txt:
--------------------------------------------------------------------------------
1 | 信息时报讯 据外汇管理局网站数据,合格境外机构投资者(QFII)投资额度审批情况表显示,截至7月31日,累计批准QFII额度为932.74亿美元。上月末,为927.74亿美元。数据还显示,中国7月末合格境内机构投资者(QDII) 获批额度为899.93亿美元。人民币合格境外机构投资者(RQFII)投资额度获批5482.41亿元人民币。据证券时报网
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_589538.txt:
--------------------------------------------------------------------------------
1 | □本报记者 官平“客户体验就是感觉麻烦,不管个人投资者还是法人户,都觉得麻烦,但没办法,合规是第一位的。 ” 7月31日,华东地区一家大型期货公司客户服务负责人表示,投资者适当性新规给客户和工作人员带来的最直接观感就是“比以前麻烦” 。7月1日正式实施的 《证券期货投资者适当性管理办法》已“满月” 。 中国证券报记者调研多家证券期货经营机构发现, 由于投资者、资管产品分类标准以及风控标准比以往更严格,除了反馈客户体验不佳外,新规还暂时 性造成部分公司客户权益下降、资管产品发行降速等。知情人士透露,监管层已经启动对期货公司落实投资者适当性制度,督促公司依法合规经营专项检查,预计陆续会启动对证券、基金及相关资管机构的检查。“按规矩办事”“目前来看, 只能把客户体验先放一放,宁愿流失客户,也不能违规。 ” 上述期货公司客户服务负责人表示。她透露,自然人客户以前习惯了互联网开户,但现在由于投资者适当性新规,监控中心系统没准备好,期货公司又不能单独建系统,所以客户开户受地域的限制较多,而且开户流程拉长,时耗增加。中国证券报记者还从一些券商处了解到,由于新系统运行还不稳定,公司的一些员工对客户分类以及相关资管产品分类的流程还不熟悉,不少投资者在券商处进行双录时,反馈体验感差,对双录的配合度比较低,部分投资者更是由于比较复杂的流程而取消业务办理。“客户不配合也没办法, 只能按规矩办事。 ” 上海一家券商机构人士说,客户的大多数反馈是麻烦, 就是办理业务的时间很长,加上双录环节后,平均每个业务的办理时间基本在20分钟以上。双录就是录音、录像,主要针对客户办理业务的过程, 特别是风险揭示的过程进行留痕,规范金融企业的销售行为,同时也为事后产生争议时提供依据。虽然给投资者及机构工作人员 “添麻烦” ,但业内人士表示,双录也是约束销售人员行为,规范业务办理流程,避免销售人员弱化或隐瞒风险、夸大产品收益,有利于经营机构的内部管理。 对投资人来说,也可以详细地了解产品信息、 风险等级及自己的权利责任,保障自身的合法权益。“比如买基金产品, 以前办理业务5分钟左右,填一下单子即可。 ” 上述券商人士表示。据了解,需要在营业网点进行双录的情形比较普遍, 比如普通投资者申请成为专业投资者,向普通投资者销售高风险产品或者提供相关服务,主动调整投资者分类、产品或者服务分级以及适当性匹配意见,向普通投资者销售产品或者提供服务等。新系统尚需调整完善“如果确实有客户不配合的话,我们只能合规优先,这一块我们公司管理和要求非常严格。 ” 上海一家期货公司负责人表示,目前公司严格执行投资者适当性新规,虽然遇到客户反馈麻烦的问题,但也都知道,这是为了双方好,避免未来产生更大的风险问题。不过,记者也了解到,一些券商营业部因为工作量大增, 部分工作人员鼓励投资者自己用手机办理业务, 以免因双录带来麻烦的情况。另外,对基金公司而言,尽管较少需要直接给投资者进行双录,但同样有“麻烦”需要面对。 目前,一些基金公司还在进行系统的调试, 部分基金公司至今还未上线新系统。业内人士透露,6月28日才提出可以新老划断,而在这之前所有基金公司都是按照全都要重来的规则进行系统改造的,6个月缓冲期也是新提出的,所以此前准备好的新系统还需要重新调整。而很多基金公司的系统都不是自己开发的,需要开发商来进行调整,所以进展更慢。上述期货公司客户服务负责人则透露,期货公司互联网开户只能用监控中心的系统,但监控中心系统还没出来,投资者适当性新规实施后, 目前阶段对期货公司和客户都很麻烦,行业内一些公司仍用现有的互联网开户系统是有问题的。利在长远中国证券市场起步伊始就是一个以个人普通投资者为主体的市场。如何从实际出发,逐步建立起有中国特色的投资者适当性制度, 是从根本上保护投资者,尤其是中小投资者的重要举措。7月28日,证监会新闻发言人常德鹏在例行新闻发布会上透露,证监会近期组织开展了2017年期货公司专项检查。 此次检查共涉及24个辖区、32家期货公司及其分支机构,旨在督促期货公司切实落实投资者适当性管理要求,保护中小投资者合法权益。上海一家券商资管机构相关负责人表示,新规实施后,各业务条线在人员配备、系统投入等方面进行了充分的资源调配,认真贯彻执行新的制度流程。新规更加优化了产品风险等级划分时的考虑因素,从严规范了经营机构的销售行为,会增加一定的管理成本。但是,从长远看这会对券商资管的产品设计、市场营销和经营理念等产生积极影响,带来长期利益。上海一家券商负责人对中国证券报记者表示, 预计下半年严监管的趋势将进一步延续,金融监管的专业性、统一性和穿透性将显 着加强,综合监管时代来临。 证券公司需要保持合规风控的战略定力,积极推动合规风控向行为自律、文化自觉转变,从“要我合规风控”转为“我要合规风控” ,同时要提升合规风控能力,加强风险源头管控,抓住关键环节,防范化解重点领域风险,着力加强推行风险预警管理、事中事后管理,强化自律管理和一线风控。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591877.txt:
--------------------------------------------------------------------------------
1 | ☉记者 张忆 ○编辑 弘文上证报记者获悉,昨日,“燧石星火”台湾学生创业夏令营在深交所正式启动。据介绍,本次夏令营为期3周,共接收64名台湾大学本科及硕士在校生,活动包括创业项目设计、模拟路演、企业走访、青年交流等。广东省台办、深圳市台办相关负责人及深交所监事长杨志华出席了本次开营仪式。杨志华在致辞中指出,当前,大陆深化供给侧结构性改革,推动创新驱动发展,呈现出良好开放的创业氛围,为台湾青年提供了实现抱负的机会和舞台。深交所以支持创业创新为己任,努力打造创新资本形成中心,希望通过支持台湾青年了解大陆经济发展,参与大陆创业创新,为推动两岸创新经济融合发展作出贡献。市场人士认为,开展“燧石星火”台湾学生创业夏令营活动,有助于增进两岸民间交往,深化两岸教育合作、推进两岸金融交流,孕育青年创业创新火种。深交所相关负责人表示,在全力办好本届夏令营的基础上,深交所还将为台湾青年提供更多的实习交流机会,不断完善助力台湾青年成长发展的创业金融支持平台。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591904.txt:
--------------------------------------------------------------------------------
1 | ☉记者 吴正懿 ○编辑 孙放规范和支持上市公司并购重组——这是在上周召开的全国证券期货监管系统年中监管工作座谈会上,监管层对于并购重组监管工作所给出的权威定调。而据上证报记者的最新统计,近期上市公司并购重组(发行股份购买资产)的过会数量,环比已呈明显增长之势。同时,具有标杆意义的重磅个案也在频频出现。市场层面的信号不断,来自上市公司的信号也不可不察。上市公司的航船要驶过深海和浅滩,实现转型和跨越,自然离不开熟知资本航路的舵手。记者解析A股公司“权力交接”的轨迹发现,自2015年以来,至少有70家上市公司的董事长或总经理职位,换由具有金融或投资背景的“实权派”掌权,以引领公司转型升级。在A股资本意识觉醒的时代,这些拥有丰富投资与运营经验的掌舵者,以其在资本运作方面的独特优势,着力打造上市公司的未来,投射出A股市场产业与金融的环境变迁。易主公司的“空降兵”上证报资讯统计显示,剔除国企人事任免、家族企业权力交接等情况,并刨除金融类上市公司后,2015年以来,至少70家上市公司“空降”具有金融背景的董事长或总经理据记者统计,5至7月的重组过会数为28例,包括已实施的3例。而今年1至4月,过会数为25例,即最近三个月的过会案例数已超过此前四个月的数量。从个案看,自6月初ST云维公告借壳方案,到最近又先后有通达动力、江粉磁材披露借壳案,具有标杆意义的案例也在频频出现。可见,并购重组已渐呈回暖之势。另一方面,一个颇值得观察的现象是:近年来,随着经济结构转型升级,产业及资本深度融合,A股公司群体发生了深刻的产业变迁,掀起波澜壮阔的重组及卖壳浪潮。与此相伴的是,A股数百家公司董事长或总经理发生更迭,且不少新上位的掌舵者具有金融或投资背景。7月5日,金字火腿发布公告,禹勃当选为公司第四届董事会董事长,并获聘为公司总裁。公开资料显示,禹勃系中钰资本的董事长、合伙人、总经理。中钰资本专注大健康产业,着力打造中钰医生集团、医疗实业平台、产业投资基金等三大平台。去年,金字火腿通过受让及参与增资,累计耗资约6亿元控制了中钰资本51%股权,形成了火腿及肉制品、医疗大健康的双主业格局。金字火腿创始人施延军“让贤”禹勃,投射出公司产业转型的决心与重心。这并非孤例。上证报资讯统计显示,剔除国企人事任免、家族企业权力交接等情况,并刨除金融类上市公司后,2015年以来,至少70家上市公司获得具有金融背景的董事长或总经理,其最大的共性是这些公司正面临产业升级与业务重构。具体来看,这些“空降”的掌舵者可分为三类:一是,投资型公司入主上市公司后,新的实际控制人亲自出任董事长;二是,投资型公司买壳之后,实际控制人并不出面,而是派出专业投资人士出任董事长;三是,处于特殊时期的上市公司,专门聘请具有金融或投行背景的专业人士出任董事长。易主后名正言顺出任董事长的案例,包括四川金顶、科林环保、天首发展、华仁药业、瀚叶股份、友利控股等。比如,朴素资本今年初斥资12亿元入主四川金顶后,朴素资本董事长、总裁梁斐今年4月起担任公司董事长。科林环保易主后,新的实际控制人黎东当选董事长。友利控股现任董事长艾迪,系联创永宣董事长、总经理,去年底与另一实控人乔徽一起出资32.4亿元入主上市公司。“不少投资机构买壳之初便制定了转型计划,实际控制人本身具有丰富的项目资源与资本运作能力,入主后便会亲手掌舵上市公司筹划转型。”资深投行人士对记者表示。“私家订制”的专业团队在产业转型升级的背景下,越来越多的实业家开始关注到金融的重要性,上市公司引进此类专业人员是看中他们的融资能力与资本运作能力,另有不少企业准备向金融、类金融等产业领域转型,也急需此类人才与实际控制人走上前台不同,部分易主公司的董事长虽非由新任实控人担任,却也是其左膀右臂。比如,深圳惠程的实控人之一汪超湧仅担任公司董事一职,董事长、总裁的担子交给了徐海啸。履历显示,徐海啸曾任大鹏证券投行总部总经理助理、信达证券投行总部董事总经理、日信证券助理总裁兼投行部总经理,是汪超湧旗下北京信中利的董事。部分新东家则聘用了职业经理人团队。例如,金利科技易主后,实际控制人郭昌玮并未在上市公司任职,公司现任董事长、总经理郑玉芝与控股股东等各方均无关联。公司副董事长赵小川,曾就职于花旗银行集团,负责亚太区股权投资及并购业务,后任红隼资本董事、总经理。近期,一位不到30岁的董事长备受关注。今年4月,1988年出生的王皓被选举为东晶电子新任董事长,其曾任国信证券投资银行事业部经理,现任思通卓志投资法人、总经理等职,并通过东晶电子控股股东蓝海投控间接持有上市公司的股份。东晶电子主营石英晶体元器件,近年业绩惨淡,去年底易主蓝海投控。公司公开表示,后续不排除将会积极寻求新的投资方向,开展与优质资产、优质机构的合作,通过多种途径开拓公司新的经营领域和业绩增长点。显然,有着投行经历的王皓是东晶电子未来实施业务转型的舵手。再如,今年4月出任平潭发展总经理的丁湋,自2007年2月到2017年2月在招商银行就职达十年之久。近年,上市公司正积极向健康医疗、旅游等方向进行战略转型。浙江某上市公司高管对记者表示,在产业转型升级的背景下,越来越多的实业家开始关注到金融的重要性,上市公司引进此类专业人员是看中他们的融资能力与资本运作能力,另有不少企业准备向金融、类金融等产业领域转型,也急需此类人才。投行高参的“转型使命”在金融类人才“空降”队伍中,投行出身人士因其曾在资本市场深度浸润,更被市场关注。从另一个视角看,投行人士掌舵的公司,往往带有资本运作的强烈预期*ST金宇多次重组无果,去年11月“走马上任”的董事长刘波具有银行、证券等从业背景,副董事长、董秘吴小辉亦有相似经历。有意思的是,两人此前分别是中房股份的董事长和总经理。中房股份公告显示,去年6月,刘波、吴小辉一同辞职,后一起“转会”至*ST金宇。几乎与此同时,*ST金宇停牌筹划重大资产重组,并于今年初披露重组预案,拟作价13.2亿元收购安必平100%股权,后因故终止。台基股份年仅30岁的总经理袁雄,更是深度参与了公司的资本运作。简历显示,去年6月入职台基股份的袁雄,曾先后担任中信证券经理、高级经理、副总裁等职,在并购重组、跨境收购、中概股回归方面具有丰富的经验,曾主导了多个上市公司重大资产重组、中国企业跨境收购项目。一个有趣的细节是,去年6月,台基股份高管发生变动,公司实际控制人、董事长邢雁辞去总经理职务,转任总裁,总经理一职则交给了年轻的袁雄。据公告所述,袁雄全面负责公司的整体战略与资本运营,并负责公司泛文化娱乐板块的并购、整合与管理。袁雄出任总经理不久,台基股份便披露重组预案,拟以8.1亿元收购影视制作公司润金文化。在这个重组的配套融资部分,私募基金海德而立公司拟出资认购3.09亿元,而该基金的GP海德复兴资本的大股东正是袁雄。不过,在最新修订的方案中,因配套融资变为询价模式,相应的发行对象改为不特定对象。“在并购重组活跃期,部分头脑活络的投行人士比较吃香,他们手里有一些项目资源,与上市公司老板私交不错,不排除投行人士带着项目去上市公司任职,并促成资产并购等资本运作。”资深投行人士说。威华股份的案例更加耐人寻味。去年2月当选公司董事长、总经理的王天广,此前在银河证券、西南证券、长城证券等多家投行任职,曾任长城证券副总裁。威华股份与赣州稀土重组终止后,原实际控制人李建华于2015年7月辞职并开始大举减持。去年1月,威华股份启动定增预案,拟向盛屯集团定向发行股票,募资11亿元投入磁性材料等项目。去年6月,盛屯集团受让了李建华所持8.15%的股票。今年6月,李建华再与盛屯集团签署协议,将其所持10.49%股票对应的表决权、提名和提案权委讬给后者,正式易主。从这一揽子的交易看,王天广或在此中扮演关键角色。另一案例是,深圳凝瑞通过二级市场连续增持成为海欣股份第一大股东,但上市公司被认定为无实际控制人。去年9月,深圳凝瑞的派驻代表孟文波当选海欣股份董事长,其曾在国泰君安、方正证券、财富证券等多家券商任职。公司年报提出,公司将逐步形成以医疗健康产业为主、地产物业及金融投资为辅的“一主两翼、协同发展”的全新产业格局。“这些有着金融和投行背景的高参,显然对公司重组转型起着重要作用。但在当前的IPO发行节奏及监管背景下,优质资产越发难找,光有资本运作能力是不够的,上市公司的未来走向尚需观察。”投行人士表示。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591908.txt:
--------------------------------------------------------------------------------
1 | ■本报记者 吕 东时光飞逝,A股银行IPO闸门重启已经整整一周年。自去年此时江苏银行顺利成功实现A股上市后,上市银行数量目前已快速扩容至25家。就在上市银行不断增加的同时,处于证监会A股IPO排队企业的名单也同样一直处于变化之中。新面孔属地分布更为广泛,江苏省内排队银行数量缩至2家,并出现了西北地区首家排队上市银行。A股、H股以及终止“老14家”银行各有归宿随着2016年8月2日江苏银行成功登陆上交所,A股市场上市银行终于由16家增至17家,这一数量的细小变化足足用了6年之久,而彼时距离上一次城商行成功IPO更是过去了将近十年时间。江苏银行的上市也拉开了新一轮银行A股IPO的大幕。在此后的一年时间内,相继又有8家银行登陆A股市场。至此,短短一年时间,A股市场的上市银行数量就从长期未变的16家激增至目前的25家。上市银行队伍的扩容,必然带来了IPO排队银行名单的变化。目前排队银行已与三年前披露的首批排队银行发生了翻天复地的变化,这其中既有如江苏银行一般顺利上市的,也有就此终止上市以及远赴港股市场上市的银行,可谓各有归宿。2012年,随着证监会首发申报上市企业名单的出炉,地方银行排队上市的谜底也告揭晓。当时共有14家地方银行齐聚此份名单之中,江苏省内银行在上市队伍中可谓出尽风头,在14家申请上市的银行中独佔5家,同时更是包揽了所有农商行的排队名额。而地处东北地区的辽宁省则以盛京银行、大连银行、锦州银行成为入围城商行最多的省份。此外,还有名单中还包括上海银行、贵阳银行、杭州银行、重庆银行、徽商银行、东莞银行。目前,在最早进入名单的14家银行中,江苏银行、贵阳银行、杭州银行、上海银行、江阴银行、常熟银行、无锡银行、吴江银行、张家港行等均已在沪深交易所挂牌交易,而上述银行也是IPO最为顺利的。除此之外的银行的A股上市之路则要坎坷的多。重庆银行、徽商银行以及锦州银行因赴H股上市而一度终止在A股上市,如今这些银行都宣布有意重返A股。除此之外,大连银行、东莞银行、盛京银行的上市进程被陆续“终止”。江苏排队银行缩至两家西北地区银行首次亮相目前,排队上市的银行已全部被新面孔所占据。而与首批排队银行多分布于江苏、东北地区所不同,这些新面孔的分布区域则更为分散。目前,两市共有12家银行处于正常排队状态,其中兰州银行、青岛农商行、青岛银行、苏州银行和郑州银行拟在深交所挂牌,威海市商业银行、长沙银行、西安银行、哈尔滨银行、成都银行、江苏紫金农商行以及浙江绍兴农商行拟在上交所挂牌。新面孔中,只有苏州银行及紫金农商行出自江苏。此外,地处西部地区的排队银行数量则有所增加,分别为成都银行、西安银行以及兰州银行,而兰州银行则为了我国西北地区首家排队等待IPO的地方银行。银行A股IPO重启一周年12家“新面孔”担纲
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591920.txt:
--------------------------------------------------------------------------------
1 | 每经记者 谢欣 每经编辑 姚治宇作为A股不多见的自称“无实际控制人”的上市公司,四环生物(000518,SZ)的股权长期处在纷争之中。7月31日午间,四环生物公告称,公司被自然人股东王洪明二度举牌,持股达到10%。“老熟人”二度举牌此前,四环生物第一大股东为昆山市创业投资有限公司(以下简称昆山创投),其与四环生物另外两大股东中微小企业投资集团股份有限公司(以下简称中微小投资)以及广州盛景投资有限公司(以下简称广州盛景)被外界认为相互支持,称之为“昆山系”。此前王洪明曾被广州盛景公开质疑,其与包括四环生物原控股股东德源纺织以及东陆宇、孙一帆等众多自然人股东同为“阳光系”成员,双方也曾多次在股东大会对垒。而此次王洪明短时间内连续举牌,四环生物控制权之战是否会被再次点燃引市场关注。根据四环生物7月31日午间公告,公司股东王洪明其在7月28日通过深圳证券交易所大宗交易系统买入四环生物股票2062万股,此次增持结束后,王洪明合计持有公司股份10295万股,占公司总股本的10.00%。值得注意的是,在7月24日,四环生物公告称,王洪明于7月21日通过深圳证券交易所大宗交易系统买入四环生物股票31万股,完成对上市公司的第一次举牌。而仅过一周王洪明就实现二度举牌。四环生物公告称,本次权益变动未导致公司第一大股东发生变化,公司股权结构分散,不存在控股股东和实际控制人。根据四环生物今年一季报,昆山创投持股8.60%为上市公司第一大股东,不过,其与昆山市能源建设开发有限公司(以下简称“昆山能源建设”)以及昆山创业控股集团有限公司(以下简称“昆山创控”)为一致行动人,合计持有四环生物10%的股份。其中昆山能源建设持股1.35%,昆山创控持股0.05%。而事实上,《每日经济新闻》记者发现,王洪明已经是四环生物的老股东了。在四环生物2014年一季报中,王洪明就已经持股2.16%,位列四环生物第四大股东。控制权大战再打响?自从原来四环生物原控股股东江阴市振新毛纺厂(以下简称振新毛纺厂)自2010年8月31日起减持四环生物股票,至2011年9月5日,振新毛纺厂持有的四环生物股票减至2000万股,仅占四环生物总股本的1.943%;四环生物的第一大股东变成广州盛景之后,四环生物的控制权便一直扑朔迷离,争夺不断。广州盛景成为四环生物第一大股东之后,昆山创投与中微小投资也先后加入战局。从四环生物这些年历次股东大会看,广州盛景、昆山创投与中微小投资互相之间并非是斗争关系,相反,三者甚至存在着一定程度上的相互支持。而“昆山系”尽管经常位列四环生物前几大股东,但事实上并未实际控制四环生物,甚至在股东大会与董事任免上屡次受挫。广州盛景此前更是因董事任免问题将四环生物告上法庭。而根据此前媒体报道与广州盛景的公开质疑,与“昆山系”进行四环生物控制权斗争的是“阳光系”。王洪明也正是“阳光系”的重要成员。事实上,王洪明是江苏阳光(600220,SH)董事、副总经理,同时还是江苏阳光大股东江苏阳光有限公司的母公司江苏阳光控股集团有限公司的股东。因此,不仅引人猜测,王洪明迅速的两度举牌,是否打响了四环生物新一轮控制权争夺战?此外,广州盛景此前还公开质疑,王洪明与德源纺织(一季报持股4.93%)等四环生物的几大股东存在一致行动关系,均为“阳光系”成员,不过此说法并未被相关方认可。不过,由于四环生物目前中报尚未发布,“昆山系”各成员持股比尚不得而知,后续双方是否会继续增持值得关注。7月31日,《每日经济新闻》记者电话四环生物董秘周扬,欲对昆山创投最新持股以及王洪明与“阳光系”关联等情况进行采访,并按其要求发送采访函至公司邮箱,但截至记者发稿,尚未得到回复。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591925.txt:
--------------------------------------------------------------------------------
1 | ——记中爱联宠平台创始人兼董事长蒋勤军来源:中国企业报 作者:张赫蒋勤军蒋勤军,连续五次成功创业者,创业企业包括一家上海证券交易所上市企业,一家深圳证券交易所上市企业。1969出生的蒋勤军,不仅是金发科技(600143)和高盟新材(300200)的创始人,也是第一批移动互联网创业的开拓者。2013年,蒋勤军在参加中欧创业精英成长营(简称中欧创业营)期间,学习了众多互联网创业的经验。后在探讨荣昌干洗的营业模式时,作为荣昌的股东和董事,其推动了荣昌创新的课题,之后便讨论出e袋洗的网络经营模式,并最终获得了腾讯、美国经纬和百度的投资。目前,e袋洗已经成为世界社区共享经济的开创者和领导者。蒋勤军多年来一直致力于生物科技在农业服务领域的应用,并于2014年11月2日推出一个基于智能手机移动互联网农业远程诊断的免费应用程序——农医生, 通过技术服务,使得农民的种植更加高效,将粮食的增产量提高20%—40%。农医生让农民知道,庄稼怎么种可以种得更好,怎么能不使用高毒农药,这从源头上解决了中国食品安全问题。2015年,农医生获得了世界互联网大会的最佳跨界应用奖,使之成为了农村互联网的标志性产品。从化工业,到农业,再到互联网洗衣,这一次,蒋勤军把目光锁定在了宠物行业。根据蒋勤军的观察和国外考察的切身经历,中国经过改革开放几十年发展,国人经济水平提高,即将迎来宠物行业的大发展。宠物作为人们的伴侣,会在人们生活中佔有更多时间。随之而来的宠物产业经济必然迎来蓬勃发展,然而中国宠物行业与国外包括美国等发达地区,还有很大的差距。看准机会,果断出击,2014年2月,蒋勤军创立中爱科技,同年推出“狗大夫”品牌, 2015年获得pre-A轮投资,2017年7月,经过三年打磨,“Lpet”联宠平台在北京清华大学紫光国际交流中心正式发布。同时,“Lpet”联宠平台获得由财政部全国中小企业发展基金和清控银杏基金联合投资的亿元A轮融资。此外,在发布会现场,中爱科技与京东达成千万宠物体检项目合作, 宠物主人只要上京东购买体检服务,即可到指定宠物医院预约体检项目,联宠检测中心作为第三方独立检测中心提供检测项目专业支持。该项目服务于京东数千万的宠物主人客户的同时,也将提升宠物健康体检意识,快速促进行业发展。“2017年是中国宠物行业发展腾飞年,全社会发展速度趋缓,而宠物行业作为朝阳行业异军突起获得了极大的关注。中爱科技作为一家致力于打造中国宠物行业第三方B2B的专业平台,将一直致力于通过先进的互联网技术为中国宠物行业提供更具竞争力的新商业模式。”蒋勤军说。据了解,联宠平台包括联宠医院管理软件、联宠国际采购商城、联宠国际检测中心三部分。联宠管理软件作为世界首款打通微信技术的互联网智能动物医院管理软件,它简单易用且能帮助医院全面优化工作效率。联宠管理软件不仅可以帮助宠物医院、宠物店实现更好的智能化高效管理,同时创新打通微信让医院和宠物店更好和客户沟通。通过软件,可将优秀的厂家品牌产品让更多宠物医院、宠物店知晓并使用,互联网技术让宠物行业更加智能便捷。联宠国际采购商城通过互联网服务,为全国超过5500家动物医院和5万多家宠物店提供一站式采购服务,并发展为宠物行业较先进、便捷的一站式采购平台。联宠国际采购商城作为一站式采购服务平台,专注宠物医院和宠物店B端采购,与各地供应商合作,维护行业规范,促进长期发展;通过互联网采购平台,让供应商降低营销成本,提升销售效率;对于医院和宠物店等采购商户,联宠采购商城的出现,免去挨家挨户打电话订货的麻烦,让采购工作变得更加轻松。联宠国际检测中心拥有行业中较权威医师团队,是国内首家由医院众筹且国际化的第三方检测连锁机构,为来自全国各地的医院提供一站式影像、检测、检验、分析等技术服务,并提供专业与准确的中英文报告。联宠国际检测中心专门服务于宠物医院,帮助宠物医院更好地保障宠物的健康,提供专业权威的检测诊断技术。独立第三方模式和众筹模式,让联宠国际检测获得广泛的宠物医院的支持,全国参与检测中心众筹的众多宠物医院就是对检测中心认可的证明。从蒋勤军十多年来的创业经历来看,他一直重视产品的创新,以及最新科技的应用。作为创始人之一,蒋勤军创立的广州金发科技(600143)生产的白色家电改性塑料,正迎合了家电进入中国千家万户的时机,高盟新材(300200),则是蒋勤军发现汽车将进入普通家庭时代,生产的胶粘剂将被大量使用在汽车上。在互联网时代,如何将产品创新与互联网新模式、新方向相结合,是他一直考虑的问题。“Lpet”联宠品牌,包含了蒋勤军的创业理念,以关爱(love),链接(link)为理念,通过智能互联网技术连接宠物行业公司和单位,实现共赢并发展壮大行业。蒋勤军也期待在未来10年即中国宠物行业发展的黄金10年,有更多优秀的行业企业、医院、单位及个人踊跃而出,共同促进中国宠物事业的蓬勃发展。蒋勤军,这名创业老兵,坚定地走上了宠物行业创业阵线。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591936.txt:
--------------------------------------------------------------------------------
1 | “我很感谢母亲的安排,这一段基层经历对我来说十分宝贵,尤其是对我后来从事公司的管理和战略布局奠定了基础,积累了经验。”褚浚表示,除了要传承煌上煌艰苦创业的精神,更重要的是要以科学发展的理念与时俱进,推动企业在管理观念上创新、在科技含量上提升、加快产品的改进和出新等,而这恰好是他的专业,是他擅长的领域今年6月27日的江西省工商联(总商会)第十一次代表大会上,江西煌上煌集团食品股份有限公司(以下简称“煌上煌”)副董事长、总经理褚浚当选为江西省总商会副会长。顶着“创二代”的光环,往往让人忘记褚浚真正成功的因素在于他自身。其实,其母亲徐桂芬、父亲褚建庚的成就和名气,则是托举他人生成功的第一步……16年事业航线接触过褚浚的食品行业人士评价说,褚浚为人处事沉稳、踏实、机敏,有大局观念,他正带领着煌上煌集团逐步从家族企业向现代企业转变。1996年3月,褚浚的母亲徐桂芬创立了江西煌上煌实业有限公司。同年,褚浚的父亲褚建庚加入公司。这一年被看作是煌上煌集团发展的关键一年。这一年,褚浚从中国科技大学外贸管理系毕业。彼时的他,还是一个刚刚20岁的小伙子,但是面临着出国继续深造或者是回到煌上煌来管理家族企业的选择时,他毅然决然地选择了后者。熟悉煌上煌的人都知道,1993年以前,煌上煌不过是南昌市绳金塔一家前店后坊的熟食小店。经过几年发展,逐渐完成原始积累的煌上煌集团,由家庭小作坊发展为家族式公司时,家人、亲属、好友纷纷加入。大家按辈份排位,各管一摊,规章是口头约定,管理靠的是亲情和血缘关系的约束。面对现状,褚浚认为集团迫切需要注入现代经营管理的新鲜血液。“大学毕业就进了公司,跟着前辈们一起开拓创业。”回想进入公司的情景,褚浚颇感慨地说,“尽管进入公司前对卤制品不算了解,但是经过平时与公司前辈以及老百姓的接触后,我逐渐感觉到了卤制品市场的未来前景广阔,慢慢地也对这个行业产生了浓厚的兴趣。自此,我就决定要把它当作我一生的事业来做。”不同于其他的“创二代”,褚浚是从煌上煌集团的基层一步一步做起的。刚进入集团时,褚浚先后在清洗车间、烤卤车间、凉拌车间、包装车间等做过,随后又到煌上煌专卖店当过营业员,采购、生产、财务等部门,褚浚也去工作过。“可以这么说,基本上能做的岗位我都做过。”褚浚坦言,这一切多得益于既是集团创始人、董事长,也是母亲的徐桂芬的决定。徐桂芬认为将儿子放到一线基层去锻炼,一方面有利于他更全面地了解卤制品加工工艺流程、终端销售和市场营销的全过程,另一方面也可以锻炼他吃苦耐劳的能力和坚持不懈的毅力,更为重要的是,为日后褚浚将煌上煌集团从“家庭式作坊”打造成“现代企业”提供了实践的基础。“我很感谢母亲的安排,这一段经历对我来说十分宝贵,尤其是对我后来从事公司的管理和战略布局奠定了基础,积累了经验。”褚浚表示,除了要传承煌上煌艰苦创业的精神,更重要的是要以科学发展的理念与时俱进,推动企业在管理观念上创新、在科技含量上提升、加快产品的改进和出新等。而这恰好是他的专业,是他擅长的领域。很快,他就被委任为煌上煌实业有限公司经理,负责公司的现代化改造。褚浚低调,以至于他在一线工作了很长一段时间,也没有人知道他就是董事长的儿子,“褚总很谦逊,完全没有架子,平时都和我们打成一片。”煌上煌集团众多员工透露。而至今,我们也鲜少见到褚浚接受媒体的采访。公开数据显示,煌上煌集团于2009年--2011年间,通过连锁加盟店的模式,在全国的门店数从1015家增长到1798家,门店数增长了77.1%。与此同时,销售额也从4.078亿元增长到6.998亿元,剧增71.6%。“公司根据发展步伐,此前几年就制定并开始实施上市战略。”公司的快速发展,使得作为煌上煌领导者之一的褚浚有了更长远的打算。上市,成为了褚浚深思熟虑后的决策。“为了公司上市,我们做了很多准备,付出了很多。这次企业上市前前后后所经历的事情,恐怕我这辈子都忘不了。上市是对企业现代管理的一个考验,同时也是对企业决策者素质的一个考验。”2012年9月5日,褚浚带领集团完成了在深交所的正式挂牌上市。自此,煌上煌集团成为酱卤行业第一股,也开启了褚浚事业航线的辉煌篇章。集团上市成功后,褚浚担任总经理一职,而这距离他第一天进入煌上煌工作,正好16年。褚浚曾说,上市只是第一步,带领煌上煌以建设创新型企业为主线,以提高核心竞争力为目标,团结拼搏,务实创新,再续辉煌,致力于打造中国百姓放心厨房,不断推动产业升级和跨越式发展,做强做大江西食品工业,努力把煌上煌打造成为中式酱卤肉制品第一品牌,才是他的目标。坚持做食品“百年老店,酱卤世家”是煌上煌人始终坚持的优良传统和作风,而真正实现这一目标需要不断地创新发展。煌上煌集团人和褚浚都肩负重任。特别是进入新世纪后,面对武汉“周黑鸭”、长沙“绝味鸭脖”等卤制品强势品牌布局江西,以及分布于街头巷尾的众多本土家庭作坊式卤制品门店的竞争,如何突出重围成为了褚浚亟待解决的难题。“初生牛犊不怕虎”,年轻的褚浚在担任煌上煌实业有限公司经理期间,加大了对传统烤卤工艺的革新力度,不断引进、开发并应用先进的加工设备和技术,包括采用连续式油水分离油炸设备、连续式卤煮机等,并在江西烤卤行业中首家实现蒸汽加工卤制品,实现了从传统手工工艺向现代化生产的转变。此外,他还推广应用中式菜肴微波保鲜技术,从技术上确保产品的品质。“2006年,我通过技术嫁接方式,加大了对酱卤肉制品抗氧化护色的技术攻关的力度,解决了酱卤肉食品氧化发黑的难题。”褚浚说,也正是这项技术的突破和应用,使得煌上煌走在了国内同行的前列。此外,褚浚还建立了一支技术团队,聘请江西省农科院、南昌大学等科研机构及其他食品行业专家作为技术顾问。他还组建了肉禽食品研究所和新产品研发中心,为新产品的研发提供技术后盾。记者了解到,在软硬件实力协同发展后,煌上煌集团每年都要开发出10-20个具有江西地方特色的烤卤新产品,如樟茶型鹅、鄱湖香辣鸭等。在此基础上,煌上煌逐步形成了5大系列(烧烤、卤制、凉拌、清蒸、炒炸)200多个品种。“做食品、做好食品是我对自己的要求,也是我一直奋斗的目标。”褚浚很清楚煌上煌集团的定位,20多年来他一直朝着将煌上煌打造为赣产特色肉类食品品牌的目标不断努力。在他的策划和带领下,煌上煌集团每年以30%的速度迅猛发展。尤其是自2002年开始,煌上煌连续实现了三个“工业增加值、销售、利税”三年翻一番的目标。目前,企业旗下有16家分公司,员工3000馀人,先后在广东、福建、辽宁、河南等地建立了现代化的大型生产加工基地,超过3000家连锁专卖店分布在全国各地。此外,该公司在江西共拥有占地近600亩的中式烤卤食品工业园和大型家禽屠宰、深加工厂区,屠宰能力达年产量3万吨,加工能力年产量3.4万吨。“‘煌上煌’与鸭子不能分割”,徐桂芬知道,褚浚也清楚地明白。为此,褚浚带领集团探索了一条农产品深加工的产业链之路,建立了“公司+合作社+农户”“公司+养殖小区+农户”等多种利益连接机制。“这样做既能保证企业原料供应的量和品质,也能带动养鸭农民致富。”褚浚说。经过多年用心经营,煌上煌集团斩获了“中国肉类食品行业50强”“中国民营企业500强”“农业产业化国家重点龙头企业”“国家农业产业化开发项目示范企业”和“江西省高新技术企业”等多项荣誉。在褚浚的直接带领下,2015年煌上煌集团搬迁到新加工园,投入巨资建设了标准化的厂房车间,在酱卤行业率先建立了十万级洁净车间。同年,在褚浚的主导下,煌上煌集团成功控股并购了全国第二大粽子品牌——嘉兴真真老老食品有限公司,丰富了产品品类。“公司一直有在食品行业进行并购的计划。”褚浚曾在投资者互动平台上表示。而这一年,在褚浚的带领下,煌上煌集团开始大力发展电商,打造互联网线上全网销售模式,取得了突破进展。仅过了一年,褚浚又作出了一个重大决策:投资近2000万元从德国进口6条预包装生产线,实现技术转型升级,确保从生产源头上控制产品质量安全。为响应江西省委省政府“精准扶贫”的号召,践行企业的社会责任,今年初,在褚浚的指导下,煌上煌农业产业化扶贫示范工程——江西丰城“皇禽”肉鸭孵化基地已正式在丰城挂牌成立。积极“走出去”随着年龄的增长、经历的丰富,褚浚思考企业经营管理的角度更为全面和深入,这也促使他越来越想在以前的基础上更有所突破。突破,这件事,在他看来迫在眉睫,必须全力以赴!“目前,公司虽然作为江西省卤制品加工行业先驱,深耕行业达21年之久。但是面对快速发展的中国食品行业,我不敢懈怠。”褚浚坦言,自己一直保持着一颗“忘记过去成绩的超越之心”,不断吸收优秀品牌的经验和知识并运用到自身,努力做好量的积累,在机遇降临之时,能够准确把握迎接挑战。“他不拘泥于现有的制度,大胆调整营销策略,开拓省内外市场。”这是一位与褚浚共事多年的煌上煌集团人对他的评价。正是在褚浚的迅速出牌、布局市场的策略下,煌上煌集团很快就在江西省立足,向全国扩展。“在强化营销手段、掌握南昌市场主动权的同时,也要抓住机遇,发挥品牌优势,做好省外市场。”不仅如此,近年来,褚浚还积极响应国家“一带一路”倡议,主导煌上煌集团积极“走出去”参与国际合作。2016年12月,集团进军麦卢卡蜂蜜项目,成功与新西兰新溪岛蜂蜜公司签订合作项目协议,正式完成对新溪岛蜂蜜公司的股权收购。同时,集团谋求全球发展战略,先后前往新西兰、澳大利亚、马来西亚、巴基斯坦、黎巴嫩、巴西等国进行项目考察,启动了酒店发展、葡萄酒生产加工、牛羊肉进口等项目,开启了煌上煌集团布局海外业务战略。今年6月19日,江西省开放型经济发展大会在南昌举行,江西省委书记鹿心社、省长刘奇等出席会议。大会表彰了2016年度全省开放型经济先进单位,煌上煌集团凭借近年来“走出去”发展的新实践、新成就、新风貌,荣获2016年度全省“走出去”先进企业荣誉称号。记者今年的江西省工商联(总商会)第十一次代表大会上再见到褚浚,看到他比过去更自信更稳重。虽然对于未来的计划,褚浚并没有提及太多。但是谈吐中,似多了一份指挥若定和运筹帷幄。人常说“四十不惑”,而在他身上却看不到困惑何在。他已深谙做一个“创二代”不仅需要坚守上一辈的勤劳和智慧,更要不断地融合与创新。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591954.txt:
--------------------------------------------------------------------------------
1 | 中证中小投资者服务中心(以下简称投服中心)是由中国证监会批准设立并直接管理的证券金融类全国性公益机构。《投资者》是投服中心主办、拟向社会公开连续出版的综合性集刊。该集刊宗旨是一切源于投资者、一切为了投资者、一切归于投资者,维护投资者权益,为投资者提供保护与服务。《投资者》以法学领域探究为侧重点,展现国内外投资者权益保护的最新理论与实务动态,内容以境内为主,境外为辅;以实践为主,理论为辅。栏目设置为“政策解读”、“理论探究”、“公司治理”、“市场实务”、“投教园地”、“案例探析”、“域外视窗”等,每卷根据实际情况可对栏目适当调整。《投资者》拟每季度出版一卷,全年出版四卷。现向社会公开征稿。一、征稿范围涉及法学、经济学及其他领域与投资者尤其是中小投资者及其权益保护相关的理论和实践性作品,且未曾公开发表或主体部分未曾公开发表,如有疑问可与《投资者》编辑部联系。二、投稿须知1.文章应当论点鲜明、逻辑严谨、可读性强、贴近市场,具有学术深度和实践应用价值,字数在6000-10000字为宜,特别优秀的理论文章字数不限。2.《投资者》编辑部保留对来稿进行文字性和技术性修改的权利。《投资者》所刊文章,均不代表投服中心观点,文责由作者自负。除作者特别说明外,其文章均为其个人观点,与其所在单位、职务无关。3.来稿请附上作者的姓名、单位、学校、职称或职务、通讯地址、邮编、电话或电子邮箱。4.投稿请将word文件发送至电子邮箱:tzzbjb@isc.com.cn。5.来稿一经录用,编辑部将及时通知作者;刊用后将根据文章质量及字数从优支付稿酬,并奉送样刊。6.本卷截稿时间为:2017年11月1日7.联系人:汤沸电话:021-60290620;15801890856 地址:上海市浦东新区世纪大道1701号钻石大厦B座11楼中证中小投资者服务中心《投资者》编辑部邮编:200122中证中小投资者服务中心《投资者》编辑部2017年7月31日
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/neu_591962.txt:
--------------------------------------------------------------------------------
1 | 江西煌上煌集团食品股份有限公司成立于1999年4月,其前身是1993年2月由现任集团董事局主席徐桂芬女士一手创建的“南昌皇上皇烤禽社”,1996年3月成立的“江西煌上煌实业有限公司”,是以畜禽肉食品加工为主的大型民营企业。2012年9月5日,煌上煌在深圳证券交易所正式挂牌上市。至此,中国酱卤肉制品领域第一股——煌上煌隆重诞生,同时该公司也是南昌县第一家上市企业。近年来,煌上煌坚持“立足江西,布局全国”的连锁经营模式,不断扩展,营销网络扩展覆盖江西、广东、福建、辽宁、北京、上海、河南、安徽、广西等全国20多个区域市场,连锁专卖店发展到近3000家。2015年,煌上煌搬迁了新加工园,投入巨资建设了标准化的厂房车间,在酱卤行业率先建立了十万级洁净车间。2016年,投资近2000万元从德国进口6条预包装生产线,实现技术转型升级,确保从生产源头上控制产品质量安全。同时,加大科技研发投入,投资3000万元打造国家级的研发检测中心,计划今年上半年全面通过国家3S技术认证,加强食品安全检测,提高食品质量,增强企业核心竞争力。目前,该集团已先后顺利通过ISO9001:2000国际质量体系认证、食品生产许可和市场准入质量安全(QS)认证及HACCP食品安全管理体系认证,并被国家有关单位和部门列为“中国肉类食品行业50强”“中国食品工业100强”“中国民营企业500强”和“农业产业化国家重点龙头企业”等。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_594613.txt:
--------------------------------------------------------------------------------
1 | 特斯拉(Tesla)新款电动车Model 3上周末开始交货,成为股价向上动力,加上投资者对美企业绩乐观,刺激道指周一早段再创新高,惟标指及纳指则走势反复。道指曾升86点,创21916点新高,本港今晨零时(开市后2小时30分),升78点,报21908点;标指升不足1点,报2473点;纳指跌17点,报6357点。Stoxx欧洲600指数收市跌0.1%,英股升3点,法德股跌0.7%及0.4%。Tesla新车交付 股价先升后回特斯拉Model 3上周五开始交货,为股价带来支持,早段曾升1.9%,但午市回软。惟Facebook被指面对数码广告饱和的风险,遭研究公司Pivotal Research调低股票评级至沽出,令股价受压,一度跌2.3%。另外,Snapchat母企Snap的IPO后限售期届满,持货内部人员和员工纷纷沽售,令公司股价急挫最多5.1%。不过,投资者仍对美企本周公布业绩乐观。至今73%已经公布业绩的标指美企表现均胜预期。路透社数据更显示,标指美企首季盈利按年增长15%,次季盈利则预料升11%,可望自2011年后首次连续两季录得双位数的盈利增长。虽然华府削减企业税和增加基建开支等政策受阻,但受惠于企业削减成本见效、美元走弱和消费者开支强劲,让美企业绩取得亮丽表现。按行业计算,科网股、金融股、工业股和医疗股按年都录得盈利增长,只有公共股录得跌幅。专家:一时波动离场 小心走宝投资策略顾问公司Yardeni Research策略师阿德尼(Edward Yardeni)亦表示,美股3大指数近期创新高,是美企业绩表现理想推动,倘投资者因股市一时动荡而离场,可能错失获利机会。阿德尼指出,基本面正以合适速度增长。鑑于美企业绩造好,令经济数据的增长看起来有些缓慢,但无论如何,因为全球经济表现理想,令美企有可观的收入和盈利。他续指,有些牛市会「爬过忧虑之墙」(climbed a wall of worry,即克服多个利淡因素),而今次也不例外。他称标指年底目标为2500点,预测明年中之前会续升至2600至2700点,意味比现时水平还有5%至9%的上行空间。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_594817.txt:
--------------------------------------------------------------------------------
1 | 沪深股市周一收市双双上涨逾0.6%,其中沪综指收市更创三个半月新高。麦格理报告预期,下半年沪综指仍会徘徊在3,200点至3,400点之间。A股上半年仅涨4.5%。(中新社图片)停牌逾50日 踢出MSCI沪综指周一收升0.61%,收报3,273点,七月累升2.52%,连续第二个月录得上扬,亦创今年二月后的最大单月升幅;深成指收升0.64%,收报10,505点,七月累跌0.23%。深圳创业板指数收升0.13%,收报1,736点,七月累跌4.5%。沪深两市主板成交金额回升至5,404亿元(人民币?下同)。沪股通连续第七个交易日录得净流入;深股通持续录得净流入。MSCI明晟董事总经理谢征傧接受外电访问时指,中国在全球市场中较特殊,停牌个股太多。他指MSCI会密切关注被纳入其新兴市场指数中的222只内地上市公司。他又指,若发现某公司停牌逾五十日,会将其剔出新兴市场指数,且至少未来十二个月内不会再重新加入指数中。报道又指,上述十二个月剔除的规则仅限于中国上市公司,而其他市场因长期停牌而被从指数中剔除的公司,只要恢复股票交易,就立刻可以开始重获纳入的审核程序中。并购时业绩承诺不可变内媒报道又指,中国证监会对于并购重组政策又作新窗口指导。要求并购重组时作的业绩承诺不可变更或调整。通过股东会调整已完成的并购重组约定的业绩承诺,也遭严控。至于A股后市,麦格理指,受市场流动性紧张及监管部门更严格的规限,故A股在上半年仅涨4.5%。该行料,下半年沪综指仍徘徊在3,200至3,400点,主要受三大因素影响,如市场流动性紧张、房地产市场放缓对市场带来的滞后反应渐浮现,以及政策会待「十九大」举行后才公布等。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595052.txt:
--------------------------------------------------------------------------------
1 | 本来预计期指结算后,或令大户减低挟上诱因,但恒指依然强势毕呈,昨早上被腾讯(00700)带住上,午后就到滙丰控股(00005)接力,恒指最终以近全日最高位收市,报27,323点,升344点,主板成交869亿元。期指日市基本上无回过,从开市的26,966点升到27,228点收市,升285点,低水95点,总成交张数7.9万张;国期则升72点报10,833点,继续跑输恒指。正如笔者早前所言,大市反复向上格局未变,短期内仍宜买不宜沽。若从值博率出发,虽然国指有追落后诱因,但从年内走势看,国指明显跑输恒指,主因国指缺乏如腾讯及滙控等作为动力核心。正因如此,短期内若见资金仍以上述大价股作主力,则买期指胜算仍高于国期。策略上,昨早见腾讯重新发力,在27,050点以三分一注码买入好仓小试牛刀。午后发现恒熊街货重货区为27,300至27,399点,及最多新增区27,400至27,499点,一共有街货6.35亿份(相对期指约1,222张),在大户挟上诱因十足下,短期内会吼位再次加注,博今次杀上27,500点甚至两万八先肯停,跌穿26,800点止蚀。John Mullen
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595121.txt:
--------------------------------------------------------------------------------
1 | 科技基金今年涨幅傲视其他产业型基金,尤其是台股科技基金,多档基金今年来涨幅超过三成。日盛高科技基金成立于2000年上一波网路热潮时,近一周涨6.4%,净值创成立以来新高。基金的持股以半导体股最多,占38%,其次是电子零组件的16%,还布局生技、机械、纺纤、观光等。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595219.txt:
--------------------------------------------------------------------------------
1 | 特斯拉(Tesla)新款电动车Model 3上周末开始交货,成为股价向上动力,加上投资者对美企业绩乐观,刺激道指周一早段再创新高,惟标指及纳指则走势反复。道指曾升86点,创21916点新高,本港今晨零时(开市后2小时30分),升78点,报21908点;标指升不足1点,报2473点;纳指跌17点,报6357点。Stoxx欧洲600指数收市跌0.1%,英股升3点,法德股跌0.7%及0.4%。Tesla新车交付 股价先升后回特斯拉Model 3上周五开始交货,为股价带来支持,早段曾升1.9%,但午市回软。惟Facebook被指面对数码广告饱和的风险,遭研究公司Pivotal Research调低股票评级至沽出,令股价受压,一度跌2.3%。另外,Snapchat母企Snap的IPO后限售期届满,持货内部人员和员工纷纷沽售,令公司股价急挫最多5.1%。不过,投资者仍对美企本周公布业绩乐观。至今73%已经公布业绩的标指美企表现均胜预期。路透社数据更显示,标指美企首季盈利按年增长15%,次季盈利则预料升11%,可望自2011年后首次连续两季录得双位数的盈利增长。虽然华府削减企业税和增加基建开支等政策受阻,但受惠于企业削减成本见效、美元走弱和消费者开支强劲,让美企业绩取得亮丽表现。按行业计算,科网股、金融股、工业股和医疗股按年都录得盈利增长,只有公共股录得跌幅。专家:一时波动离场 小心走宝投资策略顾问公司Yardeni Research策略师阿德尼(Edward Yardeni)亦表示,美股3大指数近期创新高,是美企业绩表现理想推动,倘投资者因股市一时动荡而离场,可能错失获利机会。阿德尼指出,基本面正以合适速度增长。鑑于美企业绩造好,令经济数据的增长看起来有些缓慢,但无论如何,因为全球经济表现理想,令美企有可观的收入和盈利。他续指,有些牛市会「爬过忧虑之墙」(climbed a wall of worry,即克服多个利淡因素),而今次也不例外。他称标指年底目标为2500点,预测明年中之前会续升至2600至2700点,意味比现时水平还有5%至9%的上行空间。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595249.txt:
--------------------------------------------------------------------------------
1 | 欧盟统计局周一公布的数据显示,欧元区7月消费者物价调和指数(HICP)初值按年升1.3%,符市场预期,显示欧元区7月整体通胀率持稳。另外,欧元区6月失业率下降至9.1%,为2009年2月以来新低,市场预期为9.2%。数据公布后,欧元一度回升至1.1762,接近上周四触及的2015年1月以来高位1.1777。据中国国家统计局数据,中国7月官方制造业PMI为51.4,不及预期51.5,较6月PMI数据51.7有所回落。另外,中国7月官方非制造业PMI报54.5,较6月54.9也有所回落。惟数据无碍人民币近期强势,美元兑在岸人民币一度跌至6.7213;美元兑离岸人民币亦低见6.7251。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595252.txt:
--------------------------------------------------------------------------------
1 | 上周美国联储局一如预期维持现行1至1.25厘指标利率水平不变,但表示将「相对很快」缩减资产负债表 。此次声明指「总体通胀和核心通胀已经放缓」,措词基调略偏鸽派,令市场质疑将来加息的步伐可能放慢,拖累美汇指数曾触及去年六月以来最低水平93.152。上周德国公布七月Ifo企业景气判断指数升至纪录高位,加上有欧洲央行官员提出开始缩减超宽松货币政策规模的言论,上周四欧元兑美元一度升至两年半高位1.1777;而德国七月消费物价指数(CPI)初值意外地按月上升0.4%,好于预期和前值,良好数据加上美元近期疲弱,使欧元维持在高位上。市场憧憬欧洲央行可能因经济增长将会收紧货币政策,有利欧元走势,建议于1.17买入欧元兑美元,止蚀定于1.16,目标1.1860。中信银行(国际)
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595330.txt:
--------------------------------------------------------------------------------
1 | 科技基金今年涨幅傲视其他产业型基金,尤其是台股科技基金,多档基金今年来涨幅超过三成。日盛高科技基金成立于2000年上一波网路热潮时,近一周涨6.4%,净值创成立以来新高。基金的持股以半导体股最多,占38%,其次是电子零组件的16%,还布局生技、机械、纺纤、观光等。
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595408.txt:
--------------------------------------------------------------------------------
1 | 中新网8月1日电 据财富中文网消息,财富中文网于北京时间7月31日发布最新的《财富》中国500强排行榜。该榜单由《财富》(中文版)与中金公司财富管理部合作编制,考量了全球范围内最大的中国上市企业在过去一年的业绩和成就。 今年中国500家上榜公司的总营业收入达到了33.54万亿元,较去年大涨9%;净利润达2.8万亿元,增长约2.2%;营业收入和利润增幅较去年均有明显回升。今年企业上榜的年营收门槛为113.23亿元,首次突破百亿。 榜单头部依然是三足鼎立:中石化、中石油和中国建筑,其中前两者的营收之和超过了全部500家上市公司收入的十分之一。紧随榜单三巨头的上汽集团继续保持并扩大了国内车企销量冠军的优势。继去年首次进入前十,今年中国平安排位继续升至第五,蝉联保险业第一位和非国有企业第一位。 新上榜企业中包括部分新上市的重要中国公司。绿地集团正式登陆A股后,凭借2016年业绩登上榜单,并成为房地产行业冠军。另一家众人瞩目的公司第一次登上榜单就名列第112位——它就是拥有庞大快递网络的顺丰。 行业方面,互联网服务行业累计收入同比增长36.7%。房地产行业上榜公司数量增加了8家,在今年500强中占比超过10%。 在所有上市公司中,最赚钱的依然是中国工商银行,实现净利润2,782.49亿元,比上年增长0.4%。但是,最赚钱公司10-20位出现了两家民营公司——腾讯和阿里巴巴。其中腾讯的利润率高达27%,在利润率子榜上也位列前40家企业。排名上年排名公司名称(中文)营业收入(百万元)利润(百万元)11中国石油化工股份有限公司1930911.046416.022中国石油天然气股份有限公司1616903.07900.033中国建筑股份有限公司959765.4929870.145上海汽车集团股份有限公司756416.1732008.6158中国平安保险(集团)股份有限公司712453.062394.066中国移动有限公司708421.0108741.074中国工商银行股份有限公司675891.0278249.087中国中铁股份有限公司643357.3212509.16910中国铁建股份有限公司629327.0913999.61109中国建设银行股份有限公司605090.0231460.01112中国人寿保险股份有限公司549771.019127.01211中国农业银行股份有限公司506016.0183941.01313中国银行股份有限公司483630.0164578.01414中国人民保险集团股份有限公司443323.014245.01515中国交通建设股份有限公司431743.4316743.071617中国电信股份有限公司352285.018004.01716中国中信股份有限公司325907.4728054.841818联想控股股份有限公司294745.714851.981919中国联合网络通信股份有限公司274196.78154.072020中国太平洋保险(集团)股份有限公司267014.012057.02131京东商城电子商务有限公司260121.64-3806.792222国药控股股份有限公司258387.694647.3423--绿地控股集团股份有限公司247400.157207.32427万科企业股份有限公司240477.2421022.612524中国电力建设股份有限公司238968.366771.812621中国中车股份有限公司229722.1511295.62725中国能源建设股份有限公司222171.024281.292823中国冶金科工股份有限公司219557.585375.862943中国恒大集团211444.05091.03026招商银行股份有限公司209025.062081.03130物产中大集团股份有限公司207172.432154.323229江西铜业股份有限公司202308.22787.543328交通银行股份有限公司193129.067210.034--中国邮政储蓄银行股份有限公司189602.039801.03534宝山钢铁股份有限公司185710.298965.513632中国神华能源股份有限公司183127.022712.03738上海浦东发展银行股份有限公司160792.053099.03839美的集团股份有限公司159841.714684.363937兴业银行股份有限公司157060.053850.04036中国民生银行股份有限公司155211.047843.04151保利房地产(集团)股份有限公司154773.2812421.554252碧桂园控股有限公司153086.9811516.824357腾讯控股有限公司151938.041095.04441苏宁云商集团股份有限公司148585.33704.414533中国海洋石油有限公司146490.0637.04635新华人寿保险股份有限公司146173.04942.04745厦门建发股份有限公司145590.892854.664850中国铝业股份有限公司144065.52402.494962阿里巴巴集团控股有限公司143878.038393.05040万洲国际有限公司143035.296881.425142中国太平保险控股有限公司142489.54085.852--广汇汽车服务股份公司135422.262802.953--华润医药集团有限公司134108.312414.565447上海建工集团股份有限公司133656.542095.55546东风汽车集团股份有限公司122422.013355.05655上海医药集团股份有限公司120764.663196.395798厦门象屿股份有限公司119066.86426.445865青岛海尔股份有限公司119065.835036.655969北京汽车股份有限公司116198.986366.936053中国南方航空股份有限公司114792.05055.06154中国国际航空股份有限公司113963.996814.026244华能国际电力股份有限公司113814.248814.296358珠海格力电器股份有限公司110113.115420.966456TCL集团股份有限公司106617.861602.136572比亚迪股份有限公司103470.05052.156684兖州煤业股份有限公司101982.212064.586759中国建材股份有限公司101546.781058.176860中兴通讯股份有限公司101233.18-2357.426970中国葛洲坝集团股份有限公司100254.153395.317076长城汽车股份有限公司98615.710551.167163中国东方航空股份有限公司98560.04508.07290厦门国贸集团股份有限公司98076.571043.27377中国华融资产管理股份有限公司95207.7219613.467464中国光大银行股份有限公司94037.030329.07567华润置地有限公司93562.516688.857679潍柴动力股份有限公司93183.522441.197768中国再保险(集团)股份有限公司92364.445146.057874中国信达资产管理股份有限公司91657.2315512.167971中国通信服务股份有限公司88449.362536.258066铜陵有色金属集团股份有限公司86674.1180.328175上海电气集团股份有限公司79078.362060.178278紫金矿业集团股份有限公司78851.141839.88386重庆长安汽车股份有限公司78542.4410285.2884105中国航油(新加坡)股份有限公司77736.11590.558589国美电器控股有限公司76695.02325.148683中国粮油控股有限公司76305.271214.587112远大产业控股股份有限公司75752.13390.948880河钢股份有限公司74551.011555.488973复星国际有限公司73966.5610268.1890102中升集团控股有限公司71599.221860.2391108中远海运控股股份有限公司71160.18-9906.09287百度股份有限公司70549.3611632.2793163昆仑能源有限公司70074.62563.979481中国长城科技集团股份有限公司69128.1633.1595127京东方科技集团股份有限公司68895.661882.579688四川长虹电器股份有限公司67175.34554.7897111庞大汽贸集团股份有限公司66009.4381.6998103华夏银行股份有限公司64025.019677.099124招商局蛇口工业区控股股份有限公司63572.839581.4210082华电国际电力股份有限公司63346.053344.44101122九州通医药集团股份有限公司61556.84876.7410295新希望六和股份有限公司60879.522469.07103101中国中煤能源股份有限公司60631.612026.5310496内蒙古伊利实业集团股份有限公司60609.225661.81105128广东温氏食品集团股份有限公司59355.2411789.88106107世茂房地产控股有限公司59286.165171.86107110云南铜业股份有限公司59194.82203.4310894大唐国际发电股份有限公司59124.32-2623.33109114国电电力发展股份有限公司58416.054727.28110147深圳市怡亚通供应链股份有限公司58290.5518.75111116鞍钢股份有限公司57882.01616.0112--顺丰控股股份有限公司57482.74180.4311385山西太钢不锈钢股份有限公司56738.191145.6611499华润电力控股有限公司56664.736596.83115146唯品会控股有限公司56591.32036.82116--白银有色集团股份有限公司55949.6251.52117118安徽海螺水泥股份有限公司55931.98529.92118170金地(集团)股份有限公司55508.56300.46119130龙湖地产有限公司54799.59152.95120154华夏幸福基业股份有限公司53820.596491.58121126中国蒙牛乳业有限公司53779.34-751.16122134广州富力地产股份有限公司53730.346755.91123186吉利汽车控股有限公司53721.585112.412492中国化学工程股份有限公司53075.761770.38125120云南云天化股份有限公司52633.73-3359.49126131安徽江淮汽车集团股份有限公司52529.391161.97127129深圳市飞马国际供应链股份有限公司52162.861531.98128121新兴铸管股份有限公司52159.88440.22129100中国船舶重工股份有限公司52064.13698.03130104中国国际海运集装箱(集团)股份有限公司51111.65539.66131--中国石油集团工程股份有限公司50659.441287.5413291国机汽车股份有限公司50584.79613.86133115中国中材股份有限公司50576.87585.44134153山东黄金矿业股份有限公司50198.851292.78135--常林股份有限公司50172.73206.66136152山东钢铁股份有限公司50142.94-599.89137142湖南华菱钢铁股份有限公司49949.62-1055.17138190广州汽车集团股份有限公司49417.686288.22139140光汇石油(控股)有限公司49361.511522.43140141永辉超市股份有限公司49231.651242.01141149山煤国际能源集团股份有限公司49159.76307.68142225中国长江电力股份有限公司48939.3920781.18143123深圳市爱施德股份有限公司48333.28187.75144133马鞍山钢铁股份有限公司48275.11228.89145119北京控股有限公司47889.575336.67146143北京金隅股份有限公司47738.772686.65147136北京银行股份有限公司47456.017802.0148125上海百联集团股份有限公司47077.24900.36149132中国外运股份有限公司46784.191629.47150139雅居乐集团控股有限公司46678.862283.64151166北汽福田汽车股份有限公司46532.07566.83152196荣盛石化股份有限公司45501.071920.79153117大秦铁路股份有限公司44624.887168.49154--重庆建工集团股份有限公司43205.23294.6415597中石化石油工程技术服务股份有限公司42923.5-16114.76156296北京首钢股份有限公司41850.41400.96157144百丽国际控股有限公司41706.52403.4158--中国核工业建设股份有限公司41508.51798.52159253上海钢联电子商务股份有限公司41278.9922.1160145上海华谊集团股份有限公司41028.8418.316193五矿发展股份有限公司40733.5928.95162162海南航空股份有限公司40678.133138.26163137中化国际(控股)股份有限公司40656.7557.25164--神州数码集团股份有限公司40531.12403.8165192厦门信达股份有限公司40290.75139.79166168贵州茅台酒股份有限公司40155.0816718.36167158特变电工股份有限公司40117.492190.35168157大昌行集团有限公司39762.18437.31169--中石化炼化工程(集团)股份有限公司39375.431662.88170148浙江浙能电力股份有限公司39176.616277.07171159中金黄金股份有限公司38928.03362.37172150中国大冶有色金属矿业有限公司38915.71-163.48173240网易公司38178.8411604.52174--天津天海投资发展股份有限公司37561.21321.51175207中国航空科技工业股份有限公司36627.771118.96176164创维数码控股有限公司36556.581798.5177176郑州宇通客车股份有限公司35850.444043.75178172深圳华侨城股份有限公司35481.16888.42179238融创中国控股有限公司35343.492478.35180113甘肃酒钢集团宏兴钢铁股份有限公司35093.8582.42181161老凤祥股份有限公司34963.781057.49182182玖龙纸业(控股)有限公司34907.272724.4183180远洋集团控股有限公司34551.243812.23184265江苏中南建设集团股份有限公司34439.59407.72185--上海银行股份有限公司34408.8114308.26186173新奥能源控股有限公司34103.02151.0187187重庆百货大楼股份有限公司33846.77418.71188138天音通信控股股份有限公司33845.25223.43189222浙商银行股份有限公司33653.3410153.15190177云南锡业股份有限公司33429.06136.12191160东方电气股份有限公司33285.72-1784.31192171陕西煤业股份有限公司33131.752754.89193165中航国际控股股份有限公司33008.0806.07194258浙商中拓集团股份有限公司32975.05125.35195199中国重汽(香港)有限公司32958.9532.1196237中国广核电力股份有限公司32890.317286.93197184恒逸石化股份有限公司32419.34830.34198278金科地产集团股份有限公司32235.441395.26199151江苏汇鸿国际集团股份有限公司31983.22663.73200221杭州海康威视数字技术股份有限公司31924.027422.26201185青岛海信电器股份有限公司31832.461758.87202191中国正通汽车服务控股有限公司31519.0493.28203189上海国际港务(集团)股份有限公司31359.186939.08204--江苏银行股份有限公司31359.0410610.58205217哈尔滨电气股份有限公司31293.02413.28206242内蒙古包钢钢联股份有限公司31028.1885.03207234荣盛房地产发展股份有限公司30622.014148.09208269内蒙古西水创业股份有限公司30603.6636.0209218新馀钢铁股份有限公司30461.5502.92210181四川路桥建设集团股份有限公司30108.351044.55211276万华化学集团股份有限公司30099.863679.42212209中国核能电力股份有限公司30008.744488.67213231北京首都开发股份有限公司29883.261901.42214--江苏国泰国际集团国贸股份有限公司29738.48540.74215193本钢板材股份有限公司29526.01781.27216227中国铁路通信信号股份有限公司29402.153049.34217175国投电力控股股份有限公司29270.83916.45218178北方华锦化学工业股份有限公司29103.941803.24219212绿城中国控股有限公司28975.61917.1220--中国石油集团资本股份有限公司28830.395535.42221204上海隧道工程股份有限公司28828.471652.99222194华润啤酒(控股)有限公司28694.0629.0223228新城发展控股有限公司28232.091383.95224211华润燃气控股有限公司28169.642815.07225179大商股份有限公司28087.52702.99226155海通证券股份有限公司28011.678043.33227205西部矿业股份有限公司27776.0599.8228197申能股份有限公司27758.852460.91229383紫光股份有限公司27709.71814.82230286中国金茂控股集团有限公司27304.072535.52231215广东海大集团股份有限公司27185.31855.81232198同方股份有限公司27174.344302.33233243际华集团股份有限公司27155.341222.76234287深圳欧菲光科技股份有限公司26746.42718.83235233海信科龙电器股份有限公司26730.221087.73236223南京医药股份有限公司26720.5180.27237202联华超市股份有限公司26666.07-449.96238213柳州钢铁股份有限公司26650.4196.44239224江铃汽车股份有限公司26633.951318.02240239南京银行股份有限公司26620.678261.64241257中国东方集团控股有限公司26427.44722.13242188新疆金风科技股份有限公司26395.833002.98243259保利置业集团有限公司26170.6469.1244226中航飞机股份有限公司26121.85413.13245201青岛啤酒股份有限公司26106.341043.49246156国泰君安证券股份有限公司25764.659841.42247263中国医药健康产业股份有限公司25737.89948.14248318仁恒置地集团有限公司25664.412697.36249245航天信息股份有限公司25613.781535.94250250桐昆集团股份有限公司25581.571132.15251--耐世特汽车系统集团有限公司25521.341957.64252251华东医药股份有限公司25379.671446.59253277中铝国际工程股份有限公司24765.621144.4254394泛海控股股份有限公司24670.533109.1255252宜宾五粮液股份有限公司24543.796784.53256493渤海金控投资股份有限公司24257.552276.8257254环旭电子股份有限公司23983.88805.58258236中国食品有限公司23950.32152.16259219中国燃气控股有限公司23707.182239.31260275宁波银行股份有限公司23645.027810.42261350新疆中泰化学股份有限公司23362.321843.47262216中船海洋与防务装备股份有限公司23349.671.22263235三一重工股份有限公司23280.07203.46264267山东晨鸣纸业集团股份有限公司22907.122063.99265206一汽轿车股份有限公司22709.98-954.33266214广东电力发展股份有限公司22681.12936.53267262云南白药集团股份有限公司22410.652919.88268255中国国旅股份有限公司22389.791808.19269281内蒙古伊泰煤炭股份有限公司22317.131985.76270272龙源电力集团股份有限公司22304.063415.38271290旭辉控股(集团)有限公司22224.452807.55272232中国航发动力股份有限公司22217.29890.7273266安阳钢铁股份有限公司22044.43123.24274256广州发展集团股份有限公司22024.86668.96275249保利协鑫能源控股有限公司22024.542099.3276389乐视网信息技术(北京)股份有限公司21986.88554.76277244华润水泥控股有限公司21949.11134.67278203厦门金龙汽车集团股份有限公司21827.96-718.59279248重庆农村商业银行股份有限公司21661.717944.75280293康美药业股份有限公司21642.323340.4281297天能动力国际有限公司21480.89858.55282200中国船舶工业股份有限公司21457.07-2606.82283282超威动力控股有限公司21454.76503.8284330晶科能源控股有限公司21400.64990.67285301四川蓝光发展股份有限公司21328.81895.77286--瑞茂通供应链管理股份有限公司21233.55530.93287320江苏中天科技股份有限公司21107.951588.05288260中国机械设备工程股份有限公司21017.242106.52289311徽商银行股份有限公司20918.416870.47290367通威股份有限公司20884.051024.72291247越秀地产股份有限公司20871.021540.15292--光明房地产集团股份有限公司20781.851011.09293356泰禾集团股份有限公司20727.941707.32294169广发证券股份有限公司20712.048030.11295359龙光地产控股有限公司20538.844487.74296294大明国际控股有限公司20518.14388.22297283江苏宏图高科技股份有限公司20512.98446.88298337首创置业股份有限公司20349.42031.86299288康佳集团股份有限公司20299.3595.67300279光明乳业股份有限公司20206.75563.19301414浙江正泰电器股份有限公司20164.552184.76302280广州白云山医药集团股份有限公司20035.681508.03303261中联重科股份有限公司20022.52-933.7304309东华能源股份有限公司19975.03469.88305342金融街控股股份有限公司19852.542804.37306430携程国际有限公司19788.09-1430.7307--杭州钢铁股份有限公司19660.29725.46308284山西西山煤电股份有限公司19610.94434.08309285苏州金螳螂建筑装饰股份有限公司19600.661683.39310246阳光城集团股份有限公司19598.021230.06311346中天金融集团股份有限公司19597.052939.37312396杭州滨江房产集团股份有限公司19452.251398.81313--上海东方明珠新媒体股份有限公司19445.492934.01314361中芯国际集成电路制造有限公司19356.862501.69315375江苏亨通光电股份有限公司19307.891316.39316372歌尔股份有限公司19287.811651.5317264恒安国际集团有限公司19277.43471.75318--恒力石化股份有限公司19239.961179.83319--江苏长电科技股份有限公司19154.53106.33320273中国有色金属建设股份有限公司19114.36296.01321--安徽华信国际控股股份有限公司19027.66368.04322241阿特斯太阳能有限公司18951.0433.4323322上海实业控股有限公司18940.362484.41324323江西正邦科技股份有限公司18920.141045.96325325信利国际有限公司18888.81497.96326268中国电力国际发展有限公司18866.152365.87327300金正大生态工程集团股份有限公司18736.461016.95328316阳泉煤业(集团)股份有限公司18701.42429.05329--宁波均胜电子股份有限公司18552.41453.69330345深圳控股有限公司18274.752713.38331291宝业集团股份有限公司18196.13526.93332379中粮地产(集团)股份有限公司18025.19720.15333376浙江海亮股份有限公司17999.62551.25334341金发科技股份有限公司17990.85737.29335354中国润东汽车集团有限公司17972.99273.52336315达利食品集团有限公司17841.893136.79337306王府井集团股份有限公司17795.12574.83338--佳兆业集团控股有限公司17771.52-612.38339304武汉武商集团股份有限公司17689.64991.63340274延长石油国际有限公司17602.84-229.12341--中信建投证券股份有限公司17584.725259.25342--北京三聚环保新材料股份有限公司17531.11617.05343380烽火通信科技股份有限公司17361.08760.43344340广深铁路股份有限公司17280.51158.25345305天虹商场股份有限公司17272.96524.11346344浙江英特集团股份有限公司17257.3386.85347349中国联塑集团控股有限公司17221.051922.03348331江苏洋河酒厂股份有限公司17183.115827.17349412上海锦江国际酒店(集团)股份有限公司17013.12758.45350339海澜之家股份有限公司16999.593122.65351208华泰证券股份有限公司16917.026270.61352302河南神火煤电股份有限公司16902.32342.14353317徐工集团工程机械股份有限公司16891.23208.58354329北京大北农科技集团股份有限公司16840.94882.68355--圆通速递股份有限公司16817.831371.94356--江苏国信股份有限公司16815.01077.56357327中国忠旺控股有限公司16695.542871.38358381五菱汽车集团控股有限公司16677.7140.46359377福耀玻璃工业集团股份有限公司16621.343144.23360298阳煤化工股份有限公司16591.92-908.52361351内蒙古鄂尔多斯资源股份有限公司16591.21265.63362--五矿资源有限公司16531.36-1014.28363109上海物资贸易股份有限公司16422.4414.71364429锦州银行股份有限公司16413.858129.59365366山东恒邦冶炼股份有限公司16397.42203.32366321宁波舟山港股份有限公司16325.332298.92367335南京新街口百货商店股份有限公司16275.69399.86368373时代地产控股有限公司16206.451955.02369--重庆小康工业集团股份有限公司16192.43513.52370--易见供应链管理股份有限公司16178.64603.06371364盛京银行股份有限公司16113.886864.52372310上海电力股份有限公司16046.44916.46373174中远海运发展股份有限公司15964.91368.59374348华电福新能源股份有限公司15917.032023.03375450上海龙宇燃油股份有限公司15882.427.37376270国电科技环保集团股份有限公司15775.32435.38377370唐山三友化工股份有限公司15756.8762.86378378晶澳太阳能控股有限公司15736.88683.7379357理文造纸有限公司15696.812449.94380494天津泰达股份有限公司15631.81270.87381488瑞康医药股份有限公司15618.67590.76382336云南铝业股份有限公司15543.31110.53383343步步高商业连锁股份有限公司15520.28132.7384365东方国际创业股份有限公司15378.14148.86385324中百控股集团股份有限公司15366.356.47386299中储发展股份有限公司15293.06767.44387328江河创建集团股份有限公司15239.59351.56388307蓝思科技股份有限公司15236.121203.59389289湖北宜化化工股份有限公司15181.93-1249.45390338北京迪信通商贸股份有限公司15177.17356.41391230中海油田服务股份有限公司15152.19-11456.19392390宝胜科技创新股份有限公司15126.7265.67393395申洲国际集团控股有限公司15099.082947.67394333扬子江船业(控股)有限公司15089.441752.43395312深圳市中金岭南有色金属股份有限公司15085.65323.23396347深圳长城开发科技股份有限公司15069.17214.42397--景瑞控股有限公司15051.28106.3398210中化化肥控股有限公司14959.09-4635.88399360雅戈尔集团股份有限公司14895.03684.75400432北控水务集团有限公司14852.272761.68401183申万宏源集团股份有限公司14719.985409.06402406平顶山天安煤业股份有限公司14712.79753.26403363北京京能清洁能源电力股份有限公司14635.841955.57404458舜宇光学科技(集团)有限公司14611.781270.75405332龙元建设集团股份有限公司14588.48348.42406407湖北兴发化工集团股份有限公司14541.19102.02407405凌源钢铁股份有限公司14462.73133.94408452山东太阳纸业股份有限公司14455.491056.76409--上海大生农业金融科技股份有限公司14364.87307.08410418宝龙地产控股有限公司14295.622464.68411313中国雨润食品集团有限公司14293.66-2004.17412--重庆市迪马实业股份有限公司14269.3776.75413411海马汽车集团股份有限公司14239.28230.23414438山西潞安环保能源开发股份有限公司14229.37857.14415--中华企业股份有限公司14196.75655.46416384中国西电电气股份有限公司14173.821127.89417416哈尔滨银行股份有限公司14171.974876.6418334哈药集团股份有限公司14126.89788.1419400福建三钢闽光股份有限公司14117.93926.53420292云南驰宏锌锗股份有限公司14104.4-1652.91421308天津港发展控股有限公司14083.89453.98422440广东韶钢松山股份有限公司13972.87101.43423388天士力医药集团股份有限公司13945.51176.42424420远东宏信有限公司13928.372882.21425489河南中孚实业股份有限公司13915.5458.0426456合生创展集团有限公司13911.633310.6427409上海梅林正广和股份有限公司13833.59256.49428--长江出版传媒股份有限公司13789.4592.17429470立讯精密工业股份有限公司13762.61156.53430--杭州银行股份有限公司13732.844020.93431353上海世茂股份有限公司13708.032118.83432455永泰能源股份有限公司13699.16669.04433386宁波建工股份有限公司13695.8195.39434466禹洲地产股份有限公司13671.831774.91435374玉柴国际有限公司13664.84515.74436462天虹纺织集团有限公司13647.741187.53437402冀中能源股份有限公司13635.66243.98438424新湖中宝股份有限公司13626.245838.46439443深圳市海王生物工程股份有限公司13605.92418.4440446河南豫光金铅股份有限公司13565.5176.42441423中粮屯河糖业股份有限公司13557.15515.05442410中国生物制药有限公司13543.411637.38443387华新水泥股份有限公司13525.76451.94444--苏州胜利精密制造科技股份有限公司13476.86429.42445--供销大集集团股份有限公司13424.74401.4446--中茵股份有限公司13416.9147.98447442安踏体育用品有限公司13345.762385.55448473浙江大华技术股份有限公司13329.091825.2449--珠海华发实业股份有限公司13298.911018.38450--中国银河证券股份有限公司13239.925153.55451371山东南山铝业股份有限公司13227.891312.73452--北大资源(控股)有限公司13174.44-238.24453391长春欧亚集团股份有限公司13023.6327.29454393中远海运能源运输股份有限公司13005.571922.51455362天地科技股份有限公司12936.85931.88456358银座集团股份有限公司12845.322.08457--大连港股份有限公司12814.48531.01458--上海陆家嘴金融贸易区开发股份有限公司12807.152648.74459425中文天地出版传媒股份有限公司12775.841295.36460195国信证券股份有限公司12748.94556.15461--盛屯矿业集团股份有限公司12710.02188.56462369株洲冶炼集团股份有限公司12685.2420.69463471浪潮电子信息产业股份有限公司12667.75287.02464399中航直升机股份有限公司12521.51439.16465481宁波华翔电子股份有限公司12505.96713.89466457宜宾天原集团股份有限公司12501.8655.14467459中骏置业控股有限公司12480.682072.28468434佛山市海天调味食品股份有限公司12458.562843.13469382北京华联综合超市股份有限公司12358.21-260.44470355浙江龙盛集团股份有限公司12355.532029.01471444唐山冀东水泥股份有限公司12335.1552.89472474人福医药集团股份公司12330.95832.4473--山东步长制药股份有限公司12320.881769.36474--北京蓝色光标品牌管理顾问股份有限公司12319.11639.68475422远东智慧能源股份有限公司12242.76286.72476482安徽山鹰纸业股份有限公司12134.81352.8477454北京同仁堂股份有限公司12090.74933.17478--广东江粉磁材股份有限公司12051.5234.07479--协鑫集成科技股份有限公司12026.72-26.91480478长春一汽富维汽车零部件股份有限公司11992.48427.27481326海洋石油工程股份有限公司11991.681315.31482428北京京客隆商业集团股份有限公司11881.5726.69483490辽宁禾丰牧业股份有限公司11870.58426.98484--合力泰科技股份有限公司11844.85873.79485--中国奥园地产集团股份有限公司11827.27880.96486--航天通信控股集团股份有限公司11823.3225.42487417天津银行股份有限公司11814.744522.05488435阜丰集团有限公司11803.131092.51489464开滦能源化工股份有限公司11728.77431.7490220招商证券股份有限公司11695.455403.45491--五矿资本股份有限公司11646.911557.06492--北京城建投资发展股份有限公司11627.831443.56493401北京燕京啤酒股份有限公司11573.2312.08494--航天时代电子技术股份有限公司11548.06478.37495--隆基绿能科技股份有限公司11530.531547.24496468中建西部建设股份有限公司11529.49316.31497--安徽水利开发股份有限公司11477.43305.64498491国电南瑞科技股份有限公司11415.281447.18499--融信中国控股有限公司11371.661292.34500385亨得利控股有限公司11323.38-10.13
--------------------------------------------------------------------------------
/news-emotion-master/data/trainset/pos_595491.txt:
--------------------------------------------------------------------------------
1 | 中新社北京8月1日电 (夏宾)8月首日,人民币汇率延续了7月份的上涨势头。 8月1日,中国官方报人民币对美元汇率中间价6.7148,较前一交易日上调135个基点,创下逾9个半月最高值,也是自2016年10月14日以来,人民币中间价首次涨回至6.71区间。资料图:山西太原,银行工作人员清点货币。中新社记者 张云 摄 当天早盘外汇市场上,在岸、离岸人民币对美元即期汇率亦涨势如虹,两者均突破6.72一线,截至北京时间10时30分,在岸、离岸人民币汇率分别报6.7176、6.7189。 美元指数则未能摆脱下行趋势。7月31日,美元指数尾盘跌破93整数关口,8月1日,美元指数最低触及92.82。 从此前整个7月份来看,人民币汇率中间价升值0.68%,而美元指数下跌2.95%,创下2016年3月以来的最大单月跌幅,也是美元指数连续第五个月下跌。 FXTM富拓研究分析师Lukman Otunuga表示,由于美联储近期对通胀的谨慎看法打击了美元,投资者对新兴市场的兴趣重燃,亚洲货币开始走高。尽管市场已普遍预料到美联储7月份将保持货币政策不变,但美联储对下一次加息可能的时机无明确表态也提振了新兴市场货币。 Lukman Otunuga认为,随着中国经济继续向好,加之若美元继续走软,人民币有望进一步上涨,而美国政治风波不断将令美元继续承压。(完)
--------------------------------------------------------------------------------
/news-emotion-master/demo.py:
--------------------------------------------------------------------------------
1 | # coding=utf8
2 |
3 | import os
4 | import pickle
5 | import numpy as np
6 | import operate_data as od
7 | import ml_model as ml
8 | from news import ret_news
9 | # from supplier_news import supl_news
10 | import supplier_news as sp
11 |
12 | VECTOR_MODE = {'onehot': 0, 'wordfreq': 1, 'twovec': 2, 'tfidf': 3, 'outofdict': 4}
13 |
14 | def save_model(best_vector,best_model):
15 | """
16 | 存储效果最好的模型
17 | 需要手动指明参数名字
18 | :param best_vector: 最好的文本->词向量的方法
19 | :param best_model: 最好的机器学习模型
20 | :return: info
21 | """
22 | od.loadStopwords()
23 | od.loadEmotionwords()
24 | od.loadWords(od.stopList)
25 | od.loadDocument(od.stopList)
26 | xpath = os.path.join('result', 'vector', 'resultX.npz')
27 | ypath = os.path.join('result', 'vector', 'resultY.npz')
28 | resultX = np.load(xpath)
29 | resultY = np.load(ypath)
30 | new_x, new_y = od.twoTag(resultX[best_vector], resultY[best_vector])
31 | model_saved = ml.linearLogistic(new_x, new_y)
32 | path = os.path.join('model','wordfreq_logistic.ml')
33 | with open(path,'wb') as f:
34 | pickle.dump(model_saved,f)
35 | print("Save over")
36 |
37 | class Predictor(object):
38 | """
39 | 更多的使用说明请去看README.md
40 | """
41 | def __init__(self):
42 | self._model = None
43 | self.news = None
44 | self.__tag = None
45 | self._vec = None
46 | self.mode = None
47 |
48 | def load_model(self,path=None):
49 | if not path:
50 | path = os.path.join('model','wordfreq_logistic.ml')
51 |
52 | with open(path,'rb') as f:
53 | self._model = pickle.load(f)
54 |
55 | def set_mode(self,mode):
56 | if isinstance(mode,int):
57 | assert mode in VECTOR_MODE.values(), "没有这种vector方式"
58 | if isinstance(mode,str):
59 | assert mode in VECTOR_MODE.keys(), "没有这种vector方式"
60 | mode = VECTOR_MODE[mode]
61 | self.mode = mode
62 |
63 | def set_news(self,news):
64 | if not len(news):
65 | print("请输入有效的新闻文本,谢谢")
66 | return
67 | self.news = news
68 |
69 | def trans_vec(self):
70 | vec_list = od.words2Vec(self.news,od.emotionList,od.stopList,od.posList,od.negList,mode=self.mode)
71 | self._vec = np.array(vec_list).reshape(1,-1)
72 |
73 | # 调用的时候计算函数
74 | def __call__(self, *args, **kwargs):
75 | self.__tag = self._model.predict(self._vec)
76 | return self.__tag
77 |
78 | def get_tag(self):
79 | return self.__tag
80 |
81 |
82 | def test(reload=False):
83 | if reload:
84 | best_vector = "wordfreq"
85 | best_model = 1 # linearLogistic
86 | save_model(best_vector, best_model)
87 | else:
88 | od.loadStopwords()
89 | od.loadEmotionwords()
90 | od.loadWords(od.stopList)
91 | od.loadDocument(od.stopList)
92 |
93 | predictor = Predictor()
94 | predictor.load_model()
95 | predictor.set_mode(mode="wordfreq")
96 |
97 | news = " 《经济通通讯社13日专讯》日股早市偏软,日经225指数报18312跌239点。 美元兑日圆疲软,新报108﹒78╱80。(tt) "
98 | news = " 周二,恒生指数收报20356.24点,跌236.76点,跌幅1.15%;国企指数收报10596.91点,跌148点,跌幅1.38%;大市成交492.76亿港元。美国3月非农就业数据表现疲弱,拖累隔夜欧美股市全线受压。中国3月份CPI同比增长3.6%,令货币政策在短期内放宽预期降低。港股早盘随外围低开两百多点,但是A股在汇金增持内银股刺激下探底回升,对港股起到支持,之后恒指于低位维持窄幅震荡整理,最终跌逾1%。银行股全线走软。四大内银股方面,工商银行跌0.4%,中国银行跌0.64%,建设银行跌0.67%,农业银行跌1.2%;国际金融股方面,汇丰控股跌1.75%,渣打集团跌1.89%。美国就业市场增长放缓及内地通胀反弹,投资者对经济信心下降。中国央行短期内下调存准机会大减,从而利淡大市气氛。预计港股本周将继续在20200至20700点之间震荡。 " # 待转化的文本
99 |
100 | predictor.set_news(news=news)
101 | predictor.trans_vec()
102 |
103 | tag = predictor()
104 | print("算出来的和是",sum(predictor._vec[0]))
105 | print("打标的结果是:",tag)
106 |
107 |
108 | def news_emotion(news_data):
109 | emotion = 0
110 | num = 0
111 | for i in news_data:
112 | # print(i['news'])
113 | news = i['news']
114 | try:
115 | predictor.set_news(news=news)
116 | predictor.trans_vec()
117 |
118 | tag = predictor() # 分类结果
119 | emotion = tag + emotion
120 | except (TypeError, ValueError) as e:
121 | pass
122 | num = num + 1
123 | # emotion = emotion/num
124 | return emotion
125 |
126 |
127 | if __name__=='__main__':
128 | od.loadStopwords()
129 | od.loadEmotionwords()
130 | od.loadWords(od.stopList)
131 | od.loadDocument(od.stopList)
132 | ##### 单例模式 #####
133 | predictor = Predictor()
134 | predictor.load_model()
135 | predictor.set_mode(mode="wordfreq") # 以上代码是初始化配置,只需要调用一次
136 |
137 | ##### 下面的代码可以循环调用 #####
138 | # news = " 《经济通通讯社13日专讯》日股早市偏软,日经225指数报18312跌239点。 美元兑日圆疲软,新报108﹒78╱80。(tt)" # 这是您的新闻样本
139 |
140 | txtnews = sp.apple_news()
141 | # print("apple:", news_emotion(txtnews))
142 | print(news_emotion(txtnews))
143 |
144 | txtnews = sp.sunway_news()
145 | # print("sunway:", news_emotion(txtnews))
146 | print(news_emotion(txtnews))
147 |
148 | txtnews = sp.goworld_news()
149 | # print("goworld:", news_emotion(txtnews))
150 | print(news_emotion(txtnews))
151 |
152 | txtnews = sp.sunwoda_news()
153 | # print("sunwoda:", news_emotion(txtnews))
154 | print(news_emotion(txtnews))
155 |
156 | txtnews = sp.dsbj_news()
157 | # print("dsbj:", news_emotion(txtnews))
158 | print(news_emotion(txtnews))
159 |
160 | txtnews = sp.hnlens_news()
161 | # print("hnlens:", news_emotion(txtnews))
162 | print(news_emotion(txtnews))
163 |
164 | txtnews = sp.luxshare_news()
165 | # print("luxshare:", news_emotion(txtnews))
166 | print(news_emotion(txtnews))
167 |
168 | txtnews = sp.goertek_news()
169 | # print("goertek:", news_emotion(txtnews))
170 | print(news_emotion(txtnews))
171 |
172 | txtnews = sp.ofilm_news()
173 | # print("ofilm:", news_emotion(txtnews))
174 | print(news_emotion(txtnews))
175 |
176 | txtnews = sp.desay_news()
177 | # print("desay:", news_emotion(txtnews))
178 | print(news_emotion(txtnews))
179 |
180 |
181 | #
182 | # # all_news = ret_news()
183 | # appl_news = ret_news()
184 | # emotion_1 = 0
185 | # for i in appl_news:
186 | # # print(i['news'])
187 | # news = i['news']
188 | # try:
189 | # predictor.set_news(news=news)
190 | # predictor.trans_vec()
191 | #
192 | # tag = predictor() # 分类结果
193 | # # print("算出来的和是", sum(predictor._vec[0]))
194 | # # print("打标的结果是:", tag)
195 | # emotion_1 = tag + emotion_1
196 | # except (TypeError, ValueError) as e:
197 | # pass
198 | # print("apple:", emotion_1)
199 | #
200 | # sunway_news = sp.sunway_news()
201 | # emotion_1 = 0
202 | # for i in sunway_news:
203 | # # print(i['news'])
204 | # news = i['news']
205 | # predictor.set_news(news=news)
206 | # predictor.trans_vec()
207 | #
208 | # tag = predictor() # 分类结果
209 | # # print("算出来的和是", sum(predictor._vec[0]))
210 | # # print("打标的结果是:", tag)
211 | # emotion_1 = tag + emotion_1
212 | # print("sunway:", emotion_1)
213 | #
214 | # goworld_news = sp.goworld_news()
215 | # emotion_1 = 0
216 | # for i in goworld_news:
217 | # # print(i['news'])
218 | # news = i['news']
219 | # predictor.set_news(news=news)
220 | # predictor.trans_vec()
221 | #
222 | # tag = predictor() # 分类结果
223 | # # print("算出来的和是", sum(predictor._vec[0]))
224 | # # print("打标的结果是:", tag)
225 | # emotion_1 = tag + emotion_1
226 | # print("goworld:", emotion_1)
227 | #
228 | # sunwoda_news = sp.sunwoda_news()
229 | # emotion_1 = 0
230 | # for i in sunwoda_news:
231 | # # print(i['news'])
232 | # news = i['news']
233 | # predictor.set_news(news=news)
234 | # predictor.trans_vec()
235 | #
236 | # tag = predictor() # 分类结果
237 | # # print("算出来的和是", sum(predictor._vec[0]))
238 | # # print("打标的结果是:", tag)
239 | # emotion_1 = tag + emotion_1
240 | # print("sunword:", emotion_1)
241 | #
242 | # dsbj_news = sp.dsbj_news()
243 | # emotion_1 = 0
244 | # for i in dsbj_news:
245 | # news = i['news']
246 | # predictor.set_news(news=news)
247 | # predictor.trans_vec()
248 | # tag = predictor() # 分类结果
249 | # emotion_1 = tag + emotion_1
250 | # print("dsbj:", emotion_1)
251 | #
252 | # hnlens_news = sp.hnlens_news()
253 | # emotion_1 = 0
254 | # for i in hnlens_news:
255 | # news = i['news']
256 | # predictor.set_news(news=news)
257 | # predictor.trans_vec()
258 | # tag = predictor() # 分类结果
259 | # emotion_1 = tag + emotion_1
260 | # print("hnlens:", emotion_1)
261 | #
262 | # luxshare_news = sp.luxshare_news()
263 | # emotion_1 = 0
264 | # for i in luxshare_news:
265 | # news = i['news']
266 | # predictor.set_news(news=news)
267 | # predictor.trans_vec()
268 | # tag = predictor() # 分类结果
269 | # emotion_1 = tag + emotion_1
270 | # print("luxshare:", emotion_1)
271 | #
272 | # goertek_news = sp.goertek_news()
273 | # emotion_1 = 0
274 | # for i in goertek_news:
275 | # news = i['news']
276 | # predictor.set_news(news=news)
277 | # predictor.trans_vec()
278 | # tag = predictor() # 分类结果
279 | # emotion_1 = tag + emotion_1
280 | # print("goertek:", emotion_1)
281 | #
282 | # ofilm_news = sp.ofilm_news()
283 | # emotion_1 = 0
284 | # for i in ofilm_news:
285 | # news = i['news']
286 | # predictor.set_news(news=news)
287 | # predictor.trans_vec()
288 | # tag = predictor() # 分类结果
289 | # emotion_1 = tag + emotion_1
290 | # print("ofilm:", emotion_1)
291 | #
292 | # desay_news = sp.desay_news()
293 | # emotion_1 = 0
294 | # for i in desay_news:
295 | # news = i['news']
296 | # predictor.set_news(news=news)
297 | # predictor.trans_vec()
298 | # tag = predictor() # 分类结果
299 | # emotion_1 = tag + emotion_1
300 | # print("desay:", emotion_1)
301 | # predictor.set_news(news=news)
302 | # predictor.trans_vec()
303 | #
304 | # tag = predictor() # 分类结果
305 | # print("算出来的和是", sum(predictor._vec[0]))
306 | # print("打标的结果是:", tag)
307 |
308 | pass
309 |
310 |
311 |
--------------------------------------------------------------------------------
/news-emotion-master/loocv_model.py:
--------------------------------------------------------------------------------
1 | # encoding:utf-8
2 | import pickle
3 | import os
4 | from collections import OrderedDict # 有序词典
5 | import numpy as np
6 | import ml_model as ml
7 | import operate_data as od
8 | import pandas as pd
9 | from pandas import DataFrame
10 |
11 | def loocv(xData,yData,mode,vecName=None):
12 | '''
13 | 留一验证
14 | :param xData: 测试样例的元素
15 | :param yData: 测试样例的标签
16 | :return: 准确率
17 | '''
18 | # 检查参数的维度
19 | assert len(xData)==len(yData),str(vecName)+":自变量/因变量维度缺失"
20 | error = 0
21 | length = len(xData)
22 | for i in range(length):
23 | lenList = [l for l in range(length)]
24 | del lenList[i]
25 | if mode==0:
26 | model = ml.neighborKNN(xData[lenList],yData[lenList])
27 | elif mode==1:
28 | model = ml.linearLogistic(xData[lenList],yData[lenList])
29 | elif mode==2:
30 | model = ml.randomForest(xData[lenList],yData[lenList])
31 | elif mode==3:
32 | model = ml.SVM(xData[lenList],yData[lenList])
33 | elif mode==4:
34 | model = ml.naiveBayes(xData[lenList],yData[lenList])
35 | if model.predict(xData[i].reshape(1,-1))!=yData[i]: # 修复Bug
36 | error+=1
37 |
38 | return 1-error/length
39 |
40 | def loocvModel():
41 | """
42 | 调用loocv()函数对各种模型组合进行留一验证
43 | :return: info
44 | """
45 | loocvPath = os.path.join('result', 'log', 'ml_rate.plk') # 最后全部的模型组合准确率存储的路径
46 | xpath = os.path.join('result', 'vector', 'resultX.npz')
47 | ypath = os.path.join('result', 'vector', 'resultY.npz')
48 | resultX = np.load(xpath)
49 | resultY = np.load(ypath)
50 | ###### 留一验证部分的代码 ######
51 | modes = 5
52 | accuracyDict = OrderedDict() # 有序词典
53 | for key in resultX.keys(): # 每个key对应一类新闻文本翻译词向量的方法
54 | print('[+][+]', key)
55 | accuracyDict[key] = []
56 | for mode in range(modes): # 5种模型机器训练模型
57 | accuracyDict[key].append(loocv(resultX[key], resultY[key], mode=mode, vecName=key))
58 | print(' [+]Model:', mode, '=> Finished')
59 |
60 | # 存储最后的代码,便于以后调用和画图
61 | with open(loocvPath, 'wb') as f:
62 | pickle.dump(accuracyDict, f)
63 | print('Finish all models')
64 |
65 | def showResult():
66 | """
67 | 将所有的准确率全部整理成csv和excel格式文件
68 | :return: info
69 | """
70 | loocvPath = os.path.join('result','log','ml_rate.plk')
71 | loocv = None
72 | with open(loocvPath,'rb') as f:
73 | loocv = pickle.load(f)
74 | # print(loocv)
75 | loocv = DataFrame(loocv,index=['KNN','Logistic','RandomForest','SVM','NBayes'])
76 | loocv.index.name = r'Model\Vector'
77 | loocv.rename(columns=str.title,inplace=True)
78 | print(loocv)
79 | resultExcel = os.path.join('result', 'show','result.xlsx')
80 | resultCSV = os.path.join('result','show','result.csv')
81 | try:
82 | loocv.to_excel(resultExcel)
83 | except Exception as e:
84 | print('Can not call packages about excel')
85 | finally:
86 | loocv.to_csv(resultCSV)
87 | print('Finish write to excel and csv files')
88 |
89 | if __name__=='__main__':
90 | loocvModel()
91 | showResult()
--------------------------------------------------------------------------------
/news-emotion-master/ml_model.py:
--------------------------------------------------------------------------------
1 | """
2 | 封装了用到的机器学习模型 和 相关的操作
3 | 1. 每个机器学习返回的是训练好的模型
4 | 2. 注意参数的shape
5 | """
6 | # encoding:utf-8
7 | import numpy as np
8 | from sklearn import linear_model
9 | from sklearn.neighbors import KNeighborsClassifier
10 | from sklearn.ensemble import RandomForestClassifier
11 | from sklearn.naive_bayes import MultinomialNB
12 | from sklearn.svm import SVC
13 |
14 | # KNN算法
15 | def neighborKNN(trainVec,trainScore):
16 | knn = KNeighborsClassifier()
17 | knn.fit(trainVec,trainScore)
18 | return knn
19 | # Logistics回归
20 | def linearLogistic(trainVec,trainScore):
21 | model = linear_model.LogisticRegression(penalty = 'l1') # 采用多分类的Logistics模型
22 | model.fit(trainVec,trainScore)
23 | return model
24 | # 随机森林
25 | def randomForest(trainVec,trainScore):
26 | model = RandomForestClassifier(max_depth=None) # 取消最大深度,防止过拟合
27 | model.fit(trainVec, trainScore)
28 | return model
29 | # 多分类支持向量机
30 | def SVM(trainVec,trainScore):
31 | model = SVC()
32 | model.fit(trainVec, trainScore)
33 | return model
34 | # 采取多项式朴素贝叶斯
35 | def naiveBayes(trainVec,trainScore):
36 | model = MultinomialNB()
37 | model.fit(trainVec,trainScore)
38 | return model
39 |
40 | def saveModel(model,modelname):
41 | """
42 | 存储训练好的模型
43 | :param model: 训练好的机器学习模型
44 | :param modelname: 模型存储路径
45 | :return: None
46 | """
47 | try:
48 | with open(modelname,'wb',encoding='utf-8') as f:
49 | f.dump(model,modelname)
50 | except Exception as error:
51 | print('模型存储失败,因为:',error)
52 |
53 | def readModel(modelname):
54 | """
55 | 读取存储的模型
56 | :param modelname: 模型的路径
57 | :return: 读取成功,返回模型;否则,返回None
58 | """
59 | try:
60 | model = None
61 | with open(modelname,'rb',encoding='utf-8') as f:
62 | model = f.load(f)
63 | except Exception as error:
64 | print('模型读取失败,因为:',error)
65 | else:
66 | return model
--------------------------------------------------------------------------------
/news-emotion-master/model/wordfreq_logistic.ml:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/model/wordfreq_logistic.ml
--------------------------------------------------------------------------------
/news-emotion-master/news.py:
--------------------------------------------------------------------------------
1 | from pymongo import MongoClient
2 | import chardet
3 |
4 |
5 | client = MongoClient('localhost', 27017)
6 | db = client.apple
7 | collection = db.news
8 | date = "2017-09"
9 | cursor = collection.find({"datetime": {"$regex": date}})
10 | # news = []
11 |
12 |
13 | def ret_news():
14 | return cursor
15 | # news = ''
16 | # for i in cursor:
17 | # # print(i)
18 | # print(i['news'])
19 | # return i['news']
20 |
21 |
22 | if __name__=='__main__':
23 | for i in cursor:
24 | # print(i)
25 | print(i['news'])
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/news-emotion-master/operate_data.py:
--------------------------------------------------------------------------------
1 | """
2 | 集合了清洗数据的函数,例如:简体繁体转化、文本向量化等
3 | """
4 | #encoding:utf-8
5 | import os
6 | import pickle
7 | import math
8 | import jieba
9 | import jieba.posseg as pseg
10 | import numpy as np
11 |
12 | try:
13 | from .clean_data.clean_html import cleanHtml
14 | except Exception as error:
15 | from clean_data.clean_html import cleanHtml
16 |
17 | try:
18 | from .clean_data.langconv import *
19 | except Exception as error :
20 | from clean_data.langconv import *
21 |
22 |
23 | dictPath = os.path.join('data','emdict','userdict') # 针对linux兼容
24 | jieba.load_userdict(dictPath) # 加载个人词典
25 | stopwordsPath = os.path.join('data','emdict','stopword.plk') # 停用词
26 | negwordsPath = os.path.join('data','emdict','negword.plk') # 消极词
27 | poswordsPath = os.path.join('data','emdict','posword.plk') # 积极词
28 | documentPath = os.path.join('data','trainset') # 训练样本的目录
29 |
30 | stopList = []
31 | emotionList = []
32 | posList = []
33 | negList = []
34 | wordsList = [] # 基于所有训练样本的词袋(针对 不基于词典 这种文本向量化方法)
35 | docList = [] # 所有文档的词语组成的2维词列表(tf-idf所需要的词列表)
36 |
37 | # 转换繁体到简体
38 | def cht_to_chs(line):
39 | line = Converter('zh-hans').convert(line)
40 | line.encode('utf-8')
41 | return line
42 |
43 | # 转换简体到繁体
44 | def chs_to_cht(line):
45 | line = Converter('zh-hant').convert(line)
46 | line.encode('utf-8')
47 | return line
48 |
49 |
50 | def clearNews(news,mode=False):
51 | '''
52 | 新闻格式一体化
53 | :param news: 包括繁体,网页格式
54 | :param mode: 默认是繁体->简体
55 | :return: 清洗后的标准格式news
56 | '''
57 | if not mode:
58 | return cleanHtml(cht_to_chs(news))
59 | else:
60 | return cleanHtml(chs_to_cht(news))
61 |
62 | # 加载停用词
63 | def loadStopwords(path = stopwordsPath):
64 | global stopList
65 | with open(stopwordsPath,'rb') as f:
66 | stopList = pickle.load(f)
67 |
68 | # 加载感情词
69 | def loadEmotionwords(*paths):
70 | global posList,emotionList,negList
71 | if not len(paths):
72 | with open(negwordsPath,'rb') as f:
73 | negList = pickle.load(f)
74 | # t.extend(pickle.load(f))
75 | with open(poswordsPath,'rb') as f:
76 | posList = pickle.load(f)
77 | # t.extend(pickle.load(f))
78 | emotionList = posList+negList
79 | else:
80 | for path in paths:
81 | with open (path,'rb') as f:
82 | emotionList = pickle.load(f)
83 |
84 | # 针对不基于词典
85 | # 直接调用一次后,然后请调用 全局变量 wordsList
86 | def loadWords(stopList,path=documentPath):
87 | global wordsList
88 | wordsSet = set()
89 | for file in os.listdir(path):
90 | news = None
91 | with open(os.path.join(path,file),'r',encoding='utf-8',errors='ignore') as f:
92 | news = f.read()
93 | noun = [word for word, flag in pseg.lcut(news) if flag.startswith('n')] # 拿到其中的名词列表
94 | news = set(jieba.cut(news))
95 | news = {word for word in news if (word not in stopList) and (word not in noun)} # 过滤停用词和名词
96 | wordsSet = news | wordsSet # 取集合并集
97 | # 最后要使用list类型,因为要保证结果的有序性
98 | wordsList = list(wordsSet)
99 | return None
100 |
101 | # 针对TF-IDF
102 | # 读取所有数据集的词,是的全局变量变成二维的List
103 | def loadDocument(stopList,path=documentPath):
104 | global docList
105 | docList = []
106 | for file in os.listdir(path):
107 | news = None
108 | with open(os.path.join(path,file),'r',encoding='utf-8') as f:
109 | news = f.read()
110 | noun = [word for word, flag in pseg.lcut(news) if flag.startswith('n')]
111 | news = list(jieba.cut(news))
112 | news = [word for word in news if (word not in stopList) and (word not in noun)] # 过滤停用词和名词
113 | docList.append(news)
114 | return None
115 |
116 |
117 | def words2Vec(news,emotionList,stopList,posList,negList,mode=0):
118 | """
119 | 新闻文本翻译成词向量
120 | :param news: 新闻文本
121 | :param emotionList: 情感词列表
122 | :param stopList: 停用词列表
123 | :param posList: 积极词列表
124 | :param negList: 消极词列表
125 | :param mode: int and [0,5)。对应不同的翻译文本的方法
126 | :return: list类型(方便之后的操作,例如,numpy.array())
127 | """
128 | # 参数类型检查
129 | assert isinstance(stopList,list) and isinstance(emotionList,list),"类型不对。Function 'word2vec' at OperateDat.py"
130 |
131 | news = clearNews(news)
132 | noun = [word for word,flag in pseg.lcut(news) if flag.startswith('n')] # 名词列表
133 |
134 | # 过滤停用词和名词
135 | newswords = list(jieba.cut(news))
136 | newswords = [word for word in newswords if (word not in stopList) and (word not in noun)]
137 |
138 | wordsVec = []
139 | # one-hot
140 | # time:O(n)
141 | if mode==0:
142 | for word in emotionList:
143 | if word in newswords: wordsVec.append(1)
144 | else: wordsVec.append(0)
145 | # frequency
146 | # time:O(n)
147 | elif mode==1:
148 | for word in emotionList:
149 | wordsVec.append(newswords.count(word))
150 | # two Vec
151 | # time:O(2*n)
152 | elif mode==2:
153 | negTimes = 0;posTimes = 0
154 | for word in posList:
155 | posTimes+=(newswords.count(word))
156 | for word in negList:
157 | negTimes+=(newswords.count(word))
158 | wordsVec.append(posTimes);wordsVec.append(negTimes)
159 | # tf-idf
160 | # time:O(2*n*n)
161 | elif mode==3:
162 | global docList # 引用加载后的全局变量
163 | docSum = len(docList) # 第一维len代表了文件数
164 | for word in emotionList:
165 | TF = 0
166 | IDF= 0
167 | times = 0
168 | for doc in docList:
169 | if word in doc: times+=1
170 | IDF = math.log10(docSum/abs(times+1))
171 | times = 0
172 | for doc in docList:
173 | times+=doc.count(word)
174 | TF = newswords.count(word)/(times+1)
175 | wordsVec.append(TF*IDF)
176 | # out-of-dict
177 | # time:O(2*n)
178 | elif mode==4:
179 | global wordsList
180 | for word in wordsList:
181 | wordsVec.append(newswords.count(word))
182 |
183 | return wordsVec
184 |
185 |
186 | def dataNormal(vecArr):
187 | '''
188 | 数据归一化
189 | :param vecArr: array类型vec向量
190 | :return: 归一化的词向量,减小影响。
191 | '''
192 | return (vecArr-vecArr.min())/(vecArr.max()-vecArr.min())
193 |
194 |
195 | def randomData(xData,yData,w=0.25,logFile=None):
196 | """
197 | 随机生成训练集和测试集
198 | :param xData: m*n narray.
199 | :param yData: n narray.
200 | :param w: 训练集和测试集分割的权重
201 | :param logFile: n list. 记录每条数据的tag(例如文件名)
202 | :return: 分割好的trainX,trainY,testX,testY[,logTrain,logTest]
203 | """
204 | np.random.seed(0) # 为了使每次的结果可以比较,要设置一个种子数
205 | if logFile:
206 | assert len(logFile)==len(xData)==len(yData),'缺少维度 at OperateData.py'
207 | else:
208 | assert len(xData)==len(yData),'缺少维度 at OperateData.py'
209 | length = len(xData)
210 | indices = np.random.permutation(length) # 对[0:length]区间的整数随机排列得到对应的index
211 | trainX = xData[indices[:(-1)*int(w*length)]] # 取出对应的index对应的元素
212 | trainY = yData[indices[:(-1)*int(w*length)]]
213 | testX = xData[indices[(-1)*int(w*length):]]
214 | testY = yData[indices[(-1)*int(w*length):]]
215 | logTrain = [logFile[i] for i in indices[:(-1)*int(w*length)]]
216 | logTest = [logFile[i] for i in indices[(-1)*int(w*length):]]
217 | if logFile:
218 | return trainX,trainY,testX,testY,logTrain,logTest
219 | return trainX,trainY,testX,testY
220 |
221 |
222 | def twoTag(x_arr,y_arr):
223 | """
224 | 针对二分类方法
225 | :param x_arr: m*n narray.
226 | :param y_arr: n narray.
227 | :return: 剔除中性样本后的新样本
228 | """
229 | new_index = (y_arr != 0)
230 | new_x = x_arr[new_index, :] # 所有中性样本
231 | new_y = y_arr[new_index]
232 | return new_x,new_y
233 |
234 | if __name__=='__main__':
235 | modes = 5 #一共5种word2vec方法
236 | loadStopwords()
237 | loadEmotionwords()
238 | loadWords(stopList)
239 | loadDocument(stopList)
240 |
241 | resultX = []
242 | resultY = []
243 | logfile = [] # 留作bug
244 | for doc in os.listdir(documentPath):
245 | if doc[:3] in ('pos','neg','neu'):
246 | logfile.append(doc)
247 |
248 | # logfile存储每个文件id和对应tag
249 | # 以后会用它计算结果3*3的矩阵
250 | with open(os.path.join('result','log','logfile.plk'),'wb') as f:
251 | pickle.dump(logfile,f) #存取
252 |
253 | for mode in range(modes):
254 | x = []
255 | y = []
256 | for doc in os.listdir(documentPath):
257 | news = None
258 | news_file_path = os.path.join(documentPath,doc)
259 | if doc[:3] in ('neg','neu','pos'):
260 | with open(news_file_path,'r',encoding='utf-8') as f:
261 | news = f.read()
262 | x.append(words2Vec(news,emotionList,stopList,posList,negList,mode=mode))
263 | if doc.startswith('neg'):
264 | y.append(-1)
265 | elif doc.startswith('neu'):
266 | y.append(0)
267 | else:
268 | y.append(1)
269 | print('In', mode, news_file_path)
270 | resultX.append(np.array(x))
271 | resultY.append(np.array(y))
272 |
273 | np.savez(os.path.join('result','vector','resultX.npz'),onehot = resultX[0],wordfreq=resultX[1],twovec=resultX[2],tfidf=resultX[3],outofdict=resultX[4])
274 | np.savez(os.path.join('result','vector','resultY.npz'),onehot = resultY[0],wordfreq=resultY[1],twovec=resultY[2],tfidf=resultY[3],outofdict=resultY[4])
275 | print('Over')
276 |
--------------------------------------------------------------------------------
/news-emotion-master/other/get_data/GetData.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import pandas as pd
3 |
4 | df = pd.read_excel('news_r.xls')
5 | id_list = []
6 | news_list = []
7 | tag_list = []
8 | for (_id,news,tag) in zip(df['id'],df['news_content'],df['tag']):
9 | if tag>0:
10 | em = 'pos'
11 | elif tag==0:
12 | em = 'neu'
13 | else:
14 | em = 'neg'
15 | txtname = "%s_%d.txt" % (em,_id)
16 | with open(txtname,'w',encoding='utf-8') as f:
17 | f.write(news)
18 |
--------------------------------------------------------------------------------
/news-emotion-master/other/more_process.py:
--------------------------------------------------------------------------------
1 | import multiprocessing
2 | import numpy as np
3 | lock = multiprocessing.Lock()
4 | def writer_proc(q):
5 | try:
6 | #if lock.acquire():
7 | print('write')
8 | q.put(1)
9 | q.put({'fe':12})
10 | q.put(np.array([1,2]))
11 | # lock.release()
12 | except:
13 | pass
14 |
15 | def reader_proc(q):
16 | try:
17 |
18 | print('read')
19 | while True:
20 | print(q.get())
21 | # lock.release()
22 | except:
23 | pass
24 |
25 | if __name__ == "__main__":
26 | q = multiprocessing.Queue()
27 | writer = multiprocessing.Process(target=writer_proc, args=(q,))
28 | reader = multiprocessing.Process(target=reader_proc, args=(q,))
29 | writer.start()
30 | reader.start()
31 |
32 | writer.join()
33 | reader.terminate()
--------------------------------------------------------------------------------
/news-emotion-master/other/paper/A Study of Synthetic Oversampling for Twitter Imbalanced Sentiment Analysis.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/other/paper/A Study of Synthetic Oversampling for Twitter Imbalanced Sentiment Analysis.pdf
--------------------------------------------------------------------------------
/news-emotion-master/other/paper/generate_sample.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import random
3 |
4 | class GenerateSample(object):
5 | def __init__(self,trainset ,topk = 10,loop = 4):
6 | self._trainset = trainset
7 | self.__size = len(self._trainset) # 样本数量
8 | self.topk = topk # 最邻近的k个元素
9 | self.loop = loop # 循环几次
10 |
11 | @classmethod
12 | def _cosSimilar(cls,arr_x,arr_y):
13 | res = GenerateSample(np.array([arr_x,arr_y])).cosSimilar(np.array(arr_x),np.array(arr_y))
14 | print(res)
15 |
16 | # 计算余弦相似度
17 | def cosSimilar(self,arr_x,arr_y):
18 | if len(arr_y) != len(arr_x):
19 | return None
20 | top_result = np.sum(arr_x * arr_y)
21 | bottom_result = np.sqrt(np.sum(arr_x**2)*np.sum(arr_y**2))
22 | return top_result/bottom_result
23 |
24 | # 返回距离index位置的向量的余弦距离
25 | def disArray(self,index = None):
26 | if (not index) or (index<0 or index>self.__size):
27 | index = np.random.randint(0,self.__size) # 如果没有index,随机分布生成
28 | # new:index是0,而距离又是[-1,1]。所以为了排序方便,直接取绝对值
29 | dis_arr = [self.cosSimilar(onevector , self._trainset[index]) for onevector in self._trainset] # 每个元素均计算
30 | return np.array(dis_arr),index
31 |
32 | # 参数是处理好的disArray
33 | def neighborArray(self,disarr):
34 | neighbor_index = np.argsort(disarr)[self.__size-self.topk:self.__size-1]
35 | return self._trainset[neighbor_index],neighbor_index
36 |
37 | # 开始生成
38 | def generate(self):
39 | dis_arr , base_index = self.disArray() # base_index 基础vector
40 | neighbor_arr, neighor_index = self.neighborArray(dis_arr)
41 | near_index = random.choice(neighor_index)
42 | near_vector = self._trainset[near_index] # 选出的最近vector
43 | # base_index && near_index 是我们选中的两个点
44 | for i in range(self.loop):
45 | alpha = np.random.rand() # 均匀分布生成系数
46 | if i % 2:
47 | alpha *= (-1) # 增加/减少扰动
48 | near_vector = near_vector + alpha*(near_vector-self._trainset[base_index])
49 | self.__baseindex = base_index
50 | self.__nearindex = near_index
51 | self.__neighborindex = neighor_index
52 | return near_vector
53 |
54 | def show(self,x_num = 1,y_num = 1):
55 | try:
56 | assert len(self._trainset[0]==2) # 这里只对2个基数的vector做展示
57 | import matplotlib as mpl
58 | import matplotlib.pyplot as plt
59 | except Exception as error:
60 | print('请安装对应版本的matplotlib')
61 | return
62 | else:
63 | mpl.rcParams['font.sans-serif'] = ['FangSong']
64 | mpl.rcParams['axes.unicode_minus'] = False
65 | plt.figure()
66 | for i in range(x_num):
67 | for j in range(y_num):
68 | plt.subplot(x_num,y_num,y_num*i+j+1)
69 | plt.scatter(self._trainset[:,0],self._trainset[:,1],color = 'blue',s = 1.5)
70 | vector = self.generate()
71 | plt.scatter(self._trainset[self.__baseindex,0],self._trainset[self.__baseindex,1],color="green",s = 10)
72 | plt.scatter(self._trainset[self.__neighborindex, 0], self._trainset[self.__neighborindex, 1], color="yellow", s=10)
73 | plt.scatter(vector[0],vector[1],color="red",s = 10)
74 | plt.show()
75 |
76 | def test(self,x_num = 5,y_num = 5):
77 | TOP = 100
78 | BOTTOM = 1
79 | SIZE = 100
80 | arr = np.array([[np.random.randint(BOTTOM, TOP), np.random.randint(BOTTOM, TOP)] for i in range(SIZE)])
81 | myclass = GenerateSample(arr)
82 | myclass.show(x_num,y_num)
83 |
84 | if __name__=='__main__':
85 | pass
--------------------------------------------------------------------------------
/news-emotion-master/other/paper/run.py:
--------------------------------------------------------------------------------
1 | if __name__=='__main__':
2 | ###### 生成样本 #####
3 | best_vector = 'outofdict'
4 | best_model = 4 # 代表Logistic回归
5 | less_index = (resultY[best_vector]==0)
6 | less_vector = resultX[best_vector][less_index,:] # 所有中性样本
7 |
8 | new_size = int(0.25*len(less_vector))
9 | new_vector = np.empty((new_size,len(less_vector[0]))) # 新生成的训练集
10 | new_tag = np.ones(new_size)
11 | # print(new_vector.shape)
12 | for index in range(new_size):
13 | my_generator = GenerateSample(less_vector,topk=5)
14 | new_vector[index] = my_generator.generate()
15 |
16 | new_x_list = resultX[best_vector].tolist()
17 | new_x_list.extend(new_vector.tolist())
18 | new_x = np.array(new_x_list) # 最新生成的训练向量
19 |
20 | new_y_list = resultY[best_vector].tolist()
21 | new_y_list.extend(new_tag.tolist())
22 | new_y = np.array(new_y_list)
23 | print(len(new_x))
24 | print(len(new_y))
25 | rate = loocv(new_x,new_y,mode = best_model)
26 | print(rate)
--------------------------------------------------------------------------------
/news-emotion-master/other/paper/testresult.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/other/paper/testresult.png
--------------------------------------------------------------------------------
/news-emotion-master/other/twotag.py:
--------------------------------------------------------------------------------
1 | if __name__=='__main__':
2 | ##### 二分类 #####
3 | best_vector = 'outofdict'
4 | best_model = 4 #
5 | new_index = (resultY[best_vector] != 0)
6 | print(new_index)
7 | print(len(new_index))
8 | new_x = resultX[best_vector][new_index,:] # 所有中性样本
9 | new_y = resultY[best_vector][new_index]
10 | rate = loocv(new_x, new_y, mode=best_model)
11 | print(rate)
--------------------------------------------------------------------------------
/news-emotion-master/result/log/3plus3arr.plk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/result/log/3plus3arr.plk
--------------------------------------------------------------------------------
/news-emotion-master/result/log/best_model/PR.json:
--------------------------------------------------------------------------------
1 | {"+": {"p": null, "r": null}, "-": {"p": null, "r": null}, ".": {"p": 0.6666666666666666, "r": 1.0}}
--------------------------------------------------------------------------------
/news-emotion-master/result/log/best_model/error_tag.json:
--------------------------------------------------------------------------------
1 | {"+2.": "At: +2.; Total 1; \n pos_594817.txt"}
--------------------------------------------------------------------------------
/news-emotion-master/result/log/logfile.plk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/result/log/logfile.plk
--------------------------------------------------------------------------------
/news-emotion-master/result/log/ml_rate.plk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/result/log/ml_rate.plk
--------------------------------------------------------------------------------
/news-emotion-master/result/show/result.csv:
--------------------------------------------------------------------------------
1 | Model\Vector,Onehot,Wordfreq,Twovec,Tfidf,Outofdict
2 | KNN,0.3666666666666667,0.33333333333333337,0.4,0.30000000000000004,0.2666666666666667
3 | Logistic,0.3666666666666667,0.4,0.43333333333333335,0.0,0.5
4 | RandomForest,0.4666666666666667,0.5666666666666667,0.43333333333333335,0.5333333333333333,0.4
5 | SVM,0.0,0.0,0.2666666666666667,0.0,0.0
6 | NBayes,0.6,0.6666666666666667,0.5333333333333333,0.5,0.6333333333333333
7 |
--------------------------------------------------------------------------------
/news-emotion-master/result/show/result.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/result/show/result.xlsx
--------------------------------------------------------------------------------
/news-emotion-master/result/vector/resultX.npz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/result/vector/resultX.npz
--------------------------------------------------------------------------------
/news-emotion-master/result/vector/resultY.npz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/news-emotion-master/result/vector/resultY.npz
--------------------------------------------------------------------------------
/news-emotion-master/run_best.py:
--------------------------------------------------------------------------------
1 | import pickle
2 | import json
3 | import os
4 | from collections import OrderedDict # 有序词典
5 | import numpy as np
6 | import ml_model as ml
7 | import operate_data as od
8 |
9 | def runBest(vector='wordfreq',m_model = ml.naiveBayes):
10 | ##### 开启记录模式的代码(只记录留一验证后准确率最高的模型) #####
11 | xpath = os.path.join('result', 'vector', 'resultX.npz')
12 | ypath = os.path.join('result', 'vector', 'resultY.npz')
13 | resultX = np.load(xpath)
14 | resultY = np.load(ypath)
15 | logpath = os.path.join('result','log','logfile.plk')
16 | logfile = None
17 | with open(logpath,'rb') as f:
18 | logfile = pickle.load(f)
19 |
20 | trainX,trainY,testX,testY,logTrain,logTest = od.randomData(resultX[vector],resultY[vector],0.1,logfile) # 选取最好的vector方法
21 | model = m_model(trainX,trainY) # 选取最好的机器训练模型
22 | predictY = [model.predict(x.reshape(1,-1))[0] for x in testX]
23 | logDict = OrderedDict()
24 | logDict['+2+'] = [];logDict['+2.'] = [];logDict['+2-'] = []
25 | logDict['-2+'] = [];logDict['-2.'] = [];logDict['-2-'] = []
26 | logDict['.2+'] = [];logDict['.2.'] = [];logDict['.2-'] = []
27 | for i in range(len(predictY)):
28 | if predictY[i] == testY[i]:
29 | if predictY[i]>0:
30 | logDict['+2+'].append(logTest[i])
31 | elif predictY[i]==0:
32 | logDict['.2.'].append(logTest[i])
33 | else:
34 | logDict['-2-'].append(logTest[i])
35 | elif predictY[i]>0 and testY[i]==0:
36 | logDict['.2+'].append(logTest[i])
37 | elif predictY[i]>0 and testY[i]<0:
38 | logDict['-2+'].append(logTest[i])
39 |
40 | elif predictY[i]<0 and testY[i]==0:
41 | logDict['.2-'].append(logTest[i])
42 | elif predictY[i]<0 and testY[i]>0:
43 | logDict['+2-'].append(logTest[i])
44 |
45 | elif predictY[i]==0 and testY[i]>0:
46 | logDict['+2.'].append(logTest[i])
47 | elif predictY[i]==0 and testY[i]<0:
48 | logDict['-2.'].append(logTest[i])
49 |
50 | with open(os.path.join('result','log','3plus3arr.plk'),'wb') as f:
51 | pickle.dump(logDict,f)
52 | print('Over')
53 |
54 | def logBest():
55 | arr = None # 存放3*3的矩阵(实际是数组)
56 | with open(os.path.join('result','log','3plus3arr.plk'),'rb') as f:
57 | arr = pickle.load(f)
58 |
59 | ErrorTag = {}
60 | key_arr = [] # 含有错误标签的键组成的数组
61 |
62 | for key in arr.keys():
63 | if key not in ('+2+','-2-','.2.') and len(arr[key]):
64 | key_arr.append(key)
65 | message = 'At: '+key+'; Total '+str(len(arr[key]))+"; \n "+",".join(arr[key])
66 | print(message)
67 | ErrorTag[key] = message
68 | with open(os.path.join('result','log','best_model','error_tag.json'),'w',encoding="utf-8") as f:
69 | json.dump(ErrorTag,f)
70 |
71 | print("="*30)
72 |
73 | for key in arr.keys():
74 | if key not in key_arr:
75 | print('At: ' + key + '; Total ' + str(len(arr[key])) + "; \n " + ",".join(arr[key]))
76 |
77 | ##### 计算PR并且写入文件 #####
78 | pr = {} #p:精确率 r:召回率
79 | if (len(arr['+2+'])+len(arr['-2+'])+len(arr['.2+'])) and (len(arr['+2+'])+len(arr['+2-'])+len(arr['+2.'])):
80 | pr['+'] = {\
81 | 'p':len(arr['+2+'])/(len(arr['+2+'])+len(arr['-2+'])+len(arr['.2+'])),\
82 | 'r':len(arr['+2+'])/(len(arr['+2+'])+len(arr['+2-'])+len(arr['+2.'])) \
83 | }
84 | else :
85 | pr['+'] = {'p' : None,'r' :None}
86 |
87 | if (len(arr['-2-'])+len(arr['+2-'])+len(arr['.2-'])) and (len(arr['-2-'])+len(arr['-2+'])+len(arr['-2.'])):
88 | pr['-'] = {\
89 | 'p':len(arr['-2-'])/(len(arr['-2-'])+len(arr['+2-'])+len(arr['.2-'])),\
90 | 'r':len(arr['-2-'])/(len(arr['-2-'])+len(arr['-2+'])+len(arr['-2.'])) \
91 | }
92 | else :
93 | pr['-'] = {'p':None,'r':None}
94 |
95 | if (len(arr['.2.'])+len(arr['+2.'])+len(arr['-2.'])) and (len(arr['.2.'])+len(arr['.2+'])+len(arr['.2-'])):
96 | pr['.'] = {\
97 | 'p':len(arr['.2.'])/(len(arr['.2.'])+len(arr['+2.'])+len(arr['-2.'])),\
98 | 'r':len(arr['.2.'])/(len(arr['.2.'])+len(arr['.2+'])+len(arr['.2-'])) \
99 | }
100 | else :
101 | pr['.'] = {'p':None,'r':None}
102 | with open(os.path.join('result','log','best_model','PR.json'),'w',encoding="utf-8") as f:
103 | json.dump(pr,f)
104 |
105 | if __name__=='__main__':
106 | best_vec = 'wordfreq'
107 | best_model = ml.naiveBayes
108 | runBest(vector = best_vec,m_model= best_model)
109 | logBest()
110 |
--------------------------------------------------------------------------------
/news-emotion-master/supplier_news.py:
--------------------------------------------------------------------------------
1 | from pymongo import MongoClient
2 | import chardet
3 |
4 | # sz300207
5 | # sz000823
6 | # sz002384
7 | # sz300433
8 | # sz002475
9 | # sz300136
10 | # sz002241
11 | # sz002456
12 | # sz000049
13 |
14 | client = MongoClient('localhost', 27017)
15 | db = client.sina
16 | collection = db.stock
17 |
18 | db = client.apple
19 | appl_collection = db.news
20 |
21 | date = "2016-01"
22 | sunwoda = collection.find({"$and": [{"symbol": {"$regex": "sz300207"}}, {"datetime": {"$regex": date}}]})
23 | goworld = collection.find({"$and": [{"symbol": {"$regex": "sz000823"}}, {"datetime": {"$regex": date}}]})
24 | dsbj = collection.find({"$and": [{"symbol": {"$regex": "sz002384"}}, {"datetime": {"$regex": date}}]})
25 | hnlens = collection.find({"$and": [{"symbol": {"$regex": "sz300433"}}, {"datetime": {"$regex": date}}]})
26 | luxshare = collection.find({"$and": [{"symbol": {"$regex": "sz002475"}}, {"datetime": {"$regex": date}}]})
27 | sunway = collection.find({"$and": [{"symbol": {"$regex": "sz300136"}}, {"datetime": {"$regex": date}}]})
28 | goertek = collection.find({"$and": [{"symbol": {"$regex": "sz002241"}}, {"datetime": {"$regex": date}}]})
29 | ofilm = collection.find({"$and": [{"symbol": {"$regex": "sz002456"}}, {"datetime": {"$regex": date}}]})
30 | desay = collection.find({"$and": [{"symbol": {"$regex": "sz000049"}}, {"datetime": {"$regex": date}}]})
31 |
32 | apple = appl_collection.find({"datetime": {"$regex": date}})
33 |
34 |
35 | def apple_news():
36 | return apple
37 |
38 |
39 | def sunwoda_news():
40 | return sunwoda
41 |
42 |
43 | def goworld_news():
44 | return goworld
45 |
46 |
47 | def dsbj_news():
48 | return dsbj
49 |
50 |
51 | def hnlens_news():
52 | return hnlens
53 |
54 |
55 | def luxshare_news():
56 | return luxshare
57 |
58 |
59 | def sunway_news():
60 | return sunway
61 |
62 |
63 | def goertek_news():
64 | return goertek
65 |
66 |
67 | def ofilm_news():
68 | return ofilm
69 |
70 |
71 | def desay_news():
72 | return desay
73 | # news = ''
74 | # x = 0
75 | # for i in cursor:
76 | # print(i['news'])
77 | # print(i['datetime'])
78 | # x = x+1
79 | # print(x)
80 |
--------------------------------------------------------------------------------
/数据报告.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iaminblacklist/Financial_Analysis/f3ce60aa2509849cd5de5b5d0a9c4b44dbedcbd6/数据报告.docx
--------------------------------------------------------------------------------