tradeclient

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNullTradeCompleteOpts ...
	ErrNullTradeCompleteOpts = errors.New("swap complete and swap fail messages must not be both null")
	// ErrInvalidTradeCompleteOpts ...
	ErrInvalidTradeCompleteOpts = errors.New("swap complete and swap fail messages must not be both defined")
	// ErrInvalidSwapCompleteMessage ...
	ErrInvalidSwapCompleteMessage = errors.New("swap complete must be a valid serialized message")
	// ErrInvalidSwapFailMessage ...
	ErrInvalidSwapFailMessage = errors.New("swap fail must be a valid serialized message")
)
View Source
var (
	// ErrMalformedSwapRequestMessage ...
	ErrMalformedSwapRequestMessage = errors.New("swap request must be a valid serialized message")
)

Functions

This section is empty.

Types

type BalancesOpts

type BalancesOpts struct {
	Market trademarket.Market
}

BalancesOpts is the struct given to Balances method

type Client

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

Client allows to connect with a trader service and to call its RPCs

func NewTradeClient

func NewTradeClient(host string, port int) (*Client, error)

NewTradeClient returns a new Client connected to the server at the given host and port through an insecure connection

func (*Client) Balances

func (c *Client) Balances(opts BalancesOpts) (*pbtrade.BalancesReply, error)

Balances crafts the request and calls the Balances rpc

func (*Client) CloseConnection

func (c *Client) CloseConnection() error

CloseConnection closes the connections between the current client and the server

func (*Client) MarketPrice

func (c *Client) MarketPrice(opts MarketPriceOpts) (*pbtrade.MarketPriceReply, error)

MarketPrice crafts the request and calls the MarketPrice rpc

func (*Client) Markets

func (c *Client) Markets() (*pbtrade.MarketsReply, error)

Markets calls the Markets rpc and returns its response

func (*Client) TradeComplete

func (c *Client) TradeComplete(opts TradeCompleteOpts) (*pbtrade.TradeCompleteReply, error)

TradeComplete crafts the request and calls the TradeComplete rpc

func (*Client) TradePropose

func (c *Client) TradePropose(opts TradeProposeOpts) (*pbtrade.TradeProposeReply, error)

TradePropose crafts the request and calls the TradePropose rpc

type MarketPriceOpts

type MarketPriceOpts struct {
	Market    trademarket.Market
	TradeType tradetype.TradeType
	Amount    uint64
	Asset     string
}

MarketPriceOpts is the struct given to MarketPrice method

type TradeCompleteOpts

type TradeCompleteOpts struct {
	SwapComplete []byte
	SwapFail     []byte
}

TradeCompleteOpts is the struct given to TradeComplete method

type TradeProposeOpts

type TradeProposeOpts struct {
	Market      trademarket.Market
	SwapRequest []byte
	TradeType   tradetype.TradeType
}

TradeProposeOpts is the struct given to TradePropose method

Jump to

Keyboard shortcuts

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