def main(): global ctx config = AppConfig.get_config() total = config.get('quota', 'total') kline = config.get('quota', 'kline') tiker = config.get('quota', 'ticker') quote = config.get('quota', 'quote') order_book = config.get('quota', 'order_book') rt_data = config.get('quota', 'rt_data') broker = config.get('quota', 'broker') ctx = ft.OpenQuoteContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) ctx.start() lf = LF(ctx) # ret_arr = lf.storeservice.find_all_stocks() # total_threads = 10 # step_length = int(len(ret_arr)/total_threads) # mode = len(ret_arr)%total_threads # for i in range(0,total_threads,1): # lf = LF(ctx) # thread_name = 'job_lf_{}'.format(i) # # start = i*step_length # if i == (total_threads-1): # end = start+step_length+mode # else: # end = start + step_length # arr = ret_arr[start:end] # # once_global_m5_task(thread_name,arr,lf) kline_total_tables = 11 kline_K_5M_total_tables = 17 for tindex in range(1,kline_total_tables+1,1): ret_arr = lf.storeservice.find_stocks('hk',tindex) lf = LF(ctx) thread_name = 'job_lf_{}'.format(tindex) once_global_m5_task(thread_name, ret_arr, lf) for tindex in range(1,kline_K_5M_total_tables+1,1): ret_arr = lf.storeservice.find_stocks('hk_5m',tindex) print(len(ret_arr)) lf = LF(ctx) thread_name = 'job_lf_5m_{}'.format(tindex) time.sleep(5) once_global_m5_task(thread_name, ret_arr, lf)
def gen_one_worker(): global ctx config = AppConfig.get_config() total = config.get('quota', 'total') kline = config.get('quota', 'kline') tiker = config.get('quota', 'ticker') quote = config.get('quota', 'quote') order_book = config.get('quota', 'order_book') rt_data = config.get('quota', 'rt_data') broker = config.get('quota', 'broker') ctx = ft.OpenQuoteContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) ctx.start() lf = LF(ctx) return lf
def main(): global ctx config = AppConfig.get_config() total = config.get('quota', 'total') kline = config.get('quota', 'kline') tiker = config.get('quota', 'ticker') quote = config.get('quota', 'quote') order_book = config.get('quota', 'order_book') rt_data = config.get('quota', 'rt_data') broker = config.get('quota', 'broker') ctx = ft.OpenQuoteContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) ctx.start() lf = LF(ctx) once_custom_task(lf)
def setUpClass(cls): config = AppConfig.get_config() total = config.get('quota', 'total') kline = config.get('quota', 'kline') tiker = config.get('quota', 'ticker') quote = config.get('quota', 'quote') order_book = config.get('quota', 'order_book') rt_data = config.get('quota', 'rt_data') broker = config.get('quota', 'broker') cls.ctx = ft.OpenQuoteContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) cls.sub = Subscribe(cls.ctx, total, kline, tiker, quote, order_book, rt_data, broker) cls.ctx.start() cls.lf = LF(cls.ctx) cls.hf = HF(cls.ctx, cls.sub)
def main(): global lf_ctx global hf_ctx global hk_ctx global us_ctx config = AppConfig.get_config() total = config.get('quota', 'total') kline = config.get('quota', 'kline') tiker = config.get('quota', 'ticker') quote = config.get('quota', 'quote') order_book = config.get('quota', 'order_book') rt_data = config.get('quota', 'rt_data') broker = config.get('quota', 'broker') lf_ctx = ft.OpenQuoteContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) lf_ctx.start() lf = LF(lf_ctx) #lf_task(lf) hf_ctx = ft.OpenQuoteContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) hf_ctx.start() sub = Subscribe(hf_ctx, total, kline, tiker, quote, order_book, rt_data, broker) hf = HF(hf_ctx, sub) hf_task(hf) hk_ctx = ft.OpenHKTradeContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) hk_trade = Trade(hk_ctx) hk_trade.unlock_trade(None, config.get('ftserver', 'decipher')) #hk_trade_task(hk_trade) us_ctx = ft.OpenUSTradeContext(config.get('ftserver', 'host'), int(config.get('ftserver', 'port'))) us_trade = Trade(us_ctx) us_trade.unlock_trade(None, config.get('ftserver', 'decipher'))
# -*- coding: UTF-8 -*-