Sumber dimuat naik... memuat...

Mata Wang Digital Diletakkan

Penulis:kaki, Tarikh: 2017-09-07 07:33:17
Tag:PythonDibantu Perdagangan

Strategi pelaburan mata wang digital yang universal, menyokong pelaburan serentak di pelbagai bursa

Perincian parameter

orderAmount # jumlah deposit tetap BTCCNY dan BCCCCNY Unit CNY, BCCBTC Unit BTC dan lain-lain

accountLimitMoney # had akaun, menyimpan sebahagian wang, akaun berhenti disetor apabila mencapai had minimum

orderTimeInterval # set interval, satuan saat, setiap minit = 60 Setiap jam = 3600 Setiap hari = 86400 Setiap minggu = 604800

#maxBidPrice #harga teratas, melangkau harga dan menunggu peluang lain muncul


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)

Berkaitan

Lebih lanjut