The digital currency is fixed

Author: ankye, Date: 2017-09-07 07:33:17
Tags: PythonTrade-aided

Digital currency universal deposit strategy, supporting multiple exchanges to deposit simultaneously

Parameters

orderAmount #fixed deposit amount BTCCNY and BCCCCNY units CNY, BCCBTC units BTC etc.

accountLimitMoney # account limit, keep some money, stop depositing when the account reaches the minimum

orderTimeInterval # fixed betting interval, units of seconds, per minute = 60 per hour = 3600 per day = 86400 per week = 604800

maxBidPrice #maximum bid price, jump over the price and wait for the next opportunity


def onTick():
	
	exchange_count = len(exchanges)
	for i in range(exchange_count):
		account = exchanges[i].GetAccount()

		marketName = exchanges[i].GetName()
		depth = exchanges[i].GetDepth()
		Log("Market ",marketName,exchanges[i].GetCurrency(),"Account Balance [",account["Balance"],"] Stocks[",account["Stocks"],"]")
		if account and depth and account["Balance"] > accountLimitMoney :
			bidPrice = depth["Asks"][0]["Price"] 
			if bidPrice <  maxBidPrice :
				amount = orderAmount
				if amount <= account["Balance"]:
					exchanges[i].Buy(amount)
				else:
					Log("Account Balance is less than bid Amount")
			else:
				Log("Bid Price >= maxBidPrice, not process")
		else:
			Log("Account Balance <= accountLimitMoney")
def main() :
	while 1:
		
		onTick()
		time.sleep(orderTimeInterval)

Related

More