common

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STOP    = 0 // 停止
	LOADING = 1 // 加载中
	RUNNING = 2 // 运行中
	REPLAY  = 3 // 回测中
)

策略状态定义

View Source
const (
	ORDER_STATUS_UNRETURN = ""  // 报单未回报
	ORDER_STATUS_UNTRADED = "3" // 报单已回报未成交
	ORDER_STATUS_TRADED   = "0" // 报单已回报已成交
	ORDER_STATUS_CANCELED = "5" // 已撤单
)

订单状态定义

View Source
const (
	INSTRUMENT_STATUS_BEFORE_TRADING   = "0" // 开盘前
	INSTRUMENT_STATUS_NO_TRADING       = "1" // 非交易
	INSTRUMENT_STATUS_CONTINOUS        = "2" // 连续交易
	INSTRUMENT_STATUS_AUCTION_ORDERING = "3" // 集合竞价报单
	INSTRUMENT_STATUS_AUCTION_BALANCE  = "4" // 集合竞价价格平衡
	INSTRUMENT_STATUS_AUCTION_MATCH    = "5" // 集合竞价撮合
	INSTRUMENT_STATUS_CLOSED           = "6" // 收盘
)

合约状态

View Source
const (
	DIRECTIONBUY  = "BUY"  // 买
	DIRECTIONSELL = "SELL" // 卖
)

交易方向

View Source
const (
	OFFSETOPEN           = "OPEN"           // 开仓
	OFFSETCLOSE          = "CLOSE"          // 平仓
	OFFSETCLOSETODAY     = "CLOSETODAY"     // 平今
	OFFSETCLOSEYESTERDAY = "CLOSEYESTERDAY" // 平昨
)

开平标志

View Source
const (
	PRICELIMIT  = "LIMIT"  // 限价
	PRICEMARKET = "MARKET" // 市价
)

限价/市价

View Source
const (
	RISKPASSFLAG = "RISKPASS" // 通过
	RISKPARTFLAG = "RISKPART" // 部分通过
	RISKZEROFLAG = "RISKZERO" // 不通过
)

风控标识

View Source
const (
	ALARMINFO  = "INFO"  // 正常
	ALARMWARN  = "WARN"  // 警告
	ALARMERROR = "ERROR" // 错误
	ALARMFATAL = "FATAL" // 致命
)

告警级别

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountField

type AccountField struct {
	// 上次质押金额
	PreMortgage float64 `json:"PreMortgage"`
	// 上次存款额
	PreDeposit float64 `json:"PreDeposit"`
	// 上次结算准备金
	PreBalance float64 `json:"PreBalance"`
	// 上次占用的保证金
	PreMargin float64 `json:"PreMargin"`
	// 利息基数
	InterestBase float64 `json:"InterestBase"`
	// 利息收入
	Interest float64 `json:"Interest"`
	// 入金金额
	Deposit float64 `json:"Deposit"`
	// 出金金额
	Withdraw float64 `json:"Withdraw"`
	// 冻结的保证金
	FrozenMargin float64 `json:"FrozenMargin"`
	// 冻结的资金
	FrozenCash float64 `json:"FrozenCash"`
	// 冻结的手续费
	FrozenCommission float64 `json:"FrozenCommission"`
	// 当前保证金总额
	CurrMargin float64 `json:"CurrMargin"`
	// 资金差额
	CashIn float64 `json:"CashIn"`
	// 手续费
	Commission float64 `json:"Commission"`
	// 平仓盈亏
	CloseProfit float64 `json:"CloseProfit"`
	// 持仓盈亏
	PositionProfit float64 `json:"PositionProfit"`
	// 期货结算准备金
	Balance float64 `json:"Balance"`
	// 可用资金
	Available float64 `json:"Available"`
	// 可取资金
	WithdrawQuota float64 `json:"WithdrawQuota"`
	// 基本准备金
	Reserve float64 `json:"Reserve"`
	// 信用额度
	Credit float64 `json:"Credit"`
	// 质押金额
	Mortgage float64 `json:"Mortgage"`
	// 交易所保证金
	ExchangeMargin float64 `json:"ExchangeMargin"`
	// 投资者交割保证金
	DeliveryMargin float64 `json:"DeliveryMargin"`
	// 交易所交割保证金
	ExchangeDeliveryMargin float64 `json:"ExchangeDeliveryMargin"`
	// 保底期货结算准备金
	ReserveBalance float64 `json:"ReserveBalance"`
	// 币种代码
	CurrencyID string `json:"CurrencyID"`
	// 上次货币质入金额
	PreFundMortgageIn float64 `json:"PreFundMortgageIn"`
	// 上次货币质出金额
	PreFundMortgageOut float64 `json:"PreFundMortgageOut"`
	// 货币质入金额
	FundMortgageIn float64 `json:"FundMortgageIn"`
	// 货币质出金额
	FundMortgageOut float64 `json:"FundMortgageOut"`
	// 货币质押余额
	FundMortgageAvailable float64 `json:"FundMortgageAvailable"`
	// 可质押货币金额
	MortgageableFund float64 `json:"MortgageableFund"`
}

*

  • @Description: 资金账户

type AccountFieldLite

type AccountFieldLite struct {
	// 冻结的资金
	FrozenCash float64 `json:"FrozenCash"`
	// 平仓盈亏
	CloseProfit float64 `json:"CloseProfit"`
	// 可用资金
	Available float64 `json:"Available"`
	// 当前保证金总额
	CurrMargin float64 `json:"CurrMargin"`
	// 手续费
	Commission float64 `json:"Commission"`
	// 持仓盈亏
	PositionProfit float64 `json:"PositionProfit"`
	// 冻结的保证金
	FrozenMargin float64 `json:"FrozenMargin"`
	// 冻结的手续费
	FrozenCommission float64 `json:"FrozenCommission"`
}

type AlarmInfo

type AlarmInfo struct {
	Time   string `json:"time"`
	Level  string `json:"level"`
	Msg    string `json:"msg"`
	Module string `json:"module"`
}

AlarmInfo

@Description: 告警信息

type Contract

type Contract struct {
	Symbol        string  `json:"symbol"`
	Exchange      string  `json:"exchange"`
	FutCode       string  `json:"fut_code"`
	TradeUnit     string  `json:"trade_unit"`
	PerUnit       float64 `json:"per_unit"`
	QuoteUnit     string  `json:"quote_unit"`
	QuoteUnitDesc string  `json:"quote_unit_desc"`
	DModeDesc     string  `json:"d_mode_desc"`
	ListDate      string  `json:"list_date"`
	DelistDate    string  `json:"delist_date"`
	DMonth        string  `json:"d_month"`
	LastDdate     string  `json:"last_ddate"`
	CreateTime    int     `json:"create_time"`
}

*

  • @Description: 合约信息

type CtpPositions

type CtpPositions struct {
	InstrumentID      string `json:"instrumentid"`
	ExchangeID        string `json:"exchangeid"`
	PositionDirection string `json:"positiondirection"`
	PositionDate      string `json:"positiondate"`
	Position          int64  `json:"position"`
	YesterdayPosition int64  `json:"yesterdayposition"`
	TodayPosition     int64  `json:"todayposition"`
}

*

  • @Description: CTP持仓信息
  • @InstrumentID: 合约代码
  • @ExchangeID: 交易所
  • @PositionDirection: 持仓类型
  • @Position: 交易所
  • @TodayPosition: 交易所

type ErrInfoField

type ErrInfoField struct {
	// 错误代码
	ErrorID int64 `json:"ErrorID"`
	// 错误信息
	ErrorMsg string `json:"ErrorMsg"`
}

type FuturesInfo

type FuturesInfo struct {
	Name     string `json:"name"`
	Code     string `json:"code"`
	Session  string `json:"session"`
	Exchange string `json:"exchange"`
	Unit     int64  `json:"unit"`
	Minimum  string `json:"minimum"`
	Group    string `json:"group"`
}

*

  • @Description: 期货开收盘信息

type HL

type HL struct {
	High float64 `json:"high"` // 最高价
	Low  float64 `json:"low"`  // 最低价
}

*

  • @Description: 高低结构

type InstrumentStatus

type InstrumentStatus struct {
	// 交易所代码
	ExchangeID string `json:"ExchangeID"`
	// 合约代码
	InstrumentID string `json:"InstrumentID"`
	// 合约交易状态
	InstrumentStatus byte `json:"InstrumentStatus"`
	// 进入本状态时间
	EnterTime string `json:"EnterTime"`
}

*

  • @Description: 合约状态

type Kline

type Kline struct {
	Symbol        string  `json:"symbol"`
	Datetime      int64   `json:"datetime"`
	Datetime_Str  string  `json:"datetime_str"`
	Open          float64 `json:"open"`
	High          float64 `json:"high"`
	Low           float64 `json:"low"`
	Close         float64 `json:"close"`
	Volume        int64   `json:"volume"`
	Open_Interest int64   `json:"open_interest"`
	Add_Time      string  `json:"add_time"`
}

*

  • @Description: K线结构

type Kline2

type Kline2 struct {
	Staname string `json:"stanme"`
	Symbol  string `json:"symbol"`
	Period  string `json:"period"`
	Kline   Kline
}

*

  • @Description: 策略用K线结构

type Kline4DB

type Kline4DB struct {
	Symbol        string  `json:"symbol"`
	Datetime      int64   `json:"datetime"`
	Datetime_Str  string  `json:"datetime_str"`
	Open          float64 `json:"open"`
	Highest       float64 `json:"highest"`
	Lowest        float64 `json:"lowest"`
	Close         float64 `json:"close"`
	Volume        int64   `json:"volume"`
	Open_Interest int64   `json:"open_interest"`
	Add_Time      string  `json:"add_time"`
}

*

  • @Description: 数据库用K线结构

type Kline4DetailUI

type Kline4DetailUI struct {
	Symbol                      string  `json:"symbol"`
	Datetime                    int64   `json:"datetime"`
	Datetime_Str                string  `json:"datetime_str"`
	Open                        float64 `json:"open"`
	High                        float64 `json:"high"`
	Low                         float64 `json:"low"`
	Close                       float64 `json:"close"`
	Volume                      int64   `json:"volume"`
	Open_Interest               int64   `json:"open_interest"`
	LoadingOrderIsBuyOpen       bool    `json:"loadingorderisbuyopen"`
	LoadingOrderBuyOpenPrice    float64 `json:"loadingorderbuyopenprice"`
	LoadingOrderBuyOpenVolume   int64   `json:"loadingorderbuyopenvolume"`
	LoadingOrderIsBuyClose      bool    `json:"loadingorderisbuyclose"`
	LoadingOrderBuyClosePrice   float64 `json:"loadingorderbuycloseprice"`
	LoadingOrderBuyCloseVolume  int64   `json:"loadingorderbuyclosevolume"`
	LoadingOrderIsSellOpen      bool    `json:"loadingorderissellopen"`
	LoadingOrderSellOpenPrice   float64 `json:"loadingordersellopenprice"`
	LoadingOrderSellOpenVolume  int64   `json:"loadingordersellopenvolume"`
	LoadingOrderIsSellClose     bool    `json:"loadingorderissellclose"`
	LoadingOrderSellClosePrice  float64 `json:"loadingordersellcloseprice"`
	LoadingOrderSellCloseVolume int64   `json:"loadingordersellclosevolume"`

	TradeOrderIsBuyOpen       bool    `json:"tradeorderisbuyopen"`
	TradeOrderBuyOpenPrice    float64 `json:"tradeorderbuyopenprice"`
	TradeOrderBuyOpenVolume   int64   `json:"tradeorderbuyopenvolume"`
	TradeOrderIsBuyClose      bool    `json:"tradeorderisbuyclose"`
	TradeOrderBuyClosePrice   float64 `json:"tradeorderbuycloseprice"`
	TradeOrderBuyCloseVolume  int64   `json:"tradeorderbuyclosevolume"`
	TradeOrderIsSellOpen      bool    `json:"tradeorderissellopen"`
	TradeOrderSellOpenPrice   float64 `json:"tradeordersellopenprice"`
	TradeOrderSellOpenVolume  int64   `json:"tradeordersellopenvolume"`
	TradeOrderIsSellClose     bool    `json:"tradeorderissellclose"`
	TradeOrderSellClosePrice  float64 `json:"tradeordersellcloseprice"`
	TradeOrderSellCloseVolume int64   `json:"tradeordersellclosevolume"`
}

*

  • @Description: 详情前端界面用数据结构

type Kline4UI

type Kline4UI struct {
	Symbol        string  `json:"symbol"`
	Datetime      int64   `json:"time"`
	Datetime_Str  string  `json:"time_str"`
	Open          float64 `json:"open"`
	High          float64 `json:"high"`
	Low           float64 `json:"low"`
	Close         float64 `json:"close"`
	Volume        int64   `json:"volume"`
	Open_Interest int64   `json:"open_interest"`
}

*

  • @Description: 回测前端界面用数据结构

type KlineCache

type KlineCache struct {
	Last *Kline // 上次报价
	New  *Kline // 最新报价
}

*

  • @Description: 最近K线缓存结构

type KlineKey

type KlineKey struct {
	Symbol  string `json:"symbol"`  // 合约代码
	SymbolT string `json:"symbolt"` // 品种代码
	Period  string `json:"period"`  // 周期 0:实时报价/1:1分钟/5:5分钟/10:10分钟/15:15分钟/30:30分钟/60:60分钟/d:日线
}

* * @Description: K线缓存主键

type LastPrice

type LastPrice struct {
	Datetime        int64   `json:"datetime"`        // 时间戳
	LastPrice       float64 `json:"lastprice"`       // 最新价
	UpperLimitPrice float64 `json:"upperlimitprice"` // 涨停价
	LowerLimitPrice float64 `json:"lowerlimitprice"` // 跌停价
}

*

  • @Description: 最新价结构,包含涨停价和跌停价

type MdMessage

type MdMessage struct {
	Action    string `json:"action"`
	ActionExt string `json:"actionext"`
	Data      string `json:"data"`
	DataExt   string `json:"dataext"`
}

*

  • @Description: 消息结构

type OpenHighLow

type OpenHighLow struct {
	Open float64 // 开盘价
	High float64 // 最高价
	Low  float64 // 最低价
}

*

  • @Description: 开高低结构

type OrderBase

type OrderBase struct {
	SN           string  `json:"sn"`           // 订单号
	StaName      string  `json:"staname"`      // 策略名
	Symbol       string  `json:"symbol"`       // 合约代码
	Exchange     string  `json:"exchange"`     // 交易所
	Direction    string  `json:"direction"`    // 交易方向
	Offset       string  `json:"offset"`       // 开平标志
	OType        string  `json:"otype"`        // 限价/市价
	Status       string  `json:"status"`       // 订单状态
	Price        float64 `json:"price"`        // 报单价格
	TotalVolume  int64   `json:"totalvolume"`  // 报单数量
	VolumeTraded int64   `json:"volumetraded"` // 已成交数量
	VolumeLeft   int64   `json:"volumeleft"`   // 未成交数量
	Datetime     int64   `json:"datetime"`     // 实时行情时间戳
	CreateTime   int64   `json:"createtime"`   // 订单创建时间
	RiskFlag     string  `json:"riskflag"`     // 风控标识
}

*

  • @Description: 订单基础结构
  • @SN: 订单编号
  • @StaName: 策略名
  • @Symbol: 合约代码
  • @Direction: 买卖方向
  • @Offset: 开平仓
  • @Price: 价格
  • @Volume: 数量

type OrderErrField

type OrderErrField struct {
	OrderField   OrderField
	ErrInfoField ErrInfoField
}

type OrderField

type OrderField struct {
	// 合约代码
	InstrumentID string `json:"InstrumentID"`
	// 报单引用
	OrderRef string `json:"OrderRef"`
	// 买卖方向
	Direction byte `json:"Direction"`
	// 组合开平标志
	OffsetFlag byte `json:"OffsetFlag"`
	// 组合投机套保标志
	HedgeFlag byte `json:"HedgeFlag"`
	// 价格
	LimitPrice float64 `json:"LimitPrice"`
	// 数量
	VolumeTotalOriginal int64 `json:"VolumeTotalOriginal"`
	// 交易所代码
	ExchangeID string `json:"ExchangeID"`
	// 请求ID
	RequestID int64 `json:"RequestID"`
	// 报单编号
	OrderSysID string `json:"OrderSysID"`
	// 报单状态
	OrderStatus byte `json:"OrderStatus"`
	// 今成交数量
	VolumeTraded int64 `json:"VolumeTraded"`
	// 剩余数量
	VolumeLeft int64 `json:"VolumeLeft"`
	// 报单日期
	InsertDate string `json:"InsertDate"`
	// 委托时间
	InsertTime string `json:"InsertTime"`
	// 撤销时间
	CancelTime string `json:"CancelTime"`
	// 前置编号
	FrontID int64 `json:"FrontID"`
	// 状态信息
	StatusMsg string `json:"StatusMsg"`
	// 是否本次登录后的委托
	IsLocal bool `json:"IsLocal"`
	// 成交时间(有OnTrade更新)
	LastTradeTime string `json:"LastTradeTime"`
}

*

  • @Description: 报单结构

type OrderLast

type OrderLast struct {
	Symbol    string `json:"symbol"`
	Direction string `json:"direction"`
	Offset    string `json:"offset"`
	Volume    int64  `json:"volume"`
}

*

  • @Description: 最新订单数据

type Quote

type Quote struct {
	Symbol          string  `json:"symbol"`
	SymbolT         string  `json:"symbolt"`
	Exchange        string  `json:"exchange"`
	ExchangeInst    string  `json:"exchange_inst"`
	Datetime        int64   `json:"datetime"`
	DatetimeStr     string  `json:"datetime_str"`
	AskPrice5       float64 `json:"ask_price5,string"`
	AskVolume5      int64   `json:"ask_volume5,string"`
	AskPrice4       float64 `json:"ask_price4,string"`
	AskVolume4      int64   `json:"ask_volume4,string"`
	AskPrice3       float64 `json:"ask_price3,string"`
	AskVolume3      int64   `json:"ask_volume3,string"`
	AskPrice2       float64 `json:"ask_price2,string"`
	AskVolume2      int64   `json:"ask_volume2,string"`
	AskPrice1       float64 `json:"ask_price1,string"`
	AskVolume1      int64   `json:"ask_volume1,string"`
	BidPrice1       float64 `json:"bid_price1,string"`
	BidVolume1      int64   `json:"bid_volume1,string"`
	BidPrice2       float64 `json:"bid_price2,string"`
	BidVolume2      int64   `json:"bid_volume2,string"`
	BidPrice3       float64 `json:"bid_price3,string"`
	BidVolume3      int64   `json:"bid_volume3,string"`
	BidPrice4       float64 `json:"bid_price4,string"`
	BidVolume4      int64   `json:"bid_volume4,string"`
	BidPrice5       float64 `json:"bid_price5,string"`
	BidVolume5      int64   `json:"bid_volume5,string"`
	LastPrice       float64 `json:"last_price,string"`
	Highest         float64 `json:"highest,string"`
	Lowest          float64 `json:"lowest,string"`
	Open            float64 `json:"open,string"`
	Average         float64 `json:"average,string"`
	Volume          int64   `json:"volume,string"`
	Amount          float64 `json:"amount,string"`
	Close           float64 `json:"close,string"`
	OpenInterest    int64   `json:"open_interest,string"`
	UpperLimit      float64 `json:"upper_limit,string"`
	LowerLimit      float64 `json:"lower_limit,string"`
	PreOpenInterest int64   `json:"pre_open_interest,string"`
	PreSettlement   float64 `json:"pre_settlement,string"`
	PreClose        float64 `json:"pre_close,string"`
	LocalTimestamp  int64   `json:"local_timestamp"`
}

*

  • @Description: 行情数据结构

type QuoteCache

type QuoteCache struct {
	Last *Quote // 上次报价
	New  *Quote // 最新报价
}

*

  • @Description: 最近Quote缓存结构

type QuoteLite

type QuoteLite struct {
	Symbol      string  `json:"symbol"`
	Datetime    int64   `json:"datetime"`
	DatetimeStr string  `json:"datetime_str"`
	LastPrice   float64 `json:"last_price,string"`
}

type ReplayData

type ReplayData struct {
	MainTick  []Tick2
	SubTick   []Tick2
	MainKline []Kline2
	SubKline  []Kline2
	Page      int64
	TotalPage int64
	Begin     bool
	Finish    bool
	Done      bool
}

*

  • @Description: 回测数据结构
  • @Symbol: 合约代码
  • @Period: 周期
  • @StaName: 策略名称
  • @Kline: K线数据
  • @Finish: 结束状态
  • @Page: 当前页号
  • @TotalPage: 页总数
  • @Curr: 当前合约序号
  • @Total: 所有合约数量

type ReplayInfo

type ReplayInfo struct {
	FileName  string
	Page      int64
	TotalPage int64
	Begin     bool
	Finish    bool
	Done      bool
}

type ReplaySubscribeKline

type ReplaySubscribeKline struct {
	StaName string
	Symbol  string
	Period  string
}

*

  • @Description: 回测用订阅K线行情

type RiskMessage

type RiskMessage struct {
	Symbol       string `json:"symbol"`
	BeforeVolume int64  `json:"beforevolume"`
	AfterVolume  int64  `json:"aftervolume"`
	Memo         string `json:"memo"`
}

*

  • @Description: 风控消息

type RiskOrderVolume

type RiskOrderVolume struct {
	Symbol                string        `json:"symbol"`
	PositionDirection     string        `json:"positiondirection"`
	OpenVolume            int64         `json:"openvolume"`  // 开仓
	CloseVolume           int64         `json:"closevolume"` // 平仓
	MaxVolume             int64         `json:"maxvolume"`   // 最大报单量
	Multiple              int64         `json:"multiple"`    // 合约乘数
	LastPrice             float64       `json:"lastprice"`   // 最新价
	YesterdayRiskPosition *RiskPosition // 昨仓风控持仓指针
	TodayRiskPosition     *RiskPosition // 今仓风控持仓指针
}

*

  • @Description: 风控用报单临时寄存器

type RiskPosition

type RiskPosition struct {
	Symbol            string  `json:"symbol"`
	PositionDirection string  `json:"positiondirection"` // 持仓多空方向
	PositionDate      string  `json:"positiondate"`      // 持仓日期
	Position          int64   `json:"position"`          // 持仓
	LongFrozen        int64   `json:"longfrozen"`        // 多头冻结
	LongFrozenAmount  float64 `json:"longfrozenamount"`  // 多头冻结金额
	ShortFrozen       int64   `json:"shortfrozen"`       // 空头冻结
	ShortFrozenAmount float64 `json:"shortfrozenamount"` // 空头冻结金额
	UseMargin         float64 `json:"usemargin"`         // 占用保证金
	FrozenMargin      float64 `json:"frozenmargin"`      // 冻结保证金
	FrozenCash        float64 `json:"frozencash"`        // 冻结资金
	FrozenCommission  float64 `json:"frozencommission"`  // 冻结手续费
	Commission        float64 `json:"commission"`        // 手续费
}

*

  • @Description: 风控用实际持仓寄存器

type RspInfoField

type RspInfoField struct {
	OrderSN      string `json:"OrderSN"`
	ErrInfoField ErrInfoField
}

type StaConfig

type StaConfig struct {
	Desc          string
	PrintQuote    bool
	PrintPosition bool
	Period        string
	Length        int
	Main          []string
	Sub           []string
	Extend        map[string]interface{}
}

* * @Description: 策略配置文件 * @MainQuote: 主合约Quote配置 * @SubQuote: 次合约Quote配置 * @Mainkline: 主合约Kline配置 * @subkline: 次合约Kline配置 * @MainTrade: 主交易合约代码 * @SubTrade: 次交易合约代码 * @Extend: 扩展key=value参数配置

type StaConfigEx added in v1.3.5

type StaConfigEx struct {
	StaName         string                   `json:"staname"`
	Desc            string                   `json:"desc"`
	Period          string                   `json:"period"`
	Length          int                      `json:"length"`
	MainSymbol      string                   `json:"mainsymbol"`
	MainTradeSymbol string                   `json:"maintradesymbol"`
	SubSymbol       string                   `json:"subsymbol"`
	SubTradeSymbol  string                   `json:"subtradesymbol"`
	Extend          []map[string]interface{} `json:"extend"`
}

StaConfigEx

@Description: 用于发布程序

type StrategyAggInfo

type StrategyAggInfo struct {
	BaseInfoList []StrategyBaseInfo
	PositionList []CtpPositions
}

type StrategyBaseInfo

type StrategyBaseInfo struct {
	Pid                    int     `json:"pid"`
	Name                   string  `json:"name"`
	Desc                   string  `json:"desc"`
	State                  int64   `json:"state"`
	MainQuote              string  `json:"mainquote"`
	MainQuoteLen           int     `json:"mainquotelen"`
	MainQuotePrice         float64 `json:"mainquoteprice"`
	SubQuote               string  `json:"subquote"`
	SubQuoteLen            int     `json:"subquotelen"`
	SubQuotePrice          float64 `json:"subquoteprice"`
	MainKlineSymbol        string  `json:"mainklinesymbol"`
	MainKlinePeriod        string  `json:"mainklineperiod"`
	MainKlineLen           int     `json:"mainklinelen"`
	MainKlinePrice         float64 `json:"mainklineprice"`
	SubKlineSymbol         string  `json:"subklinesymbol"`
	SubKlinePeriod         string  `json:"subklineperiod"`
	SubKlineLen            int     `json:"subklinelen"`
	SubKlinePrice          float64 `json:"subklineprice"`
	MainSymbol             string  `json:"mainsymbol"`
	MainTradePrice         float64 `json:"maintradeprice"`
	MainVirtualPosition    int64   `json:"mainvirtualposition"`
	MainLongOrderPosition  int64   `json:"mainlongorderposition"`
	MainShortOrderPosition int64   `json:"mainshortorderposition"`
	MainLongRealPosition   int64   `json:"mainlongrealposition"`
	MainShortRealPosition  int64   `json:"mainshortrealposition"`
	SubSymbol              string  `json:"subsymbol"`
	SubTradePrice          float64 `json:"subtradeprice"`
	SubVirtualPosition     int64   `json:"subvirtualposition"`
	SubLongOrderPosition   int64   `json:"sublongorderposition"`
	SubShortOrderPosition  int64   `json:"subshortorderposition"`
	SubLongRealPosition    int64   `json:"sublongrealposition"`
	SubShortRealPosition   int64   `json:"subshortrealposition"`
	Selected               bool    `json:"selected"`
}

*

  • @Description: 策略信息
  • @Name: 名称
  • @State: 状态

type StrategyBaseLite

type StrategyBaseLite struct {
	Name            string  `json:"name"`
	Sort            int64   `json:"sort"`
	MainQuote       string  `json:"mainquote"`
	MainQuotePrice  float64 `json:"mainquoteprice"`
	SubQuote        string  `json:"subquote"`
	SubQuotePrice   float64 `json:"subquoteprice"`
	MainKlineSymbol string  `json:"mainklinesymbol"`
	MainKlinePeriod string  `json:"mainklineperiod"`
	MainKlinePrice  float64 `json:"mainklineprice"`
	SubKlineSymbol  string  `json:"subklinesymbol"`
	SubKlinePeriod  string  `json:"subklineperiod"`
	SubKlinePrice   float64 `json:"subklineprice"`
	MainSymbol      string  `json:"mainsymbol"`
	MainTradePrice  float64 `json:"maintradeprice"`
	SubSymbol       string  `json:"subsymbol"`
	SubTradePrice   float64 `json:"subtradeprice"`
}

type Tick

type Tick struct {
	Symbol          string  `json:"symbol"`
	Datetime        int64   `json:"datetime"`
	DatetimeStr     string  `json:"datetime_str"`
	AskPrice5       float64 `json:"ask_price5"`
	AskVolume5      int64   `json:"ask_volume5"`
	AskPrice4       float64 `json:"ask_price4"`
	AskVolume4      int64   `json:"ask_volume4"`
	AskPrice3       float64 `json:"ask_price3"`
	AskVolume3      int64   `json:"ask_volume3"`
	AskPrice2       float64 `json:"ask_price2"`
	AskVolume2      int64   `json:"ask_volume2"`
	AskPrice1       float64 `json:"ask_price1"`
	AskVolume1      int64   `json:"ask_volume1"`
	BidPrice1       float64 `json:"bid_price1"`
	BidVolume1      int64   `json:"bid_volume1"`
	BidPrice2       float64 `json:"bid_price2"`
	BidVolume2      int64   `json:"bid_volume2"`
	BidPrice3       float64 `json:"bid_price3"`
	BidVolume3      int64   `json:"bid_volume3"`
	BidPrice4       float64 `json:"bid_price4"`
	BidVolume4      int64   `json:"bid_volume4"`
	BidPrice5       float64 `json:"bid_price5"`
	BidVolume5      int64   `json:"bid_volume5"`
	LastPrice       float64 `json:"last_price"`
	Highest         float64 `json:"highest"`
	Lowest          float64 `json:"lowest"`
	Open            float64 `json:"open"`
	Average         float64 `json:"average"`
	Volume          int64   `json:"volume"`
	Amount          float64 `json:"amount"`
	Close           float64 `json:"close"`
	OpenInterest    int64   `json:"open_interest"`
	UpperLimit      float64 `json:"upper_limit"`
	LowerLimit      float64 `json:"lower_limit"`
	PreOpenInterest int64   `json:"pre_open_interest"`
	PreSettlement   float64 `json:"pre_settlement"`
	PreClose        float64 `json:"pre_close"`
	AddTime         string  `json:"add_time"`
}

*

  • @Description: Tick结构

type Tick2

type Tick2 struct {
	Staname string `json:"stanme"`
	Symbol  string `json:"symbol"`
	Tick    Tick
}

*

  • @Description: 策略用Tick结构

type Tick4DB

type Tick4DB struct {
	Symbol            string  `json:"symbol"`
	Datetime          int64   `json:"datetime"`
	Datetime_Str      string  `json:"datetime_str"`
	Ask_Price5        float64 `json:"ask_price5"`
	Ask_Volume5       int64   `json:"ask_volume5"`
	Ask_Price4        float64 `json:"ask_price4"`
	Ask_Volume4       int64   `json:"ask_volume4"`
	Ask_Price3        float64 `json:"ask_price3"`
	Ask_Volume3       int64   `json:"ask_volume3"`
	Ask_Price2        float64 `json:"ask_price2"`
	Ask_Volume2       int64   `json:"ask_volume2"`
	Ask_Price1        float64 `json:"ask_price1"`
	Ask_Volume1       int64   `json:"ask_volume1"`
	Bid_Price1        float64 `json:"bid_price1"`
	Bid_Volume1       int64   `json:"bid_volume1"`
	Bid_Price2        float64 `json:"bid_price2"`
	Bid_Volume2       int64   `json:"bid_volume2"`
	Bid_Price3        float64 `json:"bid_price3"`
	Bid_Volume3       int64   `json:"bid_volume3"`
	Bid_Price4        float64 `json:"bid_price4"`
	Bid_Volume4       int64   `json:"bid_volume4"`
	Bid_Price5        float64 `json:"bid_price5"`
	Bid_Volume5       int64   `json:"bid_volume5"`
	Last_Price        float64 `json:"last_price"`
	Highest           float64 `json:"highest"`
	Lowest            float64 `json:"lowest"`
	Open              float64 `json:"open"`
	Average           float64 `json:"average"`
	Volume            int64   `json:"volume"`
	Amount            float64 `json:"amount"`
	Close             float64 `json:"close"`
	Open_Interest     int64   `json:"open_interest"`
	Upper_Limit       float64 `json:"upper_limit"`
	Lower_Limit       float64 `json:"lower_limit"`
	Pre_Open_Interest int64   `json:"pre_open_interest"`
	Pre_Settlement    float64 `json:"pre_settlement"`
	Pre_Close         float64 `json:"pre_close"`
	Add_Time          string  `json:"add_time"`
}

*

  • @Description: Tick结构

type Tick4DetailUI

type Tick4DetailUI struct {
	Tick                        Tick
	LoadingOrderIsBuyOpen       bool    `json:"loadingorderisbuyopen"`
	LoadingOrderBuyOpenPrice    float64 `json:"loadingorderbuyopenprice"`
	LoadingOrderBuyOpenVolume   int64   `json:"loadingorderbuyopenvolume"`
	LoadingOrderIsBuyClose      bool    `json:"loadingorderisbuyclose"`
	LoadingOrderBuyClosePrice   float64 `json:"loadingorderbuycloseprice"`
	LoadingOrderBuyCloseVolume  int64   `json:"loadingorderbuyclosevolume"`
	LoadingOrderIsSellOpen      bool    `json:"loadingorderissellopen"`
	LoadingOrderSellOpenPrice   float64 `json:"loadingordersellopenprice"`
	LoadingOrderSellOpenVolume  int64   `json:"loadingordersellopenvolume"`
	LoadingOrderIsSellClose     bool    `json:"loadingorderissellclose"`
	LoadingOrderSellClosePrice  float64 `json:"loadingordersellcloseprice"`
	LoadingOrderSellCloseVolume int64   `json:"loadingordersellclosevolume"`

	TradeOrderIsBuyOpen       bool    `json:"tradeorderisbuyopen"`
	TradeOrderBuyOpenPrice    float64 `json:"tradeorderbuyopenprice"`
	TradeOrderBuyOpenVolume   int64   `json:"tradeorderbuyopenvolume"`
	TradeOrderIsBuyClose      bool    `json:"tradeorderisbuyclose"`
	TradeOrderBuyClosePrice   float64 `json:"tradeorderbuycloseprice"`
	TradeOrderBuyCloseVolume  int64   `json:"tradeorderbuyclosevolume"`
	TradeOrderIsSellOpen      bool    `json:"tradeorderissellopen"`
	TradeOrderSellOpenPrice   float64 `json:"tradeordersellopenprice"`
	TradeOrderSellOpenVolume  int64   `json:"tradeordersellopenvolume"`
	TradeOrderIsSellClose     bool    `json:"tradeorderissellclose"`
	TradeOrderSellClosePrice  float64 `json:"tradeordersellcloseprice"`
	TradeOrderSellCloseVolume int64   `json:"tradeordersellclosevolume"`
}

*

  • @Description: 详情前端界面用数据结构

type Tick4Replay added in v1.3.0

type Tick4Replay struct {
	Symbol      string  `json:"symbol"`
	Datetime    int64   `json:"datetime"`
	DatetimeStr string  `json:"datetime_str"`
	LastPrice   float64 `json:"last_price"`
}

type Tick4ReplayMerge added in v1.3.4

type Tick4ReplayMerge struct {
	Datetime      int64   `json:"datetime"`
	DatetimeStr   string  `json:"datetime_str"`
	MainSymbol    string  `json:"main_symbol"`
	MainLastPrice float64 `json:"main_last_price"`
	SubSymbol     string  `json:"sub_symbol"`
	SubLastPrice  float64 `json:"sub_last_price"`
}

type TradeField

type TradeField struct {
	// 报单引用
	OrderRef string `json:"OrderRef"`
	// 合约代码
	InstrumentID string `json:"InstrumentID"`
	// 交易所代码
	ExchangeID string `json:"ExchangeID"`
	// 成交编号
	TradeID string `json:"TradeID"`
	// 买卖方向
	Direction byte `json:"Direction"`
	// 报单编号
	OrderSysID string `json:"OrderSysID"`
	// 开平标志
	OffsetFlag byte `json:"OffsetFlag"`
	// 投机套保标志
	HedgeFlag byte `json:"HedgeFlag"`
	// 价格
	Price float64 `json:"Price"`
	// 数量
	Volume int64 `json:"Volume"`
	// 成交时期
	TradeDate string `json:"TradeDate"`
	// 成交时间
	TradeTime string `json:"TradeTime"`
	// 交易日
	TradingDay string `json:"TradingDay"`
}

*

  • @Description: 成交结构

type TradedOrder

type TradedOrder struct {
	StaName     string  `json:"staname"`
	SN          string  `json:"sn"`
	Symbol      string  `json:"symbol"`
	Direction   string  `json:"direction"`
	Offset      string  `json:"offset"`
	Status      string  `json:"status"`
	Price       float64 `json:"price"`
	Volume      int64   `json:"volume"`
	Datetime    int64   `json:"datetime"`
	DatetimeStr string  `json:"datetimestr"`
	Datetime4UI string  `json:"datetime4ui"`
}

*

  • @Description: 成交订单

type TradedOrder4UI

type TradedOrder4UI struct {
	StaName         string  `json:"staname"`
	Symbol          string  `json:"symbol"`
	IsBuyOpen       bool    `json:"isbuyopen"`
	BuyOpenPrice    float64 `json:"buyopenprice"`
	BuyOpenVolume   int64   `json:"buyopenvolume"`
	IsBuyClose      bool    `json:"isbuyclose"`
	BuyClosePrice   float64 `json:"buycloseprice"`
	BuyCloseVolume  int64   `json:"buyclosevolume"`
	IsSellOpen      bool    `json:"issellopen"`
	SellOpenPrice   float64 `json:"sellopenprice"`
	SellOpenVolume  int64   `json:"sellopenvolume"`
	IsSellClose     bool    `json:"issellclose"`
	SellClosePrice  float64 `json:"sellcloseprice"`
	SellCloseVolume int64   `json:"sellclosevolume"`
	Position        int64   `json:"position"`
	Multiplier      int64   `json:"multiplier"`
	Budget          float64 `json:"budget"`
	Profit          float64 `json:"profit"`
	ProfitLine      float64 `json:"profitline"`
	WinRate         float64 `json:"winrate"`
	WinMoney        float64 `json:"winmoney"`
	LoseMoney       float64 `json:"losemoney"`
	Datetime        int64   `json:"datetime"`
	DatetimeStr     string  `json:"datetimestr"`
}

*

  • @Description: 给前端的成交订单结构

type TradedReport

type TradedReport struct {
	StaName     string  `json:"staname"`
	SN          string  `json:"sn"`
	Symbol      string  `json:"symbol"`
	Direction   string  `json:"direction"`
	Offset      string  `json:"offset"`
	Price       float64 `json:"price"`
	Volume      int64   `json:"volume"`
	Position    int64   `json:"position"`
	Multiplier  int64   `json:"multiplier"`
	Budget      float64 `json:"budget"`
	Profit      float64 `json:"profit"`
	ProfitLine  float64 `json:"profitline"`
	WinRate     float64 `json:"winrate"`
	WinMoney    float64 `json:"winmoney"`
	LoseMoney   float64 `json:"losemoney"`
	Datetime    int64   `json:"datetime"`
	DatetimeStr string  `json:"datetimestr"`
	Datetime4UI string  `json:"datetime4ui"`
}

Jump to

Keyboard shortcuts

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