ctp

package
v0.0.0-...-104f2f5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2018 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDirectorCThostFtdcMdSpi

func NewDirectorCThostFtdcMdSpi(v interface{}) GoFuture.CThostFtdcMdSpi

func NewDirectorCThostFtdcTraderSpi

func NewDirectorCThostFtdcTraderSpi(v interface{}) GoFuture.CThostFtdcTraderSpi

func Parse

func Parse(file string, cfg interface{})

func Start

func Start(tp string)

func StartTrade

func StartTrade()

Types

type CtpCfg

type CtpCfg struct {
	BrokerID   string
	InvestorID string
	Password   string

	MdFront string
	MdApi   GoFuture.CThostFtdcMdApi

	TraderFront string
	TraderApi   GoFuture.CThostFtdcTraderApi

	MdRequestID     int
	TraderRequestID int
}
var CTP CtpCfg

const (

Broker_id    = "9999"
Investor_id  = "025458"
Pass_word    = "123456"
Market_front = "tcp://180.168.146.187:10011"
Trade_front  = "tcp://180.168.146.187:10001"

)

func (*CtpCfg) GetMdRequestID

func (g *CtpCfg) GetMdRequestID() int

func (*CtpCfg) GetTraderRequestID

func (g *CtpCfg) GetTraderRequestID() int

type GoCThostFtdcMdSpi

type GoCThostFtdcMdSpi struct {
	Client CtpCfg
}

func (*GoCThostFtdcMdSpi) IsErrorRspInfo

func (p *GoCThostFtdcMdSpi) IsErrorRspInfo(pRspInfo GoFuture.CThostFtdcRspInfoField) bool

func (*GoCThostFtdcMdSpi) OnFrontConnected

func (p *GoCThostFtdcMdSpi) OnFrontConnected()

func (*GoCThostFtdcMdSpi) OnFrontDisconnected

func (p *GoCThostFtdcMdSpi) OnFrontDisconnected(nReason int)

func (*GoCThostFtdcMdSpi) OnHeartBeatWarning

func (p *GoCThostFtdcMdSpi) OnHeartBeatWarning(nTimeLapse int)

func (*GoCThostFtdcMdSpi) OnRspError

func (p *GoCThostFtdcMdSpi) OnRspError(pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcMdSpi) OnRspSubForQuoteRsp

func (p *GoCThostFtdcMdSpi) OnRspSubForQuoteRsp(pSpecificInstrument GoFuture.CThostFtdcSpecificInstrumentField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcMdSpi) OnRspSubMarketData

func (p *GoCThostFtdcMdSpi) OnRspSubMarketData(pSpecificInstrument GoFuture.CThostFtdcSpecificInstrumentField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcMdSpi) OnRspUnSubForQuoteRsp

func (p *GoCThostFtdcMdSpi) OnRspUnSubForQuoteRsp(pSpecificInstrument GoFuture.CThostFtdcSpecificInstrumentField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcMdSpi) OnRspUnSubMarketData

func (p *GoCThostFtdcMdSpi) OnRspUnSubMarketData(pSpecificInstrument GoFuture.CThostFtdcSpecificInstrumentField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcMdSpi) OnRspUserLogin

func (p *GoCThostFtdcMdSpi) OnRspUserLogin(pRspUserLogin GoFuture.CThostFtdcRspUserLoginField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcMdSpi) OnRtnDepthMarketData

func (p *GoCThostFtdcMdSpi) OnRtnDepthMarketData(pDepthMarketData GoFuture.CThostFtdcDepthMarketDataField)

func (*GoCThostFtdcMdSpi) OnRtnForQuoteRsp

func (p *GoCThostFtdcMdSpi) OnRtnForQuoteRsp(pForQuoteRsp GoFuture.CThostFtdcForQuoteRspField)

func (*GoCThostFtdcMdSpi) ReqUserLogin

func (p *GoCThostFtdcMdSpi) ReqUserLogin()

func (*GoCThostFtdcMdSpi) SubscribeForQuoteRsp

func (p *GoCThostFtdcMdSpi) SubscribeForQuoteRsp(name []string)

func (*GoCThostFtdcMdSpi) SubscribeMarketData

func (p *GoCThostFtdcMdSpi) SubscribeMarketData(name []string)

type GoCThostFtdcTraderSpi

type GoCThostFtdcTraderSpi struct {
	Client CtpCfg
}

func (*GoCThostFtdcTraderSpi) IsErrorRspInfo

func (p *GoCThostFtdcTraderSpi) IsErrorRspInfo(pRspInfo GoFuture.CThostFtdcRspInfoField) bool

func (*GoCThostFtdcTraderSpi) IsFlowControl

func (p *GoCThostFtdcTraderSpi) IsFlowControl(iResult int) bool

func (*GoCThostFtdcTraderSpi) OnFrontConnected

func (p *GoCThostFtdcTraderSpi) OnFrontConnected()

func (*GoCThostFtdcTraderSpi) OnFrontDisconnected

func (p *GoCThostFtdcTraderSpi) OnFrontDisconnected(nReason int)

func (*GoCThostFtdcTraderSpi) OnHeartBeatWarning

func (p *GoCThostFtdcTraderSpi) OnHeartBeatWarning(nTimeLapse int)

func (*GoCThostFtdcTraderSpi) OnRspError

func (p *GoCThostFtdcTraderSpi) OnRspError(pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcTraderSpi) OnRspQryInstrument

func (p *GoCThostFtdcTraderSpi) OnRspQryInstrument(pInstrument GoFuture.CThostFtdcInstrumentField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcTraderSpi) OnRspQryInvestorPosition

func (p *GoCThostFtdcTraderSpi) OnRspQryInvestorPosition(pInvestorPosition GoFuture.CThostFtdcInvestorPositionField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcTraderSpi) OnRspQryTradingAccount

func (p *GoCThostFtdcTraderSpi) OnRspQryTradingAccount(pTradingAccount GoFuture.CThostFtdcTradingAccountField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcTraderSpi) OnRspSettlementInfoConfirm

func (p *GoCThostFtdcTraderSpi) OnRspSettlementInfoConfirm(pSettlementInfoConfirm GoFuture.CThostFtdcSettlementInfoConfirmField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcTraderSpi) OnRspUserLogin

func (p *GoCThostFtdcTraderSpi) OnRspUserLogin(pRspUserLogin GoFuture.CThostFtdcRspUserLoginField, pRspInfo GoFuture.CThostFtdcRspInfoField, nRequestID int, bIsLast bool)

func (*GoCThostFtdcTraderSpi) ReqQryInstrument

func (p *GoCThostFtdcTraderSpi) ReqQryInstrument()

func (*GoCThostFtdcTraderSpi) ReqQryInvestorPosition

func (p *GoCThostFtdcTraderSpi) ReqQryInvestorPosition()

func (*GoCThostFtdcTraderSpi) ReqQryTradingAccount

func (p *GoCThostFtdcTraderSpi) ReqQryTradingAccount()

func (*GoCThostFtdcTraderSpi) ReqSettlementInfoConfirm

func (p *GoCThostFtdcTraderSpi) ReqSettlementInfoConfirm()

func (*GoCThostFtdcTraderSpi) ReqUserLogin

func (p *GoCThostFtdcTraderSpi) ReqUserLogin()

type QuoteTick

type QuoteTick struct {
	TradingDay         string `json:"TradingDay"`
	InstrumentID       string `json:"InstrumentID"`
	ExchangeID         string `json:"ExchangeID"`
	ExchangeInstID     string `json:"ExchangeInstID"`
	LastPrice          string `json:"LastPrice"`
	PreSettlementPrice string `json:"PreSettlementPrice"`
	PreClosePrice      string `json:"PreClosePrice"`
	PreOpenInterest    string `json:"PreOpenInterest"`
	OpenPrice          string `json:"OpenPrice"`
	HighestPrice       string `json:"HighestPrice"`
	LowestPrice        string `json:"LowestPrice"`
	Turnover           string `json:"Turnover"`
	OpenInterest       string `json:"OpenInterest"`
	ClosePrice         string `json:"ClosePrice"`
	SettlementPrice    string `json:"SettlementPrice"`
	UpperLimitPrice    string `json:"UpperLimitPrice"`
	LowerLimitPrice    string `json:"LowerLimitPrice"`
	PreDelta           string `json:"PreDelta"`
	CurrDelta          string `json:"CurrDelta"`
	UpdateTime         string `json:"UpdateTime"`
	UpdateMillisec     string `json:"UpdateMillisec"`

	BidPrice1  string `json:"BidPrice1"`
	BidVolume1 string `json:"BidVolume1"`
	AskPrice1  string `json:"AskPrice1"`
	AskVolume1 string `json:"AskVolume1"`

	BidPrice2  string `json:"BidPrice2"`
	BidVolume2 string `json:"BidVolume2"`
	AskPrice2  string `json:"AskPrice2"`
	AskVolume2 string `json:"AskVolume2"`

	BidPrice3  string `json:"BidPrice3"`
	BidVolume3 string `json:"BidVolume3"`
	AskPrice3  string `json:"AskPrice3"`
	AskVolume3 string `json:"AskVolume3"`

	BidPrice4  string `json:"BidPrice4"`
	BidVolume4 string `json:"BidVolume4"`
	AskPrice4  string `json:"AskPrice4"`
	AskVolume4 string `json:"AskVolume4"`

	BidPrice5  string `json:"BidPrice5"`
	BidVolume5 string `json:"BidVolume5"`
	AskPrice5  string `json:"AskPrice5"`
	AskVolume5 string `json:"AskVolume5"`

	AveragePrice string `json:"AveragePrice"`
	ActionDay    string `json:"ActionDay"`
}

func (*QuoteTick) Create

func (*QuoteTick) Decode

func (q *QuoteTick) Decode(buf []byte) error

func (*QuoteTick) Encode

func (q *QuoteTick) Encode() []byte

type YamlCfg

type YamlCfg struct {
	BrokerID    string   `yaml:"BrokerID"`
	InvestorID  string   `yaml:"InvestorID"`
	Password    string   `yaml:"Password"`
	MdFront     string   `yaml:"MdFront"`
	TraderFront string   `yaml:"TraderFront"`
	Ins         []string `yaml:"Ins"`
}

Jump to

Keyboard shortcuts

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