デジタル通貨の決済

作者: リン・ハーン足首, 日時: 2017-09-07 07:33:17
タグ:パイソン貿易支援

デジタル通貨の一般投資戦略,複数の取引所で同時投資をサポートする

パラメータ説明

orderAmount #決済金額 BTCCNYとBCCCNY単位 CNY,BCCBTC単位 BTCなど

accountLimitMoney #口座制限,一部のお金を保持,口座が最低限に達すると預金停止

orderTimeInterval #定投射間隔,単位秒,毎分=60 毎時間=3600 毎日=86400 毎週=604800

maxBidPrice #最大取引価格,価格を超えてジャンプ,次の取引機会が来るまで待って


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)

関連性

もっと