def form_cur_quotes_property_url_str_fr_excel(self): """ Required xls_table_extract_module. Get all the properties from excel table. Properties can be selected by comment out those properties not required. Also set the heeader: self.cur_quotes_parm_headers for the values. """ from xls_table_extract_module import XlsExtractor self.xls_property_data = XlsExtractor( fname=self.properties_excel_table, sheetname='Sheet1', param_start_key='stock_property//', param_end_key='stock_property_end//', header_key='', col_len=2) self.xls_property_data.open_excel_and_process_block_data() ## form the header self.cur_quotes_parm_headers = [ n.encode().strip() for n in self.xls_property_data.data_label_list ] ## form the url str start_str = '&f=' target_properties = ''.join([ n[0].encode().strip() for n in self.xls_property_data.data_value_list ]) self.cur_quotes_property_portion_url = start_str + target_properties
def __init__(self): super(SGXDataExtract, self).__init__() # dict will contain a tuple of website and the target tag self.retrieval_dict = { 'company_info': ('http://54.254.221.141/sgx/search?callback=jQuery111008655668143182993_1425728207793&json=%7B%22criteria%22%3A%5B%5D%7D&_=1425728207802', 'companies'), 'announcement': ('http://www.sgx.com/proxy/SgxDominoHttpProxy?timeout=100&dominoHost=http%3A%2F%2Finfofeed.sgx.com%2FApps%3FA%3DCOW_CorpAnnouncement_Content%26B%3DAnnouncementToday%26R_C%3D%26C_T%3D200', 'items'), 'ex_div_data': ('http://www.sgx.com/proxy/SgxDominoHttpProxy?timeout=100&dominoHost=http%3A%2F%2Finfofeed.sgx.com%2FApps%3FA%3DCow_CorporateInformation_Content%26B%3DCorpDistributionByExDate%26S_T%3D1%26C_T%3D400', 'items'), 'curr_price': ('http://sgx.com/JsonRead/JsonData?qryId=RStock&timeout=30', 'items'), } ## for short sell information. self.shortsell_info_start_url = 'http://sgx.com/wps/wcm/connect/sgx_en/home/market_info/short_sale/short_sale_daily/DailyShortSell' self.shortsell_date_url = '20150417' self.shortsell_end_url = '.txt' self.shortsell_full_url = r'' ## parameters self.saved_json_file = r'c:\data\temptryyql.json' self.saved_parm_df_dict = { } #storing the final df in dict with type as keyword ## for setting up custom alerts self.custom_alert_dict_list = [] #list of dict?? self.custom_alert_df = pandas.DataFrame( ) #convert the custom alert dict to ## final output paramters self.sgx_announ_df = pandas.DataFrame() self.sgx_div_ex_date_df = pandas.DataFrame() self.sgx_curr_price_df = pandas.DataFrame() self.price_limit_alerts_df = pandas.DataFrame() self.shortsell_info_df = pandas.DataFrame() self.sgx_curr_plus_company_df = pandas.DataFrame() ## shortend output version for alert creation self.div_ex_date_shtver = '' self.filtered_announ_shtver = '' ## watchlist to set self.price_limit_reach_watchlist = [] self.announce_watchlist = [] ## target stocks for announcements -- using excel query xls_set_class = XlsExtractor( fname=r'C:\data\stockselection_for_sgx.xls', sheetname='stockselection', param_start_key='stock//', param_end_key='stock_end//', header_key='header#2//', col_len=2) xls_set_class.open_excel_and_process_block_data() self.announce_watchlist = xls_set_class.data_label_list #also get the company name self.companyname_watchlist = [ n[0].encode() for n in xls_set_class.data_value_list ] #also get the company name
if choice == 5: """ Handling current price """ w = SGXDataExtract() #w.shortsell_notification() #print w.shortsell_info_df w.process_all_data() w.sgx_curr_price_df.to_csv(r'c:\data\temp.csv', index=False) if choice == 6: """ Use excel table to get the required stocks.""" xls_set_class = XlsExtractor( fname=r'C:\data\stockselection_for_sgx.xls', sheetname='stockselection', param_start_key='stock//', param_end_key='stock_end//', header_key='header#2//', col_len=2) xls_set_class.open_excel_and_process_block_data() xls_set_class.data_label_list if choice ==7: """ use the price extract here to pull """ if choice == 8: """ Get the short sell volume. Need to get the shortsell vs the volumne traded that day Url need change with the current date