Category Archives: Trading
Download Chinese listed Company's Balance Sheet from Hexun.com
Posted by Shawn Zhang
on January 30, 2013
No comments
I've written a perl script to fetch Balance Sheet data and export them into a Excel spreadsheet .
Pre-preparation:
use LWP::Simple -> this pacake is for scap data from web
use Excel::Writer::XLSX -> for writing excel file
Download
https://github.com/hhh6897/Hexun.Balance.Sheet
Usage :
perl hx.pl [Stock ID sperated by comma] [start year] [end year] [name of output excel spreadsheet]
Result:
Read more [...]
Get Stock Quote Price API from Yahoo Finance via Python
Posted by Shawn Zhang
on December 28, 2012
No comments
Difference against Google Finance / Sina.com
Yahoo provide more rich function regarding to the Stock API than Google / Sina.com does. particular ,it provide customize return format which customized by supply a parameter in calling URL . Full parameter specification pls refer to this link .(credit to Kelly Elias ) .
200 calls per second , you will be warned if you exceed this limits
csv file returned
No market depth as SIna.com provide
Provide stock indication such as " Earnings Read more [...]
Get Stock Quote from Goolge Web API via Python
Posted by Shawn Zhang
on December 27, 2012
No comments
Background
Google has officially announce that it won't sustain ongoing of Finance API, but there still a available API via URL API . Return data from web server is xml format . We need to parse the return text in Python and extract data .
Get the Stock Data
Google Web API format ( http://www.google.com/ig/api?stock=C ) , this will request market data for security code "C" ( Citigroup :) ) xml return result:
<xml_api_reply version="1">
<finance module_id="0" Read more [...]
Get Security Quote of Chinese Market from Sina.com via Python
Posted by Shawn Zhang
on December 27, 2012
No comments
Intro
Although articles have been written about calling security quote API of Sina.com . I'd like to take a dive into it via Python and try to setup a OO implementation. Sina.com API will offer 5-th market depth prices of Chinese Shanghai / Shenzhen Exchange Stock in real time style .
API structure
calling Sina.com Stock API can be straightforward , just type "http://hq.sinajs.cn/list=sh601012" in browser address . call back will shown as below ( click to enlarge ):
Cracking Read more [...]
Market Data Extraction from LMAX API using Regular Expression
Posted by Shawn Zhang
on August 30, 2012
2 comments
Data return from Lmax API:
"OrderBookEventImpl{instrumentId=4001, valuationBidPrice=1.25466, timeStamp=1346332015747, valuationAskPrice=1.25469, lastMarketClosePrice=1.25282, bidPrices=[PricePoint{price=1.25466, quantity=100}, PricePoint{price=1.25464, quantity=225}, PricePoint{price=1.25463, quantity=1160}, PricePoint{price=1.25462, quantity=325}, PricePoint{price=1.25461, quantity=300}], askPrices=[PricePoint{price=1.25469, quantity=50}, PricePoint{price=1.2547, quantity=125}, PricePoint{price=1.25471, Read more [...]