ctrader

package module
v0.0.0-...-d9fcbe4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 19 Imported by: 0

README

This repository fixes a small issue in https://github.com/ty2/ctrader-go where the connection would be closed if the user performs action on the cTrader application and a message is sent to this library which is due to fact that clientMsgId is not a UUID from the cTrader application side

Documentation

Index

Constants

View Source
const (
	ConnOnClosed = "onClosed"
)

Variables

This section is empty.

Functions

func DefaultErrResponseTypes

func DefaultErrResponseTypes() []openapi.ProtoOAPayloadType

func RequestMessageToProtoMessage

func RequestMessageToProtoMessage(reqType uint32, payload proto.Message, clientMsgUuid *uuid.UUID) (*uuid.UUID, *openapi.ProtoMessage)

func Reverse

func Reverse(s []byte)

func ToByteArray

func ToByteArray(num int) []byte

Types

type Account

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

func NewAccount

func NewAccount(client *Client, id int64) (*Account, error)

func (*Account) AccountLogout

func (account *Account) AccountLogout() (*openapi.ProtoOAAccountLogoutRes, error)

func (*Account) AmendOrder

func (*Account) AmendOrderPositionSlip

func (account *Account) AmendOrderPositionSlip(req *openapi.ProtoOAAmendPositionSLTPReq) (*openapi.ProtoOAExecutionEvent, error)

func (*Account) AssetClassList

func (account *Account) AssetClassList() (*openapi.ProtoOAAssetClassListRes, error)

func (*Account) AssetsList

func (account *Account) AssetsList() (*openapi.ProtoOAAssetListRes, error)

func (*Account) CancelOrder

func (account *Account) CancelOrder(orderId int64) (*openapi.ProtoOAExecutionEvent, error)

func (*Account) CashFlowHistoryList

func (account *Account) CashFlowHistoryList(fromTimestamp, toTimestamp int64) (*openapi.ProtoOACashFlowHistoryListRes, error)

func (*Account) ClosePosition

func (account *Account) ClosePosition(positionId int64, volume int64) (*openapi.ProtoOAExecutionEvent, error)

func (*Account) DealList

func (account *Account) DealList(fromTimestamp, toTimestamp int64, maxRows *int32) (*openapi.ProtoOADealListRes, error)

func (*Account) DealListByPositionId

func (account *Account) DealListByPositionId(positionId int64, fromTimestamp, toTimestamp int64) (*openapi.ProtoOADealListByPositionIdRes, error)

func (*Account) ExpectedMargin

func (account *Account) ExpectedMargin(symbolId int64, volume []int64) (*openapi.ProtoOAExpectedMarginRes, error)

func (*Account) GetDynamicLeverageByID

func (account *Account) GetDynamicLeverageByID(leverageId int64) (*openapi.ProtoOAGetDynamicLeverageByIDRes, error)

func (*Account) GetTickData

func (account *Account) GetTickData(symbolId int64, quoteType openapi.ProtoOAQuoteType, fromTimestamp, toTimestamp int64) (*openapi.ProtoOAGetTickDataRes, error)

func (*Account) GetTrendbars

func (account *Account) GetTrendbars(fromTimestamp, toTimestamp int64, period openapi.ProtoOATrendbarPeriod, symbolId int64, count uint32) (*openapi.ProtoOAGetTrendbarsRes, error)

func (*Account) Id

func (account *Account) Id() int64

func (*Account) MarginCallList

func (account *Account) MarginCallList() (*openapi.ProtoOAMarginCallListRes, error)

func (*Account) MarginCallUpdate

func (account *Account) MarginCallUpdate(marginCallType openapi.ProtoOANotificationType, marginLevelThreshold float64) (*openapi.ProtoOAMarginCallUpdateRes, error)

func (*Account) NewOrder

func (*Account) On

func (account *Account) On(payloadType openapi.ProtoOAPayloadType) (bus.MessageHandler, error)

func (*Account) OnAccountDisconnect

func (account *Account) OnAccountDisconnect() (bus.MessageHandler, error)

func (*Account) OnAccountTokenInvalided

func (account *Account) OnAccountTokenInvalided() (bus.MessageHandler, error)

func (*Account) OnDepth

func (account *Account) OnDepth() (bus.MessageHandler, error)

func (*Account) OnExecution

func (account *Account) OnExecution() (bus.MessageHandler, error)

func (*Account) OnMarginCallTrigger

func (account *Account) OnMarginCallTrigger() (bus.MessageHandler, error)

func (*Account) OnMarginCallUpdate

func (account *Account) OnMarginCallUpdate() (bus.MessageHandler, error)

func (*Account) OnMarginChanged

func (account *Account) OnMarginChanged() (bus.MessageHandler, error)

func (*Account) OnOrderError

func (account *Account) OnOrderError() (bus.MessageHandler, error)

func (*Account) OnSpot

func (account *Account) OnSpot() (bus.MessageHandler, error)

func (*Account) OnSymbolChange

func (account *Account) OnSymbolChange() (bus.MessageHandler, error)

func (*Account) OnTraderUpdate

func (account *Account) OnTraderUpdate() (bus.MessageHandler, error)

func (*Account) OnTrailingSLChange

func (account *Account) OnTrailingSLChange() (bus.MessageHandler, error)

func (*Account) OrderList

func (account *Account) OrderList(fromTimestamp, toTimestamp int64) (*openapi.ProtoOAOrderListRes, error)

func (*Account) Reconcile

func (account *Account) Reconcile() (*openapi.ProtoOAReconcileRes, error)

func (*Account) SubscribeDepthQuotes

func (account *Account) SubscribeDepthQuotes(symbolId []int64) (*openapi.ProtoOASubscribeDepthQuotesRes, error)

func (*Account) SubscribeLiveTrendbar

func (account *Account) SubscribeLiveTrendbar(symbolId int64, period openapi.ProtoOATrendbarPeriod) (*openapi.ProtoOASubscribeLiveTrendbarRes, error)

func (*Account) SubscribeSpots

func (account *Account) SubscribeSpots(symbolId []int64) (*openapi.ProtoOASubscribeSpotsRes, error)

func (*Account) SymbolById

func (account *Account) SymbolById(ids []int64) (*openapi.ProtoOASymbolByIdRes, error)

func (*Account) SymbolCategoryList

func (account *Account) SymbolCategoryList() (*openapi.ProtoOASymbolCategoryListRes, error)

func (*Account) SymbolList

func (account *Account) SymbolList() (*openapi.ProtoOASymbolsListRes, error)

func (*Account) SymbolsForConversion

func (account *Account) SymbolsForConversion(firstAssetId, lastAssetId int64) (*openapi.ProtoOASymbolsForConversionRes, error)

func (*Account) Trader

func (account *Account) Trader() (*openapi.ProtoOATraderRes, error)

func (*Account) UnsubscribeDepthQuotes

func (account *Account) UnsubscribeDepthQuotes(symbolId []int64) (*openapi.ProtoOAUnsubscribeDepthQuotesRes, error)

func (*Account) UnsubscribeLiveTrendbar

func (account *Account) UnsubscribeLiveTrendbar(symbolId int64, period openapi.ProtoOATrendbarPeriod) (*openapi.ProtoOAUnsubscribeLiveTrendbarRes, error)

func (*Account) UnsubscribeSpots

func (account *Account) UnsubscribeSpots(symbolId []int64) (*openapi.ProtoOAUnsubscribeSpotsRes, error)

type Client

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

func NewClient

func NewClient(conn *Conn, id string, secret string, accountToken string) *Client

func (*Client) Account

func (client *Client) Account(accountId int64) (*Account, error)

func (*Client) ApplicationAuth

func (client *Client) ApplicationAuth() (*openapi.ProtoOAApplicationAuthRes, error)

func (*Client) Close

func (client *Client) Close() error

func (*Client) Connect

func (client *Client) Connect() error

func (*Client) GetAccountListByAccessToken

func (client *Client) GetAccountListByAccessToken(accessToken string) (*openapi.ProtoOAGetAccountListByAccessTokenRes, error)

func (*Client) GetCtidProfileByToken

func (client *Client) GetCtidProfileByToken(accessToken string) (*openapi.ProtoOAGetCtidProfileByTokenRes, error)

func (*Client) On

func (client *Client) On(payloadType openapi.ProtoOAPayloadType) (bus.MessageHandler, error)

func (*Client) OnConnClose

func (client *Client) OnConnClose() (bus.MessageHandler, error)

func (*Client) RefreshToken

func (client *Client) RefreshToken(refreshToken string) (*openapi.ProtoOARefreshTokenRes, error)

func (*Client) SendRequest

func (client *Client) SendRequest(reqType openapi.ProtoOAPayloadType, resType []openapi.ProtoOAPayloadType, errType []openapi.ProtoOAPayloadType, req proto.Message, clientMsgUuid *uuid.UUID) (interface{}, error)

func (*Client) Version

func (client *Client) Version() (*openapi.ProtoOAVersionRes, error)

type Conn

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

func NewConn

func NewConn(addr string, options ...ConnOption) *Conn

func (*Conn) Connect

func (conn *Conn) Connect() error

func (*Conn) OnClosed

func (conn *Conn) OnClosed() (bus.MessageHandler, error)

func (*Conn) SendByte

func (conn *Conn) SendByte(b []byte) error

func (*Conn) SendMessage

func (conn *Conn) SendMessage(reqType uint32, req proto.Message, clientMsgUuid *uuid.UUID) (*uuid.UUID, error)

type ConnOption

type ConnOption func(conn *Conn)

func TlsCertificatesConnOption

func TlsCertificatesConnOption(certificates []tls.Certificate) ConnOption

type ResponseMessageHandlerError

type ResponseMessageHandlerError struct {
	*model.Message
}

func (*ResponseMessageHandlerError) Error

func (resMsgHandlerErr *ResponseMessageHandlerError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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