Quantitative contract means that the objectives or tasks are specific and can be measured clearly.According to different situations,it can be expressed in terms of quantity,specific statistics,range measurement,length of time,etc.The so-called quantization is to discrete the amplitude of the sampled instantaneous value,that is,use a set of specified levels to express the instantaneous sample value with the closest level value.The sampled image is only spatially dispersed into an array of pixels(samples).However,the gray value of each sample is still a continuous change from an infinite number of values,which must be converted into a limited number of discrete values,and given different codewords to truly become a digital image.This transformation is called quantization.
关于合约量化交易APP开发会涉及到的内容就有这些,当然一些功能是可以通过定制来实现的,只要逻辑对了就是可以加进去的。
//带有两个Int参数、返回Int的函数:
fun sum(a:Int,b:Int):Int{
return a+b//返回的是Int
}
//主函数入口,程序执行:定义函数
fun main(args:Array<String>){
print("sum of 3 and 5 is")//print打印不换行
println(sum(3,5))//println打印换行
}
//将表达式作为函数体、返回值类型自动推断的函数:
fun sum(a:Int,b:Int)=a+b
fun main(args:Array<String>){
println("sum of 19 and 23 is${sum(19,23)}")//${}占位
}
//函数返回无意义的值
fun print_sum(a:Int,b:Int):Unit{
println("sum of$a and$b is${a+b}")//$占位
}
fun main(args:Array<String>){
print_sum(-1,8)
}
//Unit返回类型可以省略:
fun printSum(a:Int,b:Int){
println("sum of$a and$b is${a+b}")
}
fun main(args:Array<String>){
printSum(-1,8)
}
定义变量
//一次赋值--只读--局部变量
fun main(args:Array<String>){
val a:Int=1//立即赋值
val b=2//自动推断出‘Int’类型
val c:Int//如果没有初始值类型不能省略
c=3
println("a=$a,b=$b,c=$c")
}
//可变变量
fun main(args:Array<String>){
var x=5//自动推断出“Int”类型
x+=1
println("x=$x")
}
//顶层变量:
val PI=3.14
var x=0
fun incrementX(){
x+=1
}
fun main(args:Array<String>){
println("x=$x,PI=$PI")
incrementX()
println("incrementX()")
println("x=$x,PI=$PI")
}
/变量还可以作为属性和字段使用/