Skip to content

Instantly share code, notes, and snippets.

@rs6000
Created May 20, 2018 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rs6000/882f6a9b510530f60f64f1ffb4601098 to your computer and use it in GitHub Desktop.
Save rs6000/882f6a9b510530f60f64f1ffb4601098 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@murphy-8888
Copy link

胖虎大哥您好,想請問一下,證交所的網址為:https://www.twse.com.tw/zh/page/trading/fund/BFI82U.html
而您的來源網址為: http://www.twse.com.tw/fund/BFI82U?response=html&dayDate={0}
請問是為甚麼呢?
再麻煩您解惑了,感恩感恩!!!

@rs6000
Copy link
Author

rs6000 commented Jun 26, 2020

程式是2018年寫的,現在還能不能跑,不確定
但你問的是程式的流程...所以就回答這部分

url="http://www.twse.com.tw/fund/BFI82U?response=html&dayDate={0}"
dfs=pd.read_html(url.format('20180515'))

第一行 Date={0}
是要給第二行代入日期,因為這個程式可以 設定查詢資料的日期
第二行
url.format('20180515') <=裡面的數字可以自訂

@murphy-8888
Copy link

瞭解了,感謝您的回答! 而且程式還可以跑喔
那我還想請問,您一開始是怎麼從 https://www.twse.com.tw/zh/page/trading/fund/BFI82U.html (證交所的網址)
變成您程式的網址哩? http://www.twse.com.tw/fund/BFI82U?response=html&dayDate={0}

因為我也想從期交所去爬資料,不知道能不能知道您改網址的邏輯去改造別的網站勒?
在麻煩您了,感恩!!!

@murphy-8888
Copy link

murphy-8888 commented Apr 8, 2021

胖虎大哥您好,想請問一下,該如何拿爬到選擇權未平倉變化(https://www.wantgoo.com/option/supportresistance) 的各個數字呢? 感恩!

@rs6000
Copy link
Author

rs6000 commented Apr 8, 2021

建議用 這個網站 https://www.taifex.com.tw/cht/3/callsAndPutsDate
資料會比較好抓 ... 有excel 可以直接匯入數據
你貼玩股網的 ... 要先分析網頁的原始碼
跟你要抓的數據在哪邊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment