Skip to content

hx8563/ctp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ctp

ctp ineterface of golang (for linux64) http://www.citicsf.com/download/ctp/

Preparing

install go
install swig

Building

export GOROOT=<your go root path>
cd ./src
./make.sh

Tutorial

package main

import (
	"ctp"
	"fmt"
)

var (
	front string = "tcp://asp-sim2-front1.financial-trading-platform.com:26205"
	api   ctp.CThostFtdcTraderApi
)

type TradeApi struct {
	ctp.ThostFtdcTraderSpiImplBase
}

//callback from c++ libararys
func (g *TradeApi) OnFrontConnected() {
	fmt.Printf("connected\n")
}

func main() {
	api = ctp.CThostFtdcTraderApiCreateFtdcTraderApi()
	api.RegisterSpi(ctp.GTrader(&TradeApi{}))
	api.RegisterFront(front)
	api.Init()
	api.Join()
}

More

i need a public account to test...
and i don't know how to trade...

About

ctp ineterface of golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.2%
  • Other 0.8%