当前位置: 首页>>代码示例>>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;未经允许,请勿转载。