tradedate

package
v0.0.0-...-c68f7f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 30, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TRADE_DATE_SEP_TIME  = "17:00:00"
	TRADE_DATE_DAY_START = "08:00:00"

	DAY_MILLIS      = 24 * 60 * 60 * 1000
	MINUTE_MILLIS   = 60 * 1000
	MINUTES_PER_DAY = DAY_MILLIS / MINUTE_MILLIS
)

Variables

This section is empty.

Functions

func GetSecurityTradeDates

func GetSecurityTradeDates(security *entity.Security) []string

func GetTradeDateRange

func GetTradeDateRange(security *entity.Security, dateString string) (startTs string, endTs string)

FIXME:

func GetTradeDateRangeByDateString

func GetTradeDateRangeByDateString(security *entity.Security, dateString string) (startTs string, endTs string, thisTradeDate string, prevTradeDate string)

func GetTradeTickers

func GetTradeTickers(security *entity.Security, timestamp uint64) []uint64

func LoadMeta

func LoadMeta()

func ToTradeTicker

func ToTradeTicker(security *entity.Security, timestamp uint64) uint64

Types

type TimeSpan

type TimeSpan struct {
	Start, End string
}

type TimeSpans

type TimeSpans struct {
	From  string
	To    string
	Spans []TimeSpan
}

type TradeDateMeta

type TradeDateMeta struct {
	From            string
	To              string
	NonTradingDates []string
}

type TradeMeta

type TradeMeta struct {
	WeekendTradingExchanges map[string]bool
	TradingTimeMeta         map[string][]TimeSpans
	NonNightDates           map[string][]string
	TradeDateMeta           map[string]*TradeDateMeta
}
var TRADE_META *TradeMeta = &TradeMeta{
	WeekendTradingExchanges: map[string]bool{
		"OKEX":   true,
		"BITMEX": true,
	},
	TradingTimeMeta: map[string][]TimeSpans{
		"OKEX": []TimeSpans{
			{
				From: "20130706",
				To:   "20380101",
				Spans: []TimeSpan{
					{
						Start: "00:00:00",
						End:   "17:00:00",
					},
					{
						Start: "17:00:00",
						End:   "24:00:00",
					},
				},
			},
		},
		"BITMEX": []TimeSpans{
			{
				From: "20130706",
				To:   "20380101",
				Spans: []TimeSpan{
					{
						Start: "00:00:00",
						End:   "17:00:00",
					},
					{
						Start: "17:00:00",
						End:   "24:00:00",
					},
				},
			},
		},
	},
	NonNightDates: map[string][]string{},
	TradeDateMeta: map[string]*TradeDateMeta{
		"OKEX": {
			From:            "20150101",
			To:              "20381230",
			NonTradingDates: []string{},
		},
		"BITMEX": {
			From:            "20150101",
			To:              "20381230",
			NonTradingDates: []string{},
		},
	},
}

func (*TradeMeta) GetDateTimeSpans

func (this *TradeMeta) GetDateTimeSpans(security *entity.Security, date string) []TimeSpan

func (*TradeMeta) GetTimeSpans

func (this *TradeMeta) GetTimeSpans(security *entity.Security) []TimeSpans

func (*TradeMeta) GetTradeDateMeta

func (this *TradeMeta) GetTradeDateMeta(exchange string) *TradeDateMeta

func (*TradeMeta) IsNonNightDate

func (this *TradeMeta) IsNonNightDate(exchange string, d string) bool

func (*TradeMeta) IsWeekendTrading

func (this *TradeMeta) IsWeekendTrading(exchange string) bool

type TradeTimeSpanDesc

type TradeTimeSpanDesc struct {
	Spans []TimeSpans
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL