當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Parser.CalcProfit_24946方法代碼示例

本文整理匯總了Golang中github.com/c-darwin/dcoin-go/packages/dcparser.Parser.CalcProfit_24946方法的典型用法代碼示例。如果您正苦於以下問題:Golang Parser.CalcProfit_24946方法的具體用法?Golang Parser.CalcProfit_24946怎麽用?Golang Parser.CalcProfit_24946使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/c-darwin/dcoin-go/packages/dcparser.Parser的用法示例。


在下文中一共展示了Parser.CalcProfit_24946方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: main


//.........這裏部分代碼省略.........
		{101: "user"},
		{295: "miner"},
	}
	test_data[18].holidays_array = [][]int64{
		{0, 10},
		{10, 20},
		{30, 30},
		{40, 50},
		{66, 99},
		{233, 1999},
	}
	test_data[18].max_promised_amount_array = []map[int64]string{
		{0: "1000"},
		{63: "3333"},
		{156: "899"},
		{220: "500"},
	}
	test_data[18].currency_id = 10
	test_data[18].result = 5157.6623487708

	test_data[19] = new(calcProfitTest)
	test_data[19].amount = 1500
	test_data[19].repaid_amount = 0
	test_data[19].time_start = 50
	test_data[19].time_finish = 140
	test_data[19].pct_array = []map[int64]map[string]float64{
		{0: {"user": 0.0059, "miner": 0.05}},
		{36: {"user": 0.0088, "miner": 0.08}},
		{164: {"user": 0.0049, "miner": 0.04}},
		{223: {"user": 0.0029, "miner": 0.02}},
	}
	test_data[19].points_status_array = []map[int64]string{
		{0: "miner"},
		{98: "miner"},
		{101: "user"},
		{295: "miner"},
	}
	test_data[19].holidays_array = [][]int64{
		{0, 10},
		{10, 20},
		{30, 30},
		{40, 50},
		{66, 99},
		{233, 1999},
	}
	test_data[19].max_promised_amount_array = []map[int64]string{
		{0: "1000"},
		{63: "3333"},
		{156: "899"},
		{220: "500"},
	}
	test_data[19].currency_id = 1
	test_data[19].result = 129106.50065867

	test_data[20] = new(calcProfitTest)
	test_data[20].amount = 1500
	test_data[20].repaid_amount = 50
	test_data[20].time_start = 50
	test_data[20].time_finish = 140
	test_data[20].pct_array = []map[int64]map[string]float64{
		{0: {"user": 0.0059, "miner": 0.05}},
		{36: {"user": 0.0088, "miner": 0.08}},
		{164: {"user": 0.0049, "miner": 0.04}},
		{223: {"user": 0.0029, "miner": 0.02}},
	}
	test_data[20].points_status_array = []map[int64]string{
		{0: "miner"},
		{98: "miner"},
		{101: "user"},
		{295: "miner"},
	}
	test_data[20].holidays_array = [][]int64{
		{0, 10},
		{10, 20},
		{30, 30},
		{40, 50},
		{66, 99},
		{233, 1999},
	}
	test_data[20].max_promised_amount_array = []map[int64]string{
		{0: "1000"},
		{63: "1525"},
		{64: "1550"},
		{139: "500"},
	}
	test_data[20].currency_id = 10
	test_data[20].result = 4966.7977985526

	f, _ := os.OpenFile("dclog.txt", os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0777)
	defer f.Close()
	//	log.SetOutput(io.MultiWriter(f, os.Stdout))
	log.SetOutput(f)
	log.SetFlags(log.LstdFlags | log.Lshortfile)

	for i := 0; i < 21; i++ {
		p := new(dcparser.Parser)
		profit, _ := p.CalcProfit_24946(test_data[i].amount, test_data[i].time_start, test_data[i].time_finish, test_data[i].pct_array, test_data[i].points_status_array, test_data[i].holidays_array, test_data[i].max_promised_amount_array, test_data[i].currency_id, test_data[i].repaid_amount)
		//fmt.Println(i, utils.Round(test_data[i].result, 8), utils.Round(profit, 8))
	}
}
開發者ID:dzyk,項目名稱:dcoin-go,代碼行數:101,代碼來源:calc_profit.go


注:本文中的github.com/c-darwin/dcoin-go/packages/dcparser.Parser.CalcProfit_24946方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。