示例#1
0
            def checkstock(code):

                url = 'https://www.settrade.com/C04_02_stock_historical_p1.jsp?txtSymbol={}&ssoPageId=10&selectPage=2'.format(
                    code)
                webopen = req(url)
                page_html = webopen.read()
                webopen.close()

                data = soup(page_html, 'html.parser')
                price = data.findAll('div', {'class': 'col-xs-6'})

                title = price[0].text
                stockprice = price[2].text

                change = price[3].text
                change = change.replace('\n', '')
                change = change.replace('\r', '')
                change = change.replace('\t', '')
                change = change.replace(' ', '')
                change = change[11:]

                pchange = price[4].text
                pchange = pchange.replace('\n', '')
                pchange = pchange.replace('\r', '')
                pchange = pchange.replace(' ', '')
                pchange = pchange[12:]

                update = data.findAll('span', {'class': 'stt-remark'})
                stockupdate = update[0].text
                stockupdate = stockupdate[13:]
                return [title, stockprice, change, pchange, stockupdate]
示例#2
0
 def checkmarket(code):
     url = 'https://www.settrade.com/C04_01_stock_quote_p1.jsp?txtSymbol={}&ssoPageId=9&selectPage=1'.format(
         code)
     webopen = req(url)
     page_html = webopen.read()
     webopen.close()
     data = soup(page_html, 'html.parser')
     price = data.findAll('div', {'class': 'col-xs-6'})
     title = price[0].text
     stockprice = price[2].text
     stockprice = stockprice.replace('\n', '')
     change = price[3].text
     change = change.replace('\n', '')
     change = change.replace('\r', '')
     change = change[87:]
     comvlue = data.findAll('div', {'class': 'col-xs-4'})
     comvlue = comvlue[6].text
     comvlue = comvlue.replace(',', '')
     comvlue = format(float(comvlue), '')
     comvluee = format(float(comvlue), ',')
     return [title, stockprice, change, comvlue, comvluee]
示例#3
0
 def free(code):
     url = 'https://www.settrade.com/C04_05_stock_majorshareholder_p1.jsp?txtSymbol={}&ssoPageId=14&selectPage=5'.format(code)
     webopen = req(url)
     page_html = webopen.read()
     webopen.close()
     data = soup(page_html, 'html.parser')
     freefloat = data.findAll('div',{'class':'row separate-content'})
     freefloat = freefloat[0].text
     freefloat = freefloat.replace('\n','')
     freefloat = freefloat.replace('\r','')
     freefloat = freefloat[-6:]
     freefloat = freefloat.replace('%','')
     return [freefloat]