Exemplo n.º 1
0
def strategyAssistant (options, database, table, extra):
	tradeRec = 'dummy'	# Currently, does not support Trade Recording.
	#table = extra.split(',')[0]
	table = futcom.futcodeToDataTable(table)
	#print extra, table
	#table = extra[0]
	strategy = options.strategy
	
	if strategy == 'turtle':
		import strategy.turtle as turtle
		strategy = turtle.Turtle(table, table, tradeRec, database)
	elif strategy == 'turt1':
		import strategy.turt1 as turt1	
		strategy = turt1.Turt1(table, table, tradeRec, database)
	else:
		print "\nUnknown strategy '%s' to do assistant.\n" % strategy
		exit()
		
	strategy.assistant(extra)
Exemplo n.º 2
0
def dataOptionsHandler (options, args):
	database = options.database
	table = options.dataTable
	
	if database is None or table is None:
		print "\nPlease specify database ('-b') and datatable ('-t').\n"
		return
	
	# Try to find the passed table in database, otherwise it may cause run error.
	if futcom.futureTalbeExists(table, database) == False:
		table = futcom.futcodeToDataTable(table)
		if futcom.futureTalbeExists(table, database) == False:
			print "\nCan not find any table matching '%s', exit...\n" % options.dataTable
			exit()
	#print table
	
	if options.check:
		getFirstLastRecords (database, table)
		return
	
	if options.date is None:
		print "\nPlease specify the date using '-d'.\n"
		return
		
	date = options.date
	dat = data.Data(database, table)
	
	if options.moving:
		printMoving(dat, date, options.moving)
		
	if options.field:
		printField(dat, date, options.field)
			
	if options.highest:
		printHighest(dat, date, options.highest)
		
	if options.lowest:
		printLowest(dat, date, options.lowest)
		
	if options.recent:
		printRecent(database, table, date, options.recent)