Ai
7 Star 43 Fork 44

王布衣/gotdx

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
unit.go 822 Bytes
一键复制 编辑 原始数据 按行查看 历史
package internal
import "gitee.com/quant1x/exchange"
// BaseUnit 交易单位
//
// A股、债券交易和债券买断式回购交易的申报价格最小变动单位为0.01元人民币
// 基金、权证交易为0.001元人民币
// B股交易为0.001美元
// 债券质押式回购交易为0.005元
func defaultBaseUnit(marketId exchange.MarketType, code string) float64 {
unit := 100.00
if marketId == exchange.MarketIdShangHai {
c := code[:2]
switch c {
case "51":
unit = 1000.00
}
} else if marketId == exchange.MarketIdShenZhen {
c := code[:3]
switch c {
case "159":
unit = 1000.0
}
}
return unit
}
type unitHandler func(marketId exchange.MarketType, code string) float64
var (
BaseUnit unitHandler = defaultBaseUnit
)
func RegisterBaseUnitFunction(f unitHandler) {
BaseUnit = f
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/quant1x/gotdx.git
git@gitee.com:quant1x/gotdx.git
quant1x
gotdx
gotdx
v1.25.0

搜索帮助