Documentation ¶
Overview ¶
Package trading 包含交易中的日历和时段相关的功能函数
Index ¶
- Constants
- Variables
- func AssertBlockBySecurityCode(securityCode *string) (isBlock bool)
- func AssertETFByMarketAndCode(marketId MarketType, symbol string) (isETF bool)
- func AssertIndexByMarketAndCode(marketId MarketType, symbol string) (isIndex bool)
- func AssertIndexBySecurityCode(securityCode string) (isIndex bool)
- func AssertStockByMarketAndCode(marketId MarketType, symbol string) (isStock bool)
- func AssertStockBySecurityCode(securityCode string) (isStock bool)
- func CanInitialize(lastModified ...time.Time) (toInit bool)
- func CanUpdate(lastModified ...time.Time) (updated bool)
- func CanUpdateInRealtime(lastModified ...time.Time) (updateInRealTime bool, status int)
- func CheckCallAuctionClose(timestamp time.Time) (canUpdate bool)
- func CheckCallAuctionCloseFinished(timestamp time.Time) (finished bool)
- func CheckCallAuctionOpen(timestamp time.Time) (canUpdate bool)
- func CheckCallAuctionOpenFinished(timestamp time.Time) (finished bool)
- func CheckCallAuctionTail(timestamp time.Time) (finished bool)
- func CheckCallAuctionTime(timestamp time.Time) (canUpdate bool)
- func CorrectSecurityCode(securityCode string) string
- func CurrentlyTrading(date ...string) bool
- func DateIsTradingDay(date ...string) bool
- func DateRange(start, end string) []string
- func EvaluateYields(prices, markets []float64, riskFreeRate float64) (beta, alpha float64)
- func FixTradeDate(datetime string, format ...string) string
- func GetCurrentDate(date ...string) (currentDate string)
- func GetCurrentlyDay() (currentlyDay string)
- func GetFrontTradeDay() string
- func GetLastDayForUpdate() string
- func GetMarket(symbol string) string
- func GetMarketFlag(marketId MarketType) string
- func GetMarketId(symbol string) uint8
- func GetSecurityCode(market MarketType, symbol string) (securityCode string)
- func GetTodayTimeByString(timeStr string) (time.Time, error)
- func IndexList() []string
- func IndexToday() string
- func IsHoliday(date string) bool
- func IsTimeInRange(timeStr, startStr, endStr string) (bool, error)
- func IsTrading(date ...string) bool
- func LastNDate(date string, n ...int) []string
- func LastTradeDate() string
- func LimitUp(securityCode string, price float64) float64
- func MarketLimit(securityCode string) float64
- func Minutes(date ...string) int
- func NextTradeDate(date string) string
- func ToUint32Date(datetime string) uint32
- func Today() string
- func TradeRange(start, end string, threadSafe ...bool) []stringdeprecated
- func TradeSessionHasEnd(date string) bool
- func TradeSessionIsPreMarket(date string) bool
- func TradingDateRange(start, end string, threadSafe ...bool) []string
- type DateTimeRange
- type FinancialHoliday
- type KLine
- type MarketHours
- func (this *MarketHours) CanStopLoss(milliseconds ...int64) bool
- func (this *MarketHours) CanTakeProfit(milliseconds ...int64) bool
- func (this *MarketHours) GetTimeKind(milliseconds int64) (TimeKind, int, error)
- func (this *MarketHours) Index(milliseconds ...int64) int
- func (this *MarketHours) IsTodayLastSession(milliseconds ...int64) bool
- func (this *MarketHours) IsTrading(milliseconds ...int64) bool
- func (this MarketHours) MarshalText() (text []byte, err error)
- func (this MarketHours) Minutes() int
- func (this *MarketHours) Parse(text string) error
- func (this *MarketHours) Size() int
- func (this MarketHours) String() string
- func (this *MarketHours) UnmarshalText(text []byte) error
- func (this *MarketHours) UnmarshalYAML(node *yaml.Node) error
- type MarketHoursOperator
- type MarketType
- type NumberRange
- func (this NumberRange) MarshalText() (text []byte, err error)
- func (this *NumberRange) Max() float64
- func (this *NumberRange) Min() float64
- func (this *NumberRange) Parse(text string) error
- func (this NumberRange) String() string
- func (this *NumberRange) UnmarshalText(bytes []byte) error
- func (this *NumberRange) UnmarshalYAML(node *yaml.Node) error
- func (this *NumberRange) Validate(v float64) bool
- type Operator
- type TargetKind
- type TimeInterval
- func (this *TimeInterval) IsTrading(milliseconds int64) bool
- func (this TimeInterval) Minutes() int
- func (this *TimeInterval) Parse(text string) error
- func (this TimeInterval) String() string
- func (this *TimeInterval) UnmarshalText(text []byte) error
- func (this *TimeInterval) UnmarshalYAML(node *yaml.Node) error
- type TimeKind
- type TimeStatus
- type TradingSession
- func (this *TradingSession) CanStopLoss(milliseconds ...int64) bool
- func (this *TradingSession) CanTakeProfit(milliseconds ...int64) bool
- func (this *TradingSession) Index(milliseconds ...int64) int
- func (this *TradingSession) IsTodayLastSession(milliseconds ...int64) bool
- func (this *TradingSession) IsTrading(milliseconds ...int64) bool
- func (this TradingSession) MarshalText() (text []byte, err error)
- func (this TradingSession) Minutes() int
- func (this *TradingSession) Parse(text string) error
- func (this *TradingSession) Size() int
- func (this TradingSession) String() string
- func (this *TradingSession) UnmarshalText(text []byte) error
- func (this *TradingSession) UnmarshalYAML(node *yaml.Node) error
- type TradingTimeRange
- func (this *TradingTimeRange) IsTrading(milliseconds int64) bool
- func (this TradingTimeRange) Minutes() int
- func (this *TradingTimeRange) Parse(text string) error
- func (this TradingTimeRange) String() string
- func (this *TradingTimeRange) UnmarshalText(text []byte) error
- func (this *TradingTimeRange) UnmarshalYAML(node *yaml.Node) error
- type ValueRange
- type ValueType
Constants ¶
const ( HistoricalTransactionDataFirstTime = "09:25" // 第一个时间 HistoricalTransactionDataStartTime = "09:30" // 开盘时间 HistoricalTransactionDataFinalBiddingTime = "14:57" // 尾盘集合竞价时间 HistoricalTransactionDataLastTime = "15:00" // 最后一个时间 )
历史成交数据 historical transaction data
const ( CN = "cn" // A股 HK = "hk" // 港股 US = "us" // 美股 )
const ( MarketShangHai string = "sh" // 上海 MarketShenZhen string = "sz" // 深圳 MarketBeiJing string = "bj" // 北京 MarketHongKong string = "hk" // 香港 MarketUSA string = "us" // 美国 )
const ( MARKET_CN_FIRST_DATE = "19901219" // 上证指数的第一个交易日 MARKET_CH_FIRST_LISTTIME = "1990-12-19" // 个股上市日期 )
const ( STOCK = iota // 股票 INDEX // 指数 BLOCK // 板块 ETF // ETF )
const ( CN_TransactionTimeFormat = "15:04" // 分笔成交时间格式 CN_SERVERTIME_FORMAT = "15:04:05.000" // 服务器时间格式 CN_SERVERTIME_SHORT_FORMAT = "15:04:05" // 服务器时间格式 TimeStampSecond = "2006-01-02 15:04:05" TimeStampMilli = "2006-01-02 15:04:05.000" TimeStampMicro = "2006-01-02 15:04:05.000000" TimeStampNano = "2006-01-02 15:04:05.000000000" )
const ( CN_MarketInitTime = "09:00:00.000" // A股数据初始化时间 CN_TradingStartTime = "09:15:00.000" // A股数据开始时间 CN_TradingSuspendBeginTime = "11:30:00.000" // A股午间休市开始时间 CN_TradingSuspendEndTime = "12:59:59.999" // A股午间休市结束时间 CN_TradingStopTime = "15:00:59.999" // A股数据结束时间 CN_CallAuctionAmBegin = "09:15:00.000" // 集合竞价-早盘-开始时间 CN_CallAuctionAmEnd = "09:27:59.999" // 集合竞价-早盘-结束时间 CN_CallAuctionAmFinished = "09:27:00.000" // 集合竞价-早盘-数据结束时间 CN_CallAuctionTailBegin = "14:30:00.000" // 尾盘时段-开始 CN_CallAuctionTailEnd = "15:01:59.999" // 尾盘时段-结束 CN_CallAuctionPmBegin = "14:57:00.000" // 集合竞价-尾盘-开始时间 CN_CallAuctionPmEnd = "15:01:59.999" // 集合竞价-尾盘-结束时间 CN_CallAuctionPmFinished = "15:01:30.000" // 集合竞价-尾盘-数据结束时间 )
交易日时间相关常量
const ( BEGIN_A_AUCTION = "09:15:00" // A股上午集合竞价开始时间 END_A_AUCTION = "09:25:00" // A股上午集合竞价结束时间 END_A_AUCTION_SPE = "09:26:00" // A股上午集合竞价结束时间过一分钟 BEGIN_P_AUCTION = "14:57:00" // A股下午集合竞价开始时间 END_P_AUCTION = "15:01:00" // A股下午集合竞价结束时间 END_P_AUCTION_SPE = "15:02:00" // A股下午集合竞价结束时间过一分钟 )
集合竞价时间相关常量
const ( CN_DEFAULT_TOTALFZNUM = 240 // A股默认全天交易240分钟 BEGIN_A_AM_HOUR = 9 // A股开市-时 BEGIN_A_AM_MINUTE = 30 // A股开市-分 END_A_AM_HOUR = 11 // A股休市-时 END_A_AM_MINUTE = 30 // A股休市-分 BEGIN_A_PM_HOUR = 13 // A股开市-时 BEGIN_A_PM_MINUTE = 0 // A股开市-分 END_A_PM_HOUR = 15 // A股休市-时 END_A_PM_MINUTE = 0 // A股休市-分 )
分时数据相关常量
const (
TimeOnly = time.TimeOnly // 时分秒的格式
)
const (
TradingDayDateFormat = "2006-01-02" // 交易日历日期格式
)
const (
TransactionStartTime = "09:30:00" // 交易开始时间
)
Variables ¶
var (
ErrNoUpdateRequired = errors.New("no update required")
)
var (
ErrNumberFormat = exception.New(errnoConfig+1, "数值范围格式错误")
)
var (
ErrRangeFormat = exception.New(errnoConfig+0, "数值范围格式错误")
)
错误信息
var (
ErrTimeFormat = exception.New(errnoConfig+2, "时间范围格式错误")
)
Functions ¶
func AssertBlockBySecurityCode ¶ added in v0.1.3
AssertBlockBySecurityCode 断言证券代码是否板块
func AssertETFByMarketAndCode ¶ added in v0.1.3
func AssertETFByMarketAndCode(marketId MarketType, symbol string) (isETF bool)
AssertETFByMarketAndCode 通过市场id和代码判断是否ETF
func AssertIndexByMarketAndCode ¶ added in v0.1.3
func AssertIndexByMarketAndCode(marketId MarketType, symbol string) (isIndex bool)
AssertIndexByMarketAndCode 通过市场id和短码判断是否指数
func AssertIndexBySecurityCode ¶ added in v0.1.3
AssertIndexBySecurityCode 通过证券代码判断是否指数
func AssertStockByMarketAndCode ¶ added in v0.1.3
func AssertStockByMarketAndCode(marketId MarketType, symbol string) (isStock bool)
AssertStockByMarketAndCode 通过市场id和代码判断是否个股
func AssertStockBySecurityCode ¶ added in v0.1.3
AssertStockBySecurityCode 通过证券代码判断是否个股
func CanInitialize ¶ added in v0.1.3
CanInitialize 数据是否初始化(One-time update)
func CanUpdateInRealtime ¶ added in v0.1.3
CanUpdateInRealtime 能否实时更新
func CheckCallAuctionClose ¶ added in v0.1.3
CheckCallAuctionClose 检查当前时间是否集合竞价阶段
func CheckCallAuctionCloseFinished ¶ added in v0.1.3
CheckCallAuctionCloseFinished 检查当前时间是否集合竞价阶段-结束
func CheckCallAuctionOpen ¶ added in v0.1.3
CheckCallAuctionOpen 检查当前时间是否集合竞价阶段-进行中
func CheckCallAuctionOpenFinished ¶ added in v0.1.3
CheckCallAuctionOpenFinished 检查当前时间是否集合竞价阶段-结束
func CheckCallAuctionTail ¶ added in v0.1.3
CheckCallAuctionTail 检查当前时间是否集合竞价阶段-结束
func CheckCallAuctionTime ¶ added in v0.1.3
CheckCallAuctionTime 检查当前时间是否集合竞价阶段
func CorrectSecurityCode ¶ added in v0.1.3
CorrectSecurityCode 修正证券代码
func CurrentlyTrading ¶ added in v0.1.3
CurrentlyTrading 今天的交易是否已经开始
func DateIsTradingDay ¶ added in v0.1.3
DateIsTradingDay date是否交易日?默认是今天
func EvaluateYields ¶ added in v0.5.1
EvaluateYields 评估收益率
func GetCurrentDate ¶ added in v0.1.3
GetCurrentDate 获取数据有效的最后一个交易日, 以9点整划分
func GetCurrentlyDay ¶ added in v0.1.3
func GetCurrentlyDay() (currentlyDay string)
GetCurrentlyDay 获取数据有效的最后一个交易日, 以9点15分划分
func GetLastDayForUpdate ¶ added in v0.1.3
func GetLastDayForUpdate() string
GetLastDayForUpdate 获取可以更新数据的最后一个交易日
func GetMarket ¶ added in v0.1.3
GetMarket 判断股票ID对应的证券市场匹配规则
['50', '51', '60', '90', '110'] 为 sh ['00', '12','13', '18', '15', '16', '18', '20', '30', '39', '115'] 为 sz ['5', '6', '9'] 开头的为 sh, 其余为 sz
func GetMarketFlag ¶ added in v0.1.3
func GetMarketFlag(marketId MarketType) string
func GetSecurityCode ¶ added in v0.1.3
func GetSecurityCode(market MarketType, symbol string) (securityCode string)
func GetTodayTimeByString ¶ added in v0.1.3
GetTodayTimeByString 返回当天指定时刻的时间
func IsTimeInRange ¶ added in v0.1.3
func NextTradeDate ¶ added in v0.1.3
NextTradeDate 获取指定日期的下一个交易日
func ToUint32Date ¶ added in v0.2.4
ToUint32Date 通达信协议日期为YYYYMMDD格式的十进制整型
func TradeRange
deprecated
added in
v0.1.3
func TradeSessionHasEnd ¶ added in v0.2.0
TradeSessionHasEnd 是否收盘
func TradeSessionIsPreMarket ¶ added in v0.5.5
TradeSessionIsPreMarket 是否盘前交易
Types ¶
type DateTimeRange ¶ added in v0.1.3
func (*DateTimeRange) Minutes ¶ added in v0.1.3
func (tr *DateTimeRange) Minutes() int
type FinancialHoliday ¶ added in v0.1.3
type FinancialHoliday struct { Date string `name:"日期" array:"0"` Holiday string `name:"节日" array:"1"` Country string `name:"地区" array:"2"` Exchange string `name:"交易所" array:"3"` }
FinancialHoliday 金融假日
type KLine ¶ added in v0.1.3
type KLine struct { Date string `json:"date" array:"0" name:"日期" dataframe:"date,string"` Open float64 `json:"open" array:"1" name:"开盘价" dataframe:"open,float64"` Close float64 `json:"close" array:"2" name:"收盘价" dataframe:"close,float64"` High float64 `json:"high" array:"3" name:"最高价" dataframe:"high,float64"` Low float64 `json:"low" array:"4" name:"最低价" dataframe:"low,float64"` Volume int64 `json:"volume" array:"5" name:"成交量" dataframe:"volume,int64"` Amount float64 `json:"amount" array:"6" name:"成交金额" dataframe:"amount,float64"` }
type MarketHours ¶ added in v0.3.8
type MarketHours struct {
// contains filtered or unexported fields
}
MarketHours 交易时段
func ExchangeMarketHours ¶ added in v0.3.8
func ExchangeMarketHours(sessions ...TradingTimeRange) MarketHours
func GetExchangeMarketHours ¶ added in v0.3.8
func GetExchangeMarketHours(name string) MarketHours
func (*MarketHours) CanStopLoss ¶ added in v0.3.8
func (this *MarketHours) CanStopLoss(milliseconds ...int64) bool
CanStopLoss 当前时段是否可以进行止损操作
如果是3个时段, 止损操作在第2时段, 如果是4个时段, 止损在第3个 如果是2个时段, 则是第2个时段, 也就是最后一个时段
func (*MarketHours) CanTakeProfit ¶ added in v0.3.8
func (this *MarketHours) CanTakeProfit(milliseconds ...int64) bool
CanTakeProfit 当前时段是否可以止盈
func (*MarketHours) GetTimeKind ¶ added in v0.3.8
func (this *MarketHours) GetTimeKind(milliseconds int64) (TimeKind, int, error)
func (*MarketHours) Index ¶ added in v0.3.8
func (this *MarketHours) Index(milliseconds ...int64) int
Index 判断timestamp是第几个交易时段
func (*MarketHours) IsTodayLastSession ¶ added in v0.3.8
func (this *MarketHours) IsTodayLastSession(milliseconds ...int64) bool
IsTodayLastSession 当前时段是否今天最后一个交易时段
备选函数名 IsTodayFinalSession
func (*MarketHours) IsTrading ¶ added in v0.3.8
func (this *MarketHours) IsTrading(milliseconds ...int64) bool
IsTrading 是否交易时段
func (MarketHours) MarshalText ¶ added in v0.3.8
func (this MarketHours) MarshalText() (text []byte, err error)
func (MarketHours) Minutes ¶ added in v0.3.8
func (this MarketHours) Minutes() int
func (*MarketHours) Parse ¶ added in v0.3.8
func (this *MarketHours) Parse(text string) error
func (MarketHours) String ¶ added in v0.3.8
func (this MarketHours) String() string
func (*MarketHours) UnmarshalText ¶ added in v0.3.8
func (this *MarketHours) UnmarshalText(text []byte) error
UnmarshalText 设置默认值调用
func (*MarketHours) UnmarshalYAML ¶ added in v0.3.8
func (this *MarketHours) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML YAML自定义解析
type MarketHoursOperator ¶ added in v0.3.8
type MarketHoursOperator struct { }
type MarketType ¶ added in v0.1.3
type MarketType = uint8
const ( MarketIdShenZhen MarketType = iota // 深圳 MarketIdShangHai MarketType = 1 // 上海 MarketIdBeiJing MarketType = 2 // 北京 MarketIdHongKong MarketType = 21 // 香港 MarketIdUSA MarketType = 22 // 美国 StockDelisting = "DELISTING" // 退市 )
func DetectMarket ¶ added in v0.1.3
func DetectMarket(symbol string) (marketId MarketType, market string, code string)
DetectMarket 检测市场代码
type NumberRange ¶
type NumberRange struct {
// contains filtered or unexported fields
}
NumberRange 数值范围
支持: 1) "1~2", 最小值1, 最大值2 2) "", 最小值默认, 最大值默认 3) "3.82", 最小值, 最大值默认 4) "3.82~", 最小值, 最大值默认 5) "~3.82", 最小值默认, 最大值
func (NumberRange) MarshalText ¶
func (this NumberRange) MarshalText() (text []byte, err error)
func (*NumberRange) Max ¶
func (this *NumberRange) Max() float64
func (*NumberRange) Min ¶
func (this *NumberRange) Min() float64
func (*NumberRange) Parse ¶
func (this *NumberRange) Parse(text string) error
func (NumberRange) String ¶
func (this NumberRange) String() string
func (*NumberRange) UnmarshalText ¶
func (this *NumberRange) UnmarshalText(bytes []byte) error
UnmarshalText 设置默认值调用
func (*NumberRange) UnmarshalYAML ¶
func (this *NumberRange) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML YAML自定义解析
type Operator ¶ added in v0.3.8
type Operator interface { // Kind 取得ms所在时段的操作类别和序号 // ms是nil的话, 即默认值, 取当前时间戳的毫秒数 Kind(ms ...int64) (kind TimeKind, index int) }
Operator 操作员接口
type TargetKind ¶ added in v0.5.0
type TargetKind int
TargetKind 标的类型
func AssertCode ¶ added in v0.5.0
func AssertCode(securityCode string) TargetKind
AssertCode 判断一个代码类型
type TimeInterval ¶ added in v0.1.2
type TimeInterval struct {
// contains filtered or unexported fields
}
TimeInterval 时间范围
左闭右开[begin, end)
func ExchangeTime ¶ added in v0.1.2
func ExchangeTime(kind TimeKind, begin, end string) TimeInterval
func (*TimeInterval) IsTrading ¶ added in v0.1.2
func (this *TimeInterval) IsTrading(milliseconds int64) bool
func (TimeInterval) Minutes ¶ added in v0.1.2
func (this TimeInterval) Minutes() int
func (*TimeInterval) Parse ¶ added in v0.1.2
func (this *TimeInterval) Parse(text string) error
Parse 解析文本, 覆盖属性
func (TimeInterval) String ¶ added in v0.1.2
func (this TimeInterval) String() string
func (*TimeInterval) UnmarshalText ¶ added in v0.1.2
func (this *TimeInterval) UnmarshalText(text []byte) error
UnmarshalText 设置默认值调用
由于begin和end字段不可访问, 默认值调用实际无效
func (*TimeInterval) UnmarshalYAML ¶ added in v0.1.2
func (this *TimeInterval) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML YAML自定义解析
type TimeKind ¶ added in v0.1.2
type TimeKind uint64
TimeKind 时段类型
const ( CallAuctionAndCancel TimeKind = CallAuction | CanCancel // 集合竞价可撤单 TradingAndCancel TimeKind = Trading | CanCancel // 交易可撤单 CallAuctionAndTrading TimeKind = CallAuction | Trading // 集合竞价可撤单 )
func StringToTimeKind ¶ added in v0.3.8
type TimeStatus ¶ added in v0.1.3
type TimeStatus = int
const ( ExchangePreMarket TimeStatus = -1 // 盘前 ExchangeSuspend TimeStatus = 0 // 休市中, 交易暂停 ExchangeTrading TimeStatus = 1 // 交易中 ExchangeCallAuction TimeStatus = 2 // 交易中, 集合竞价 ExchangeClosing TimeStatus = 3 // 当日收盘, 交易停止 )
type TradingSession ¶
type TradingSession struct {
// contains filtered or unexported fields
}
TradingSession 交易时段
func ExchangeSessions ¶ added in v0.1.2
func ExchangeSessions(sessions ...TimeInterval) TradingSession
func GetExchange ¶ added in v0.1.2
func GetExchange(name string) TradingSession
func (*TradingSession) CanStopLoss ¶
func (this *TradingSession) CanStopLoss(milliseconds ...int64) bool
CanStopLoss 当前时段是否可以进行止损操作
如果是3个时段, 止损操作在第2时段, 如果是4个时段, 止损在第3个 如果是2个时段, 则是第2个时段, 也就是最后一个时段
func (*TradingSession) CanTakeProfit ¶
func (this *TradingSession) CanTakeProfit(milliseconds ...int64) bool
CanTakeProfit 当前时段是否可以止盈
func (*TradingSession) Index ¶
func (this *TradingSession) Index(milliseconds ...int64) int
Index 判断timestamp是第几个交易时段
func (*TradingSession) IsTodayLastSession ¶
func (this *TradingSession) IsTodayLastSession(milliseconds ...int64) bool
IsTodayLastSession 当前时段是否今天最后一个交易时段
备选函数名 IsTodayFinalSession
func (*TradingSession) IsTrading ¶
func (this *TradingSession) IsTrading(milliseconds ...int64) bool
IsTrading 是否交易时段
func (TradingSession) MarshalText ¶
func (this TradingSession) MarshalText() (text []byte, err error)
func (TradingSession) Minutes ¶ added in v0.1.2
func (this TradingSession) Minutes() int
func (*TradingSession) Parse ¶
func (this *TradingSession) Parse(text string) error
func (TradingSession) String ¶
func (this TradingSession) String() string
func (*TradingSession) UnmarshalText ¶
func (this *TradingSession) UnmarshalText(text []byte) error
UnmarshalText 设置默认值调用
func (*TradingSession) UnmarshalYAML ¶
func (this *TradingSession) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML YAML自定义解析
type TradingTimeRange ¶ added in v0.3.8
type TradingTimeRange struct {
// contains filtered or unexported fields
}
TradingTimeRange 时间范围
左闭右开[begin, end)
func ExchangeTradingTimeRange ¶ added in v0.3.8
func ExchangeTradingTimeRange(kind TimeKind, begin, end string) TradingTimeRange
func (*TradingTimeRange) IsTrading ¶ added in v0.3.8
func (this *TradingTimeRange) IsTrading(milliseconds int64) bool
func (TradingTimeRange) Minutes ¶ added in v0.3.8
func (this TradingTimeRange) Minutes() int
func (*TradingTimeRange) Parse ¶ added in v0.3.8
func (this *TradingTimeRange) Parse(text string) error
Parse 解析文本, 覆盖属性
func (TradingTimeRange) String ¶ added in v0.3.8
func (this TradingTimeRange) String() string
func (*TradingTimeRange) UnmarshalText ¶ added in v0.3.8
func (this *TradingTimeRange) UnmarshalText(text []byte) error
UnmarshalText 设置默认值调用
由于begin和end字段不可访问, 默认值调用实际无效
func (*TradingTimeRange) UnmarshalYAML ¶ added in v0.3.8
func (this *TradingTimeRange) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML YAML自定义解析
type ValueRange ¶
type ValueRange[T ValueType] struct { // contains filtered or unexported fields }
ValueRange 数值范围
func ParseRange ¶
func ParseRange[T ValueType](text string) ValueRange[T]