lnx

package
v1.10.17 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Quote

type Quote struct {

	// 帐号
	InvestorID string
	// 经纪商
	BrokerID string
	// contains filtered or unexported fields
}

Quote 行情接口

func NewQuote

func NewQuote() *Quote

NewQuote new md api instanse

func (*Quote) RegOnFrontConnected

func (q *Quote) RegOnFrontConnected(on goctp.OnFrontConnectedType)

RegOnFrontConnected 注册前置响应

func (*Quote) RegOnFrontDisConnected added in v0.1.8

func (q *Quote) RegOnFrontDisConnected(on goctp.OnFrontDisConnectedType)

RegOnFrontDisConnected 注册连接响应

func (*Quote) RegOnRspUserLogin

func (q *Quote) RegOnRspUserLogin(on goctp.OnRspUserLoginType)

RegOnRspUserLogin 注册登录响应

func (*Quote) RegOnTick

func (q *Quote) RegOnTick(on goctp.OnTickType)

RegOnTick 注册行情响应

func (*Quote) Release

func (q *Quote) Release()

Release 接口消毁

func (*Quote) ReqConnect

func (q *Quote) ReqConnect(addr string)

ReqConnect 连接前置;Join阻塞,请用goroutine

func (*Quote) ReqLogin

func (q *Quote) ReqLogin(investor, pwd, broker string)

ReqLogin 登录

func (*Quote) ReqSubscript

func (q *Quote) ReqSubscript(instrument string)

ReqSubscript 订阅行情

type Trade

type Trade struct {
	InvestorID        string   // 帐号
	BrokerID          string   // 经纪商
	TradingDay        string   // 交易日
	Instruments       sync.Map // 合约列表 (key: InstrumentID, value: *goctp.InstrumentField)
	InstrumentStatuss sync.Map // 合约状态 (key: InstrumentID, value: *goctp.InstrumentStatus)

	Positions sync.Map // 合成后的持仓 (key: instrument_long/short value: *ctp.CThostFtdcInvestorPositionField)
	Orders    sync.Map // 委托 (key: sessionID_OrderRef, value: *goctp.OrderField)
	Trades    sync.Map // 成交 (key: TradeID_buy/sell, value: &goctp.TradeField)

	Account *goctp.AccountField // 帐户权益
	IsLogin bool                // 登录成功
	// contains filtered or unexported fields
}

Trade 交易接口

func NewTrade

func NewTrade() *Trade

NewTrade 实例化

func (*Trade) RegOnErrAction

func (t *Trade) RegOnErrAction(on goctp.OnRtnErrActionType)

RegOnErrAction 注册撤单响应

func (*Trade) RegOnErrRtnOrder

func (t *Trade) RegOnErrRtnOrder(on goctp.OnRtnErrOrderType)

RegOnErrRtnOrder 注册委托响应

func (*Trade) RegOnFrontConnected

func (t *Trade) RegOnFrontConnected(on goctp.OnFrontConnectedType)

RegOnFrontConnected 注册连接响应

func (*Trade) RegOnFrontDisConnected added in v0.1.8

func (t *Trade) RegOnFrontDisConnected(on goctp.OnFrontDisConnectedType)

RegOnFrontDisConnected 注册连接响应

func (*Trade) RegOnRspUserLogin

func (t *Trade) RegOnRspUserLogin(on goctp.OnRspUserLoginType)

RegOnRspUserLogin 注册登陆响应

func (*Trade) RegOnRtnCancel

func (t *Trade) RegOnRtnCancel(on goctp.OnRtnOrderType)

RegOnRtnCancel 注册撤单响应

func (*Trade) RegOnRtnFromBankToFuture added in v0.2.4

func (t *Trade) RegOnRtnFromBankToFuture(on goctp.OnRtnFromBankToFutureByFuture)

func (*Trade) RegOnRtnFromFutureToBank added in v0.2.4

func (t *Trade) RegOnRtnFromFutureToBank(on goctp.OnRtnFromFutureToBankByFuture)

func (*Trade) RegOnRtnInstrumentStatus added in v0.1.8

func (t *Trade) RegOnRtnInstrumentStatus(on goctp.OnRtnInstrumentStatusType)

RegOnRtnInstrumentStatus 注册合约状态变化

func (*Trade) RegOnRtnOrder

func (t *Trade) RegOnRtnOrder(on goctp.OnRtnOrderType)

RegOnRtnOrder 注册委托响应

func (*Trade) RegOnRtnTrade

func (t *Trade) RegOnRtnTrade(on goctp.OnRtnTradeType)

RegOnRtnTrade 注册成交响应

func (*Trade) Release

func (t *Trade) Release()

Release 接口销毁处理

func (*Trade) ReqBankToFuture added in v0.2.4

func (t *Trade) ReqBankToFuture(bankID, bankAccount, bankPwd string, amount float64)

ReqBankToFuture 银行转期货

func (*Trade) ReqConnect

func (t *Trade) ReqConnect(addr string)

ReqConnect 连接;Join阻塞,用goroutine

func (*Trade) ReqFutureToBank added in v0.2.4

func (t *Trade) ReqFutureToBank(bankID, bankAccount string, amount float64)

ReqFutureToBank 期货转银行

func (*Trade) ReqLogin

func (t *Trade) ReqLogin(investor, pwd, broker, appID, authCode string)

ReqLogin 登录

func (*Trade) ReqOrderAction

func (t *Trade) ReqOrderAction(orderID string) int

ReqOrderAction 撤单

func (*Trade) ReqOrderInsert

func (t *Trade) ReqOrderInsert(instrument string, buySell goctp.DirectionType, openClose goctp.OffsetFlagType, price float64, volume int) string

ReqOrderInsert 限价委托

func (*Trade) ReqOrderInsertFAK

func (t *Trade) ReqOrderInsertFAK(instrument string, buySell goctp.DirectionType, openClose goctp.OffsetFlagType, price float64, volume int) string

ReqOrderInsertFAK FAK委托[全成or撤单]

func (*Trade) ReqOrderInsertFOK

func (t *Trade) ReqOrderInsertFOK(instrument string, buySell goctp.DirectionType, openClose goctp.OffsetFlagType, price float64, volume int) string

ReqOrderInsertFOK FOK委托[部成撤单]

func (*Trade) ReqOrderInsertMarket

func (t *Trade) ReqOrderInsertMarket(instrument string, buySell goctp.DirectionType, openClose goctp.OffsetFlagType, volume int) string

ReqOrderInsertMarket 市价委托

Jump to

Keyboard shortcuts

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