Worldscope DB Example Securities: IBM: IBM JNJ: Johnson & Johnson Measurements: 1751: Net Income 2001: Cash 3351: total liabilities 3051: short term debt ''' import os, json, sys from tr_connect import TR tr = TR() print 'single security-single measurement' jnj = tr.query('JNJ', 'ws.1751', 'Q') print jnj print 'single security-multiple measurements' # ibm = tr.query('IBM',1751,'Q'] ibm = tr.query('IBM', ['ws.1751', 'ws.2001', 'ws.3351'], 'Q') print ibm print ibm.data.keys() print 'multiple securities-single measurments' ni_secs = tr.query(['IBM', 'APPL', 'GOOG'], 'ws.1751', 'Q')
Securities: BMW: JNJ: Johnson & Johnson Measurements: 1751: Net Income 2001: Cash 3351: total liabilities 3051: short term debt ''' import os, json,sys from tr_connect import TR tr = TR() print 'Total Return Unitless' totalreturn = tr.query('JNJ','ds.totalreturn') print 'GET DF of OHLC' ohlc = tr.query('JNJ','ds.ohlc') print 'Get TimeSeries of Singular Metric' jnj_vwap = tr.query('JNJ','ds.vwap') jnj_high = tr.query('JNJ','ds.high') jnj_low = tr.query('JNJ','ds.low') jnj_close = tr.query('JNJ','ds.close') jnj_volume = tr.query('JNJ','ds.volume') jnj_bid = tr.query('JNJ','ds.bid') jnj_ask = tr.query('JNJ','ds.ask')
Securities: BMW: JNJ: Johnson & Johnson Measurements: 1751: Net Income 2001: Cash 3351: total liabilities 3051: short term debt ''' import os, json, sys from tr_connect import TR tr = TR() print 'Total Return Unitless' totalreturn = tr.query('JNJ', 'ds.totalreturn') print 'GET DF of OHLC' ohlc = tr.query('JNJ', 'ds.ohlc') print 'Get TimeSeries of Singular Metric' jnj_vwap = tr.query('JNJ', 'ds.vwap') jnj_high = tr.query('JNJ', 'ds.high') jnj_low = tr.query('JNJ', 'ds.low') jnj_close = tr.query('JNJ', 'ds.close') jnj_volume = tr.query('JNJ', 'ds.volume') jnj_bid = tr.query('JNJ', 'ds.bid') jnj_ask = tr.query('JNJ', 'ds.ask')
Worldscope DB Example Securities: IBM: IBM JNJ: Johnson & Johnson Measurements: 1751: Net Income 2001: Cash 3351: total liabilities 3051: short term debt ''' import os, json,sys from tr_connect import TR tr = TR() print 'single security-single measurement' jnj = tr.query('JNJ','ws.1751','Q') print jnj print 'single security-multiple measurements' # ibm = tr.query('IBM',1751,'Q'] ibm = tr.query('IBM',['ws.1751','ws.2001','ws.3351'],'Q') print ibm print ibm.data.keys() print 'multiple securities-single measurments' ni_secs = tr.query(['IBM','APPL','GOOG'],'ws.1751','Q')
''' TR Connect Plotting Example Securities: IBM: IBM JNJ: Johnson & Johnson Measurements: 1751: Net Income 2001: Cash 3351: total liabilities 3051: short term debt ''' import os, json, sys from tr_connect import TR tr = TR() jnj = tr.query('JNJ', 'ws.1751', 'Q') print jnj # ibm = tr.query('IBM',1751,'Q'] ibm = tr.query('IBM', ['ws.1751', 'ws.2001', 'ws.3351'], 'Q') print ibm print ibm.data.keys() fig = ibm.plot('ws.1751', 'Net Income')
''' TR Connect Plotting Example Securities: IBM: IBM JNJ: Johnson & Johnson Measurements: 1751: Net Income 2001: Cash 3351: total liabilities 3051: short term debt ''' import os, json,sys from tr_connect import TR tr = TR() jnj = tr.query('JNJ','ws.1751','Q') print jnj # ibm = tr.query('IBM',1751,'Q'] ibm = tr.query('IBM',['ws.1751','ws.2001','ws.3351'],'Q') print ibm print ibm.data.keys() fig = ibm.plot('ws.1751','Net Income')