Documentation
¶
Index ¶
- func Bytes2String(t []byte) string
- func CheckErr(err error)
- func Contain(obj interface{}, target interface{}) (bool, error)
- func TemplateMap(templateString string, mapContent map[string]string) string
- type AccountField
- type CombinationTypeType
- type DirectionType
- type GetVersionType
- type HFQuote
- func (q *HFQuote) FrontConnected()
- func (q *HFQuote) FrontDisConnected(reason int)
- func (q *HFQuote) Init()
- func (q *HFQuote) RegOnFrontConnected(on OnFrontConnectedType)
- func (q *HFQuote) RegOnFrontDisConnected(on OnFrontDisConnectedType)
- func (q *HFQuote) RegOnRspUserLogin(on OnRspUserLoginType)
- func (q *HFQuote) RegOnTick(on OnTickType)
- func (q *HFQuote) ReqLogin(investor, pwd, broker string)
- func (q *HFQuote) RspUserLogin(loginField *ctpdefine.CThostFtdcRspUserLoginField, ...)
- func (q *HFQuote) RtnDepthMarketData(dataField *ctpdefine.CThostFtdcDepthMarketDataField)
- type HFTrade
- func (t *HFTrade) ErrRtnOrderAction(field *ctp.CThostFtdcOrderActionField, info *ctp.CThostFtdcRspInfoField)
- func (t *HFTrade) ErrRtnOrderInsert(field *ctp.CThostFtdcInputOrderField, info *ctp.CThostFtdcRspInfoField)
- func (t *HFTrade) FrontConnected()
- func (t *HFTrade) FrontDisConnected(reason int)
- func (t *HFTrade) Init()
- func (t *HFTrade) RegOnErrAction(on OnRtnErrActionType)
- func (t *HFTrade) RegOnErrRtnOrder(on OnRtnErrOrderType)
- func (t *HFTrade) RegOnFrontConnected(on OnFrontConnectedType)
- func (t *HFTrade) RegOnFrontDisConnected(on OnFrontDisConnectedType)
- func (t *HFTrade) RegOnRspUserLogin(on OnRspUserLoginType)
- func (t *HFTrade) RegOnRtnCancel(on OnRtnOrderType)
- func (t *HFTrade) RegOnRtnFromBankToFuture(on OnRtnFromBankToFutureByFuture)
- func (t *HFTrade) RegOnRtnFromFutureToBank(on OnRtnFromFutureToBankByFuture)
- func (t *HFTrade) RegOnRtnInstrumentStatus(on OnRtnInstrumentStatusType)
- func (t *HFTrade) RegOnRtnOrder(on OnRtnOrderType)
- func (t *HFTrade) RegOnRtnTrade(on OnRtnTradeType)
- func (t *HFTrade) Release()
- func (t *HFTrade) ReqBankToFuture(bankID, bankAccount, bankPwd string, amount float64)
- func (t *HFTrade) ReqFutureToBank(bankID, bankAccount string, amount float64)
- func (t *HFTrade) ReqLogin(investor, pwd, broker, appID, authCode string)
- func (t *HFTrade) ReqOrderAction(orderID string) int
- func (t *HFTrade) ReqOrderInsert(instrument string, buySell DirectionType, openClose OffsetFlagType, ...) string
- func (t *HFTrade) ReqOrderInsertFAK(instrument string, buySell DirectionType, openClose OffsetFlagType, ...) string
- func (t *HFTrade) ReqOrderInsertFOK(instrument string, buySell DirectionType, openClose OffsetFlagType, ...) string
- func (t *HFTrade) ReqOrderInsertMarket(instrument string, buySell DirectionType, openClose OffsetFlagType, volume int) string
- func (t *HFTrade) RspAuthenticate(info *ctp.CThostFtdcRspInfoField)
- func (t *HFTrade) RspQryInstrument(field *ctp.CThostFtdcInstrumentField, b bool)
- func (t *HFTrade) RspQryInvestorPosition(field *ctp.CThostFtdcInvestorPositionField, b bool)
- func (t *HFTrade) RspQryTradingAccount(field *ctp.CThostFtdcTradingAccountField)
- func (t *HFTrade) RspSettlementInfoConfirm()
- func (t *HFTrade) RspUserLogin(loginField *ctp.CThostFtdcRspUserLoginField, ...)
- func (t *HFTrade) RtnFromBankToFutureByFuture(field *ctp.CThostFtdcRspTransferField)
- func (t *HFTrade) RtnFromFutureToBankByFuture(field *ctp.CThostFtdcRspTransferField)
- func (t *HFTrade) RtnInstrumentStatus(field *ctp.CThostFtdcInstrumentStatusField)
- func (t *HFTrade) RtnOrder(field *ctp.CThostFtdcOrderField)
- func (t *HFTrade) RtnTrade(field *ctp.CThostFtdcTradeField)
- type HedgeFlagType
- type InstrumentField
- type InstrumentStatus
- type InstrumentStatusType
- type OffsetFlagType
- type OnFrontConnectedType
- type OnFrontDisConnectedType
- type OnRspUserLoginType
- type OnRtnErrActionType
- type OnRtnErrOrderType
- type OnRtnFromBankToFutureByFuture
- type OnRtnFromFutureToBankByFuture
- type OnRtnInstrumentStatusType
- type OnRtnOrderType
- type OnRtnTradeType
- type OnTickType
- type OptionsTypeType
- type OrderField
- type OrderStatusType
- type PosiDirectionType
- type PositionField
- type PositionTypeType
- type ProductClassType
- type ReleaseAPIType
- type ReqAuthenticateType
- type ReqConnectType
- type ReqOrderActionType
- type ReqOrderInsertType
- type ReqQryClassifiedInstrumentType
- type ReqQryInstrumentType
- type ReqQryInvestorPositionType
- type ReqQryTradingAccountType
- type ReqSettlementInfoConfirmType
- type ReqSubscriptType
- type ReqTransferType
- type ReqUserLoginType
- type RspInfoField
- type RspUserLoginField
- type TickField
- type TradeField
- type TransferField
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes2String ¶
Types ¶
type AccountField ¶
type AccountField struct { // 上次质押金额 PreMortgage float64 // 上次存款额 PreDeposit float64 // 上次结算准备金 PreBalance float64 // 上次占用的保证金 PreMargin float64 // 利息基数 InterestBase float64 // 利息收入 Interest float64 // 入金金额 Deposit float64 // 出金金额 Withdraw float64 // 冻结的保证金 FrozenMargin float64 // 冻结的资金 FrozenCash float64 // 冻结的手续费 FrozenCommission float64 // 当前保证金总额 CurrMargin float64 // 资金差额 CashIn float64 // 手续费 Commission float64 // 平仓盈亏 CloseProfit float64 // 持仓盈亏 PositionProfit float64 // 期货结算准备金 Balance float64 // 可用资金 Available float64 // 可取资金 WithdrawQuota float64 // 基本准备金 Reserve float64 // 信用额度 Credit float64 // 质押金额 Mortgage float64 // 交易所保证金 ExchangeMargin float64 // 投资者交割保证金 DeliveryMargin float64 // 交易所交割保证金 ExchangeDeliveryMargin float64 // 保底期货结算准备金 ReserveBalance float64 // 币种代码 CurrencyID string // 上次货币质入金额 PreFundMortgageIn float64 // 上次货币质出金额 PreFundMortgageOut float64 // 货币质入金额 FundMortgageIn float64 // 货币质出金额 FundMortgageOut float64 // 货币质押余额 FundMortgageAvailable float64 // 可质押货币金额 MortgageableFund float64 }
资金账户
type CombinationTypeType ¶
type CombinationTypeType byte
组合类型
const ( // 期货组合 CombinationTypeFuture CombinationTypeType = '0' // 垂直价差BUL CombinationTypeBUL CombinationTypeType = '1' // 垂直价差BER CombinationTypeBER CombinationTypeType = '2' // 跨式组合 CombinationTypeSTD CombinationTypeType = '3' // 宽跨式组合 CombinationTypeSTG CombinationTypeType = '4' // 备兑组合 CombinationTypePRT CombinationTypeType = '5' // 时间价差组合 CombinationTypeCLD CombinationTypeType = '6' )
type DirectionType ¶
type DirectionType byte
买卖方向类型
const ( // 买 DirectionBuy DirectionType = '0' // 卖 DirectionSell DirectionType = '1' )
type GetVersionType ¶
type GetVersionType func() string
type HFQuote ¶
type HFQuote struct { InvestorID string BrokerID string ReqConnect ReqConnectType Release ReleaseAPIType ReqUserLogin ReqUserLoginType ReqSubscript ReqSubscriptType // contains filtered or unexported fields }
HFQuote 行情接口
func (*HFQuote) FrontConnected ¶
func (q *HFQuote) FrontConnected()
func (*HFQuote) FrontDisConnected ¶
func (*HFQuote) RegOnFrontConnected ¶
func (q *HFQuote) RegOnFrontConnected(on OnFrontConnectedType)
RegOnFrontConnected 注册前置响应
func (*HFQuote) RegOnFrontDisConnected ¶
func (q *HFQuote) RegOnFrontDisConnected(on OnFrontDisConnectedType)
RegOnFrontDisConnected 注册连接响应
func (*HFQuote) RegOnRspUserLogin ¶
func (q *HFQuote) RegOnRspUserLogin(on OnRspUserLoginType)
RegOnRspUserLogin 注册登录响应
func (*HFQuote) RspUserLogin ¶
func (q *HFQuote) RspUserLogin(loginField *ctpdefine.CThostFtdcRspUserLoginField, infoField *ctpdefine.CThostFtdcRspInfoField)
func (*HFQuote) RtnDepthMarketData ¶
func (q *HFQuote) RtnDepthMarketData(dataField *ctpdefine.CThostFtdcDepthMarketDataField)
type HFTrade ¶
type HFTrade struct { InvestorID string // 帐号 BrokerID string // 经纪商 TradingDay string // 交易日 SessionID int // 判断是否自己的委托用 Instruments sync.Map // 合约列表 (key: InstrumentID, value: *InstrumentField) InstrumentStatuss sync.Map // 合约状态 (key: InstrumentID, value: *InstrumentStatus) Positions sync.Map // 合成后的持仓 (key: instrument_long/short value: *ctp.CThostFtdcInvestorPositionField) Orders sync.Map // 委托 (key: sessionID_OrderRef, value: *OrderField) Trades sync.Map // 成交 (key: TradeID_buy/sell, value: &TradeField) Account *AccountField // 帐户权益 IsLogin bool // 登录成功 Version string // 版本号,如 v6.5.1_20200908 10:25:08 // 继承类要实现的函数 ReqConnect ReqConnectType ReleaseAPI ReleaseAPIType ReqUserLogin ReqUserLoginType ReqAuthenticate ReqAuthenticateType ReqSettlementInfoConfirm ReqSettlementInfoConfirmType ReqQryInstrument ReqQryInstrumentType ReqQryClassifiedInstrument ReqQryClassifiedInstrumentType ReqQryTradingAccount ReqQryTradingAccountType ReqQryInvestorPosition ReqQryInvestorPositionType ReqOrder ReqOrderInsertType ReqAction ReqOrderActionType ReqFromBankToFutureByFuture ReqTransferType ReqFromFutureToBankByFuture ReqTransferType GetVersion GetVersionType // contains filtered or unexported fields }
HFTrade 交易接口
func (*HFTrade) ErrRtnOrderAction ¶
func (t *HFTrade) ErrRtnOrderAction(field *ctp.CThostFtdcOrderActionField, info *ctp.CThostFtdcRspInfoField)
ErrRtnOrderAction 撤单错误
func (*HFTrade) ErrRtnOrderInsert ¶
func (t *HFTrade) ErrRtnOrderInsert(field *ctp.CThostFtdcInputOrderField, info *ctp.CThostFtdcRspInfoField)
ErrRtnOrderInsert 委托错误
func (*HFTrade) FrontDisConnected ¶
FrontDisConnected 断开响应
func (*HFTrade) RegOnErrAction ¶
func (t *HFTrade) RegOnErrAction(on OnRtnErrActionType)
RegOnErrAction 注册撤单响应
func (*HFTrade) RegOnErrRtnOrder ¶
func (t *HFTrade) RegOnErrRtnOrder(on OnRtnErrOrderType)
RegOnErrRtnOrder 注册委托响应
func (*HFTrade) RegOnFrontConnected ¶
func (t *HFTrade) RegOnFrontConnected(on OnFrontConnectedType)
RegOnFrontConnected 注册连接响应
func (*HFTrade) RegOnFrontDisConnected ¶
func (t *HFTrade) RegOnFrontDisConnected(on OnFrontDisConnectedType)
RegOnFrontDisConnected 注册连接响应
func (*HFTrade) RegOnRspUserLogin ¶
func (t *HFTrade) RegOnRspUserLogin(on OnRspUserLoginType)
RegOnRspUserLogin 注册登陆响应
func (*HFTrade) RegOnRtnCancel ¶
func (t *HFTrade) RegOnRtnCancel(on OnRtnOrderType)
RegOnRtnCancel 注册撤单响应
func (*HFTrade) RegOnRtnFromBankToFuture ¶
func (t *HFTrade) RegOnRtnFromBankToFuture(on OnRtnFromBankToFutureByFuture)
RegOnRtnFromBankToFuture 注册银行转期货
func (*HFTrade) RegOnRtnFromFutureToBank ¶
func (t *HFTrade) RegOnRtnFromFutureToBank(on OnRtnFromFutureToBankByFuture)
RegOnRtnFromFutureToBank 注册期货转银行
func (*HFTrade) RegOnRtnInstrumentStatus ¶
func (t *HFTrade) RegOnRtnInstrumentStatus(on OnRtnInstrumentStatusType)
RegOnRtnInstrumentStatus 注册合约状态变化
func (*HFTrade) RegOnRtnOrder ¶
func (t *HFTrade) RegOnRtnOrder(on OnRtnOrderType)
RegOnRtnOrder 注册委托响应
func (*HFTrade) RegOnRtnTrade ¶
func (t *HFTrade) RegOnRtnTrade(on OnRtnTradeType)
RegOnRtnTrade 注册成交响应
func (*HFTrade) ReqBankToFuture ¶
ReqBankToFuture 银行转期货
func (*HFTrade) ReqFutureToBank ¶
ReqFutureToBank 期货转银行
func (*HFTrade) ReqOrderAction ¶
ReqOrderAction 撤单
func (*HFTrade) ReqOrderInsert ¶
func (t *HFTrade) ReqOrderInsert(instrument string, buySell DirectionType, openClose OffsetFlagType, price float64, volume int) string
ReqOrderInsert 限价委托
func (*HFTrade) ReqOrderInsertFAK ¶
func (t *HFTrade) ReqOrderInsertFAK(instrument string, buySell DirectionType, openClose OffsetFlagType, price float64, volume int) string
ReqOrderInsertFAK FAK委托[全成or撤单]
func (*HFTrade) ReqOrderInsertFOK ¶
func (t *HFTrade) ReqOrderInsertFOK(instrument string, buySell DirectionType, openClose OffsetFlagType, price float64, volume int) string
ReqOrderInsertFOK FOK委托[部成撤单]
func (*HFTrade) ReqOrderInsertMarket ¶
func (t *HFTrade) ReqOrderInsertMarket(instrument string, buySell DirectionType, openClose OffsetFlagType, volume int) string
ReqOrderInsertMarket 市价委托
func (*HFTrade) RspAuthenticate ¶
func (t *HFTrade) RspAuthenticate(info *ctp.CThostFtdcRspInfoField)
RspAuthenticate 认证
func (*HFTrade) RspQryInstrument ¶
func (t *HFTrade) RspQryInstrument(field *ctp.CThostFtdcInstrumentField, b bool)
RspQryInstrument 合约
func (*HFTrade) RspQryInvestorPosition ¶
func (t *HFTrade) RspQryInvestorPosition(field *ctp.CThostFtdcInvestorPositionField, b bool)
RspQryInvestorPosition 持仓
func (*HFTrade) RspQryTradingAccount ¶
func (t *HFTrade) RspQryTradingAccount(field *ctp.CThostFtdcTradingAccountField)
RspQryTradingAccount 权益
func (*HFTrade) RspSettlementInfoConfirm ¶
func (t *HFTrade) RspSettlementInfoConfirm()
RspSettlementInfoConfirm 确认结算
func (*HFTrade) RspUserLogin ¶
func (t *HFTrade) RspUserLogin(loginField *ctp.CThostFtdcRspUserLoginField, infoField *ctp.CThostFtdcRspInfoField)
RspUserLogin 登录
func (*HFTrade) RtnFromBankToFutureByFuture ¶
func (t *HFTrade) RtnFromBankToFutureByFuture(field *ctp.CThostFtdcRspTransferField)
RtnFromBankToFutureByFuture 银行转期货-期货端
func (*HFTrade) RtnFromFutureToBankByFuture ¶
func (t *HFTrade) RtnFromFutureToBankByFuture(field *ctp.CThostFtdcRspTransferField)
RtnFromFutureToBankByFuture // 期货转银行-期货端
func (*HFTrade) RtnInstrumentStatus ¶
func (t *HFTrade) RtnInstrumentStatus(field *ctp.CThostFtdcInstrumentStatusField)
RtnInstrumentStatus 合约/品种/交易所 状态响应
func (*HFTrade) RtnOrder ¶
func (t *HFTrade) RtnOrder(field *ctp.CThostFtdcOrderField)
RtnOrder 委托响应
func (*HFTrade) RtnTrade ¶
func (t *HFTrade) RtnTrade(field *ctp.CThostFtdcTradeField)
RtnTrade 成交响应
type HedgeFlagType ¶
type HedgeFlagType byte
投机套保标志类型
const ( // 投机 HedgeFlagSpeculation HedgeFlagType = '1' // 套利 HedgeFlagArbitrage HedgeFlagType = '2' // 套保 HedgeFlagHedge HedgeFlagType = '3' // 做市商 HedgeFlagMarketMaker HedgeFlagType = '5' // 第一腿投机第二腿套保 大商所专用 HedgeFlagSpecHedge HedgeFlagType = '6' // 第一腿套保第二腿投机 大商所专用 HedgeFlagHedgeSpec HedgeFlagType = '7' )
type InstrumentField ¶
type InstrumentField struct { // 合约代码 InstrumentID string // 交易所代码 ExchangeID string // 产品代码 ProductID string // 产品类型 ProductClass ProductClassType // 市价单最大下单量 MaxMarketOrderVolume int // 市价单最小下单量 MinMarketOrderVolume int // 限价单最大下单量 MaxLimitOrderVolume int // 限价单最小下单量 MinLimitOrderVolume int // 合约数量乘数 VolumeMultiple int // 最小变动价位 PriceTick float64 // 持仓类型 PositionType PositionTypeType // 是否使用大额单边保证金算法 UseMaxMarginSideAlgorithm bool // 基础商品代码 UnderlyingInstrID string // 执行价 StrikePrice float64 // 期权类型 OptionsType OptionsTypeType // 合约基础商品乘数 UnderlyingMultiple float64 // 组合类型 CombinationType CombinationTypeType }
合约
type InstrumentStatus ¶ added in v0.0.6
type InstrumentStatus struct { // 交易所代码 ExchangeID string // 合约代码 InstrumentID string // 合约交易状态 InstrumentStatus InstrumentStatusType // 进入本状态时间 EnterTime string }
InstrumentStatus 合约状态
type InstrumentStatusType ¶
type InstrumentStatusType byte
合约交易状态类型
const ( // 开盘前 InstrumentStatusBeforeTrading InstrumentStatusType = '0' // 非交易 InstrumentStatusNoTrading InstrumentStatusType = '1' // 连续交易 InstrumentStatusContinous InstrumentStatusType = '2' // 集合竞价报单 InstrumentStatusAuctionOrdering InstrumentStatusType = '3' // 集合竞价价格平衡 InstrumentStatusAuctionBalance InstrumentStatusType = '4' // 集合竞价撮合 InstrumentStatusAuctionMatch InstrumentStatusType = '5' // 收盘 InstrumentStatusClosed InstrumentStatusType = '6' )
type OffsetFlagType ¶
type OffsetFlagType byte
开平标志类型
const ( // 开仓 OffsetFlagOpen OffsetFlagType = '0' // 平仓 OffsetFlagClose OffsetFlagType = '1' // 强平 OffsetFlagForceClose OffsetFlagType = '2' // 平今 OffsetFlagCloseToday OffsetFlagType = '3' // 平昨 OffsetFlagCloseYesterday OffsetFlagType = '4' // 强减 OffsetFlagForceOff OffsetFlagType = '5' // 本地强平 OffsetFlagLocalForceClose OffsetFlagType = '6' )
type OnRspUserLoginType ¶
type OnRspUserLoginType func(loginField *RspUserLoginField, info *RspInfoField)
公共-登录
type OnRtnFromBankToFutureByFuture ¶
type OnRtnFromBankToFutureByFuture func(field *TransferField)
银转-银行->期货
type OnRtnFromFutureToBankByFuture ¶
type OnRtnFromFutureToBankByFuture func(field *TransferField)
银转-期货->银行
type OnRtnInstrumentStatusType ¶ added in v0.0.6
type OnRtnInstrumentStatusType func(field *InstrumentStatus)
交易-合约状态响应
type OptionsTypeType ¶
type OptionsTypeType byte
期权类型
const ( // 看涨 OptionsTypeCallOptions OptionsTypeType = '1' // 看跌 OptionsTypePutOptions OptionsTypeType = '2' )
type OrderField ¶
type OrderField struct { // 合约代码 InstrumentID string // 报单引用 OrderRef string // 买卖方向 Direction DirectionType // 组合开平标志 OffsetFlag OffsetFlagType // 组合投机套保标志 HedgeFlag HedgeFlagType // 价格 LimitPrice float64 // 数量 VolumeTotalOriginal int // 交易所代码 ExchangeID string // 报单编号 OrderSysID string // 报单状态 OrderStatus OrderStatusType // 今成交数量 VolumeTraded int // 剩余数量 VolumeLeft int // 报单日期 InsertDate string // 委托时间 InsertTime string // 撤销时间 CancelTime string // 前置编号 FrontID int // 会话编号 SessionID int // 状态信息 StatusMsg string // 是否本次登录后的委托 IsLocal bool // 成交时间(有OnTrade更新) LastTradeTime string // 成交均价 TradePrice float64 }
报单
type OrderStatusType ¶
type OrderStatusType byte
报单状态类型
const ( // 全部成交 OrderStatusAllTraded OrderStatusType = '0' // 部分成交还在队列中 OrderStatusPartTradedQueueing OrderStatusType = '1' // 部分成交不在队列中 OrderStatusPartTradedNotQueueing OrderStatusType = '2' // 未成交还在队列中 OrderStatusNoTradeQueueing OrderStatusType = '3' // 未成交不在队列中 OrderStatusNoTradeNotQueueing OrderStatusType = '4' // 撤单 OrderStatusCanceled OrderStatusType = '5' // 未知 OrderStatusUnknown OrderStatusType = 'a' // 尚未触发 OrderStatusNotTouched OrderStatusType = 'b' // 已触发 OrderStatusTouched OrderStatusType = 'c' )
type PosiDirectionType ¶
type PosiDirectionType byte
持仓多空方向类型
const ( // 净 PosiDirectionNet PosiDirectionType = '1' // 多头 PosiDirectionLong PosiDirectionType = '2' // 空头 PosiDirectionShort PosiDirectionType = '3' )
type PositionField ¶
type PositionField struct { // 合约代码 InstrumentID string // 持仓多空方向 PositionDirection PosiDirectionType // 投机套保标志 HedgeFlag HedgeFlagType // 上日持仓 YdPosition int // 今日持仓 Position int // 多头冻结 LongFrozen int // 空头冻结 ShortFrozen int // 开仓冻结金额 LongFrozenAmount float64 // 开仓冻结金额 ShortFrozenAmount float64 // 开仓量 OpenVolume int // 平仓量 CloseVolume int // 开仓金额 OpenAmount float64 // 平仓金额 CloseAmount float64 // 持仓成本 PositionCost float64 // 上次占用的保证金 PreMargin float64 // 占用的保证金 UseMargin float64 // 冻结的保证金 FrozenMargin float64 // 冻结的资金 FrozenCash float64 // 冻结的手续费 FrozenCommission float64 // 资金差额 CashIn float64 // 手续费 Commission float64 // 平仓盈亏 CloseProfit float64 // 持仓盈亏 PositionProfit float64 // 上次结算价 PreSettlementPrice float64 // 本次结算价 SettlementPrice float64 // 开仓成本 OpenCost float64 // 交易所保证金 ExchangeMargin float64 // 组合成交形成的持仓 CombPosition int // 组合多头冻结 CombLongFrozen int // 组合空头冻结 CombShortFrozen int // 逐日盯市平仓盈亏 CloseProfitByDate float64 // 逐笔对冲平仓盈亏 CloseProfitByTrade float64 // 今日持仓 TodayPosition int // 执行冻结 StrikeFrozen int // 执行冻结金额 StrikeFrozenAmount float64 // 放弃执行冻结 AbandonFrozen int // 交易所代码 ExchangeID string // 执行冻结的昨仓 YdStrikeFrozen int // 大商所持仓成本差值,只有大商所使用 PositionCostOffset float64 }
投资者持仓
type PositionTypeType ¶
type PositionTypeType byte
持仓类型类型
const ( // 净持仓 PositionTypeNet PositionTypeType = '1' // 综合持仓 PositionTypeGross PositionTypeType = '2' )
type ProductClassType ¶
type ProductClassType byte
产品类型类型
const ( // 期货 ProductClassFutures ProductClassType = '1' // 期货期权 ProductClassOptions ProductClassType = '2' // 组合 ProductClassCombinationProductClassType = '3' // 即期 ProductClassSpot ProductClassType = '4' // 期转现 ProductClassEFP ProductClassType = '5' // 现货期权 ProductClassSpotOption ProductClassType = '6' )
type ReleaseAPIType ¶
type ReleaseAPIType func()
type ReqAuthenticateType ¶
type ReqAuthenticateType func(*ctp.CThostFtdcReqAuthenticateField, int)
type ReqConnectType ¶
type ReqConnectType = func(string)
type ReqOrderActionType ¶
type ReqOrderActionType = func(*ctp.CThostFtdcInputOrderActionField, int)
type ReqOrderInsertType ¶
type ReqOrderInsertType func(*ctp.CThostFtdcInputOrderField, int)
type ReqQryClassifiedInstrumentType ¶
type ReqQryClassifiedInstrumentType func(*ctp.CThostFtdcQryClassifiedInstrumentField, int)
type ReqQryInstrumentType ¶
type ReqQryInstrumentType func(*ctp.CThostFtdcQryInstrumentField, int)
type ReqQryInvestorPositionType ¶
type ReqQryInvestorPositionType func(*ctp.CThostFtdcQryInvestorPositionField, int)
type ReqQryTradingAccountType ¶
type ReqQryTradingAccountType func(*ctp.CThostFtdcQryTradingAccountField, int)
type ReqSettlementInfoConfirmType ¶
type ReqSettlementInfoConfirmType func(*ctp.CThostFtdcSettlementInfoConfirmField, int)
type ReqSubscriptType ¶
type ReqSubscriptType func(string)
type ReqTransferType ¶
type ReqTransferType = func(*ctp.CThostFtdcReqTransferField, int)
type ReqUserLoginType ¶
type ReqUserLoginType func(*ctp.CThostFtdcReqUserLoginField, int)
type RspUserLoginField ¶
type RspUserLoginField struct { // 交易日 TradingDay string // 登录成功时间 LoginTime string // 经纪公司代码 BrokerID string // 用户代码 UserID string // 交易系统名称 //SystemName string // 前置编号 FrontID int // 会话编号 SessionID int // 最大报单引用 MaxOrderRef string }
用户登录应答
type TickField ¶
type TickField struct { // 交易日 TradingDay string // 合约代码 InstrumentID string // 交易所代码 ExchangeID string // 合约在交易所的代码 //ExchangeInstID string // 最新价 LastPrice float64 // 上次结算价 //PreSettlementPrice float64 // 昨收盘 //PreClosePrice float64 // 昨持仓量 //PreOpenInterest float64 // 今开盘 OpenPrice float64 // 最高价 HighestPrice float64 // 最低价 LowestPrice float64 // 数量 Volume int // 成交金额 Turnover float64 // 持仓量 OpenInterest float64 // 今收盘 ClosePrice float64 // 本次结算价 SettlementPrice float64 // 涨停板价 UpperLimitPrice float64 // 跌停板价 LowerLimitPrice float64 // 昨虚实度 //PreDelta float64 // 今虚实度 CurrDelta float64 // 最后修改时间 UpdateTime string // 最后修改毫秒 UpdateMillisec int // 申买价一 BidPrice1 float64 // 申买量一 BidVolume1 int // 申卖价一 AskPrice1 float64 // 申卖量一 AskVolume1 int // 申买价二 BidPrice2 float64 // 申买量二 BidVolume2 int // 申卖价二 AskPrice2 float64 // 申卖量二 AskVolume2 int // 申买价三 BidPrice3 float64 // 申买量三 BidVolume3 int // 申卖价三 AskPrice3 float64 // 申卖量三 AskVolume3 int // 申买价四 BidPrice4 float64 // 申买量四 BidVolume4 int // 申卖价四 AskPrice4 float64 // 申卖量四 AskVolume4 int // 申买价五 BidPrice5 float64 // 申买量五 BidVolume5 int // 申卖价五 AskPrice5 float64 // 申卖量五 AskVolume5 int // 当日均价 AveragePrice float64 // 业务日期 ActionDay string }
行情响应
type TradeField ¶
type TradeField struct { // 合约代码 InstrumentID string // 交易所代码 ExchangeID string // 成交编号 TradeID string // 买卖方向 Direction DirectionType // 报单编号 OrderSysID string // 开平标志 OffsetFlag OffsetFlagType // 投机套保标志 HedgeFlag HedgeFlagType // 价格 Price float64 // 数量 Volume int // 成交时期 TradeDate string // 成交时间 TradeTime string // 交易日 TradingDay string }
成交