demo

command
v0.0.0-...-7f3418b Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: MIT Imports: 12 Imported by: 0

README

goctp

上海期货交易所 ctp 接口 Golang版 (for linux64)

修改配置

修改 ctp.go 文件 107 行的 SetTradeAccount 函数,写上对应的环境账号即可

订阅行情

Subscribe := []string{"rb2105"}
MdSpi.SubscribeMarketData(Subscribe)

开仓示例

var Input InputOrderStruct

Input.InstrumentID = "rb2105"
Input.Direction    = OrderBuy
Input.Price        = 3600
Input.Volume       = 1

TraderSpi.OrderOpen(Input)

平仓示例

var Input InputOrderStruct

Input.InstrumentID = "rb2105"
Input.Direction    = OrderBuy
Input.Price        = 3600
Input.Volume       = 1

TraderSpi.OrderClose(Input)

撤单示例

TraderSpi.OrderCancel("rb2105", "报单编号")

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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