Target web: https://www.indopremier.com/ipotstock/liveTradeWindowed.php
web tersebut di atas mendapatkan 'kiriman' real time feeds (dalam bentuk JSON data) dari https://www.indopremier.com/module/saham/include/livetrade-streaming.php
Real time feeds akan berjalan dgn jadwal berikut:
- Senin - Kamis: 9.15 - 12.15 dan 13.45 - 16.05
- Jumat: 9.15 - 11.45 dan 14.15 - 16.05
Scraper merupakan Javascript (pakai EventSource) yg ditulis dalam PHP.
Ketika dijalankan, scraper berfungsi untuk merekam, parsing real time feeds (server mengirimkan dalam bentuk JSON data), dan menyimpan ke dalam database MySQL localhost.
contoh JSON data:
id: 0
data: {"code":"13:31:53","data":{"Time":"13:31:53","TradeCommand":"0","SecurityCode":"SMBR","BoardCode":"RG","TradeNum":"000377613023","Price":"2420","Volume":44,"BuyerCode":"CS","BuyerType":"F","SellerCode":"LG","SellerType":"D","PrevPrice":"2400","TmpVar1":"000842681006","TmpVar2":"000842603483","Chg":"20","TmpVar4":"0","TmpVar5":"1\r","fmtPrice":"2,420 ","fmtChg":"20 ","fmtVolume":"44 ","fmtLabelSector":"basic"}}
Kolom pd tabel database localhost:
- Date (YYYY-MM-DD)
- Time
- TradeCommand
- SecurityCode
- BoardCode
- TradeNum
- Price
- Volume
- BuyerCode
- BuyerType
- SellerCode
- SellerType
- PrevPrice
- TmpVar1
- TmpVar2
- Chg
- TmpVar4
- TmpVar5
- fmtPrice
- fmtChg
- fmtVolume
- fmtLabelSector
Tampilan tidak penting. Buat sesederhana mungkin.
Budget <= Rp150.000
saya punya beberapa contoh javascript dalam PHP yg mungkin bs jd acuan dan selanjutnya dikembangkan sendiri. ada di attachment.