示例#1
0
def pull_currency_index():
	global currency_index, currency_refresh_last_update, trade_available
	new_index = requests.get(sources.currency_index)
	if currency_index != new_index.json():
		time_diff = time.now() - currency_refresh_last_update
		currency_refresh_last_update = time.now()
		if time_diff <= currency_refresh_tolerance:
			currency_index = new_index.json()
			trade_available = True
示例#2
0
def find_best_margin():
	total_threads = len(viable_currencies)
	threads = [] # change to capacity later
	for i in xrange(total_threads):
		t = multiprocessing.Process(target=find_margin, args=(viable_currencies[i]))
		t.daemon = True
		threads.append(t)
		t.start()
	while not block_threads(threads):
		threading.current_thread.sleep(0.001)
	if time.now() - currency_refresh_last_update < currency_refresh_tolerance:
		execute_trade()