Skip to content

Instantly share code, notes, and snippets.

@kevin3
kevin3 / commSGX.py
Created March 8, 2013 19:28
commission calculator for two typical online trading platforms for SGX in SGD, Standard Chartered Bank and Lim & Tan Disclaimer: the values calculated work for me but I have noticed the values differ a bit due to rounding
#Sample Contract Value
vol=1000
price=10
volprice=vol*price
def commSCB(volprice):
"SCB commission is fixed 0.2%"
brokerage=volprice*0.2/100
clearingfee=0.04/100*volprice
#no SGX trading fee
@kevin3
kevin3 / StockTradingRange.R
Created March 4, 2013 16:36
R code to retrieve the trading range for a stock on a historical date using quantmod library
library('quantmod')
#loadSymbols of the stock codes you are interested in
loadSymbols(c('K17.SI','BN4.SI'))
#retrieves the values for a single date
BN4.SI['2013-01-25']
#K17.SI['2013-03-04']
#Convert the matrix retrieved as a data.frame for easier data usage