dev 4
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package libs
|
||||
|
||||
import (
|
||||
"math"
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
@@ -23,3 +24,15 @@ func TradingTime(t time.Time) bool {
|
||||
return (second >= 9*3600+30*60 && second <= 11*3600+30*60) ||
|
||||
(second >= 13*3600 && second <= 15*3600)
|
||||
}
|
||||
|
||||
func CalcBuyVolume(price, buyValue float64) int {
|
||||
if price <= 0 || buyValue <= 0 {
|
||||
return 0
|
||||
}
|
||||
// 不足一手时仍按最低一手委托。
|
||||
hands := int(math.Floor(buyValue / (price * 100)))
|
||||
if hands == 0 {
|
||||
hands = 1
|
||||
}
|
||||
return hands * 100
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user