使用 app inventor2 解析以下網址的資料:
https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=xml&date=&stockNo=0050
{"stat":"OK","date":"20220816","title":"111年08月 0050 元大台灣50 各日成交資訊","fields":["日期","成交股數","成交金額","開盤價","最高價","最低價","收盤價","漲跌價差","成交筆數"],"data":[["111/08/01","9,841,470","1,157,739,155","118.10","118.10","117.20","117.65","-0.35","8,720"],["111/08/02","18,600,451","2,149,115,164","116.55","116.55","115.10","115.55","-2.10","22,146"],["111/08/03","8,100,057","939,263,431","115.65","116.25","115.50","116.25","+0.70","7,600"],["111/08/04","7,108,342","826,140,065","116.35","116.80","115.20","116.55","+0.30","7,988"],["111/08/05","9,625,538","1,143,739,838","118.00","119.50","117.90","119.50","+2.95","10,809"],["111/08/08","8,966,011","1,066,313,383","119.00","119.25","118.30","119.25","-0.25","10,279"],["111/08/09","8,186,879","971,998,418","118.40","119.50","118.00","119.15","-0.10","9,920"],["111/08/10","7,796,649","919,415,561","118.00","118.20","117.50","117.90","-1.25","13,624"],["111/08/11","10,957,384","1,314,562,900","119.80","120.45","119.60","120.05","+2.15","8,947"],["111/08/12","8,598,361","1,038,027,809","120.55","121.00","120.30","120.80","+0.75","7,656"],["111/08/15","9,837,499","1,198,033,224","121.45","122.10","121.25","121.90","+1.10","10,575"],["111/08/16","10,114,278","1,235,256,112","122.00","122.30","121.90","122.10","+0.20","10,769"]],"notes":["符號說明:+/-/X表示漲/跌/不比價","當日統計資訊含一般、零股、盤後定價、鉅額交易,不含拍賣、標購。","ETF證券代號第六碼為K、M、S、C者,表示該ETF以外幣交易。"]}
App 程式簡易說明:
一、ETF平衡配置上只使用三個欄位,股票、債券及定存現金,規畫上越簡單越好,投資沒煩惱。
二、擷取資料非即時,是盤後資料,但有時會擷取錯誤,那是因為證交所不允許大量重複擷取的緣故。
程式方塊如下:
app 執行如下: