Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

gaxxx/ctp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 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