Skip to content

Instantly share code, notes, and snippets.

@lowweihong
Last active July 21, 2019 05:04
Show Gist options
  • Save lowweihong/d54e39159fb3c48a0e7a8dac08bd6fb3 to your computer and use it in GitHub Desktop.
Save lowweihong/d54e39159fb3c48a0e7a8dac08bd6fb3 to your computer and use it in GitHub Desktop.
import requests
HEADERS = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36",
"Origin": "https://www2.sgx.com",
"Referer": "https://www2.sgx.com/securities/securities-prices"}
# Start downloading stocks info from sgx
req = requests.get("https://api.sgx.com/securities/v1.1?excludetypes=bonds&params=nc,adjusted-vwap,b,bv,p,c,change_vs_pc,change_vs_pc_percentage,cx,cn,dp,dpc,du,ed,fn,h,iiv,iopv,lt,l,o,p_,pv,ptd,s,sv,trading_time,v_,v,vl,vwap,vwap-currency",
headers=HEADERS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment