ctrader

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

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 16 Imported by: 0

README

cTrader Go SDK

This repository contains a Go SDK to consume cTrader OpenAPI.

Requirements

  • Go 1.21 or higher.
  • Earthly (optional).

Usage

Check the _test.go files.

Testing

# Set the following environment variables:
# - CTRADER_CLIENT_ID
# - CTRADER_SECRET
# - CTRADER_ACCOUNT_ID
# - CTRADER_TOKEN,

# Execute the tests directly with Go:
go test -tags integration -race ./...

# Or you can execute using Earthly:
earthly --secret CTRADER_CLIENT_ID="$CTRADER_CLIENT_ID" \
  --secret CTRADER_SECRET="$CTRADER_SECRET" \
  --secret CTRADER_ACCOUNT_ID="$CTRADER_ACCOUNT_ID" \
  --secret CTRADER_TOKEN="$CTRADER_TOKEN" \
  +go-test

FAQ

How to register an application?

Follow this instructions.

How to get an access ID and secret?

The easiest way is to use the playground.

How can I upgrade cTrader OpenAPI protobuf files?
  • Open the Earthfile and edit the +compile-proto target.
  • Execute the target earthly +compile-proto.
  • Sync the dependencies go mod tidy.
  • Ensure the package still compiles go build ./....
  • Open a pull request.

Documentation

Acknowledgments

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command[A, B proto.Message](ctx context.Context, c *Client, req A) (B, error)

Command is a helper function used to send a request and receive a response.

nolint ireturn

Types

type Client

type Client struct {
	ApplicationClientID string
	ApplicationSecret   string
	HandlerEvent        func(proto.Message)
	Deadline            time.Duration
	Logger              *slog.Logger
	Live                bool
	// contains filtered or unexported fields
}

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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