fixlib

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

README

golang-fix-api

Golang FIX API library for XNT Ltd

Building and installation

To install golang-fix-api library, use go get:

$ go get github.com/xntltd/golang-fix-api
Staying up to date

To update to the latest version, use

$ go get -u github.com/xntltd/golang-fix-api
Developing golang-fix-api

If you wish to work on golang-fix-api itself, you will first need Go installed and configured on your machine (version 1.14+ is preferred, but the minimum required version is 1.8).

Next, using Git, clone the repository via git clone command

git clone https://github.com/xntltd/golang-fix-api.git

Basic usage

func main() {
	f, _ := NewFixAPI("cfg/session.conf", 100)
	if err := f.Run(); err != nil {
		panic("Cant start initiator")
	}
	err := f.SecurityList("WWB1220_TRADE_UAT", "EXANTE_TRADE_UAT")
	print(err)
	for {
		print(<- f.RespChan)
	}
}
License

Released under the GNU GPL License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModifyMsg

func ModifyMsg(msg *quickfix.Message)

ModifyMsg ...

Types

type Config added in v0.0.4

type Config struct {
	BeginString          string `env:"FIX_BEGIN_STRING"`
	SenderCompID         string `env:"FIX_SENDER_COMP_ID"`
	TargetCompID         string `env:"FIX_TARGET_COMP_ID"`
	ConnectionType       string `env:"FIX_CONNECTION_TYPE"`
	StartTime            string `env:"FIX_START_TIME"`
	EndTime              string `env:"FIX_END_TIME"`
	HeartbeatInterval    int    `env:"FIX_HEARTBEAT_INTERVAL"`
	SocketConnectPort    int    `env:"FIX_SOCKET_CONNECT_PORT"`
	SocketConnectHost    string `env:"FIX_SOCKET_CONNECT_HOST"`
	ReconnectInterval    int    `env:"FIX_RECONNECT_INTERVAL"`
	StoreFactoryMongoURI string `env:"FIX_STORE_FACTORY_MONGO_URI"`
}

Config structure for environment variables

type FixAPI

type FixAPI struct {
	RespChan chan string
	// contains filtered or unexported fields
}

FixAPI struct provide communication with xnt services

func NewFixAPI

func NewFixAPI(respChanMaxSize int) (FixAPI, error)

func (FixAPI) AccountSummary

func (f FixAPI) AccountSummary(senderCompID, targetCompID string) error

AccountSummary request FIX44

func (FixAPI) CancelOrder

func (f FixAPI) CancelOrder(cloID, symbol, orderQty string, side enum.Side) error

CancelOrder request FIX44

func (FixAPI) MarketData

func (f FixAPI) MarketData(marketDepth int, symbol, sendercompID, targetCompID string) error

MarketData ...

func (FixAPI) NewOrder

func (f FixAPI) NewOrder(symbol, orderQty, account, price, stopPx,
	sendercompID, targetCompID string, ordType enum.OrdType) error

NewOrder request FIX44

func (FixAPI) OrderMassStatus

func (f FixAPI) OrderMassStatus(sendercompID, targetCompID string,
	reqType enum.MassStatusReqType) error

OrderMassStatus request FIX44

func (FixAPI) OrderStatus

func (f FixAPI) OrderStatus(senderCompID, targetCompID, symbol string) error

OrderStatus request FIX44

func (FixAPI) ReplaceOrder

func (f FixAPI) ReplaceOrder(origClo, cloID string,
	side enum.Side, ordType enum.OrdType) error

ReplaceOrder request FIX44

func (FixAPI) Run

func (f FixAPI) Run() (err error)

Run FixAPI initiator

func (FixAPI) SecurityList

func (f FixAPI) SecurityList(sendercompID, targetCompID string) error

SecurityList request FIX44

func (FixAPI) SecurityListCFI

func (f FixAPI) SecurityListCFI(cfi, sendercompID, targetCompID string,
	secList enum.SecurityListRequestType) error

SecurityListCFI request FIX44

func (FixAPI) SecurityListSymbol

func (f FixAPI) SecurityListSymbol(sym, sendercompID, targetCompID string) error

SecurityListSymbol request FIX44

func (FixAPI) Stop

func (f FixAPI) Stop()

Stop FixAPI initiator

func (FixAPI) TestRequest

func (f FixAPI) TestRequest(requestID string) error

TestRequest ...

func (FixAPI) TradesCapture

func (f FixAPI) TradesCapture(sendercompID, targetCompID string,
	startTime, stopTime time.Time) error

TradesCapture request 44

func (FixAPI) TradesCaptureStopDate

func (f FixAPI) TradesCaptureStopDate(
	targetCompID, sendercompID, stopDate string) error

TradesCaptureStopDate request 44

func (FixAPI) TradesMargin

func (f FixAPI) TradesMargin(symbol, account, currency, sendercompID,
	targetCompID string,
	quantity, price decimal.Decimal) error

TradesMargin ...

type TradeClient

type TradeClient struct {
	// contains filtered or unexported fields
}

TradeClient implements the quickfix.Application interface

func (TradeClient) FromAdmin

func (t TradeClient) FromAdmin(
	msg *quickfix.Message,
	sessionID quickfix.SessionID) (reject quickfix.MessageRejectError)

FromAdmin implemented as part of Application interface

func (TradeClient) FromApp

func (t TradeClient) FromApp(msg *quickfix.Message,
	sessionID quickfix.SessionID) (reject quickfix.MessageRejectError)

FromApp implemented as part of Application interface. This is the callback for all Application level messages from the counter party.

func (TradeClient) OnCreate

func (t TradeClient) OnCreate(sessionID quickfix.SessionID)

OnCreate implemented as part of Application interface

func (TradeClient) OnLogon

func (t TradeClient) OnLogon(sessionID quickfix.SessionID)

OnLogon implemented ƒas part of Application interface

func (TradeClient) OnLogout

func (t TradeClient) OnLogout(sessionID quickfix.SessionID)

OnLogout implemented as part of Application interface

func (TradeClient) ToAdmin

func (t TradeClient) ToAdmin(msg *quickfix.Message, sessionID quickfix.SessionID)

ToAdmin implemented as part of Application interface

func (TradeClient) ToApp

func (t TradeClient) ToApp(
	msg *quickfix.Message, sessionID quickfix.SessionID) (err error)

ToApp implemented as part of Application interface

Jump to

Keyboard shortcuts

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