This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| 获取单支股票日线 | |
| 包括所有行情数据,每800支股票分卷 | |
| ''' | |
| import pandas as pd | |
| import zipfile | |
| def ZF(FileList_in,ZFileName_out): | |
| f = zipfile.ZipFile(ZFileName_out, 'w') | |
| for file in FileList_in: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function goNext(now){ | |
| if (now.nextElementSibling != null){ | |
| now.nextElementSibling.getElementsByTagName("a")[0].click(); | |
| } | |
| else if (now.parentNode.nextElementSibling != null){ | |
| now.parentNode.nextElementSibling.getElementsByTagName("a")[0].click(); | |
| } | |
| else if (now.parentNode.parentNode.nextElementSibling != null){ | |
| now.parentNode.parentNode.nextElementSibling.getElementsByTagName("a")[0].click(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BiliBili: | |
| var reg = /https:\S*?sig=no/; | |
| addr = reg.exec(document.getElementsByClassName("script-requirement")[0].innerHTML)[0]; | |
| window.open(addr.replace(/\\u002F/g,"/")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print("开始获取全部数据集...") | |
| q1 = query(growth,cashflow,balance,income,growth_sq,income_sq,cashflow_sq,profit_sq,asharevalue,ashareprofit,ashareoperate,asharedebt)#08~ | |
| q2 = query(growth,cashflow,balance,income,growth_sq,income_sq,cashflow_sq,profit_sq)#05~07 | |
| print("全部数据集获取完成,开始查询...") | |
| for y in range(2005,2020,1): | |
| print("开始查询"+str(y)+"年的财务数据...") | |
| for i in range(1,5,1): | |
| aaa=str(y)+"q"+str(i) | |
| days = get_trade_days(str(y)+'0101', str(y)+'1231').strftime('%Y%m%d').tolist() | |
| if y <= 2007: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print("开始.......") | |
| q = query(sport_event) | |
| print("开始查询.......") | |
| df = get_important_matters(q) | |
| print("完成查询........开始写入........") | |
| for a in range(0, len(df), 300000): | |
| if a+300000 >= len(df): | |
| dfw = df[a:len(df)-1] | |
| else: | |
| dfw = df[a:a+300000] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import zipfile | |
| def ZF(FileList_in,ZFileName_out): | |
| f = zipfile.ZipFile(ZFileName_out, 'w') | |
| for file in FileList_in: | |
| f.write(file) | |
| f.close() | |
| return ZFileName_out | |
| print("开始查询2005-2019年所有交易日的因子数据...") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Segment 1 - Open All Folders to show file trees | |
| FolderNum = document.getElementsByClassName("ml").length | |
| for (var i=0;i<FolderNum;i++) | |
| { | |
| document.getElementsByClassName("ml")[i].click() | |
| } | |
| document.getElementsByClassName("ml")[FolderNum-1].click() | |
| #Segment 2 - Find download URLs textfile and download | |
| var reg = /ys-.\.ys168\.com\/\S*\.doc[x]?/g; | |
| src = document.getElementById("mainMenu").innerHTML |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| df = pd.read_csv('population.csv',skiprows=3) | |
| df.set_index('Country Code',inplace=True) | |
| excep = ['EAP','SAS','TEA','TEC','TLA','TMN','TSA','TSS', | |
| 'IBT','IDA','IDB','OED','HIC','LTE','PRE','PST', | |
| 'IDX','SSA','LDC','ECS','HPC','LIC','LCN','LAC', | |
| 'EUU','FCS','LMY','MIC','IBD','EAR','LMC','UMC', | |
| 'EAS','SSF','MEA','ECA','ARB','MNA','NAC','EMU', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //JS获取table列 | |
| var str = null; | |
| var obj = document.getElementById(123) | |
| var len = obj.rows.length | |
| for (var i = 1;i<len;i++) | |
| { | |
| str += "\""; | |
| str += obj.rows.item(i).cells.item(0).innerHTML; | |
| str += "\","; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var courseURLList = []; | |
| var index_ID = -1; | |
| var lastHour = 0; | |
| var lastMinute = 0; | |
| var lastSecond = 0; | |
| getCourseList(); | |
| nextVideo(); | |
| var _timer = setInterval | |
| ( |
OlderNewer