sdk

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 15 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBaseURL added in v1.7.0

func GetBaseURL() string

GetBaseURL returns the base URL for ccxt

func GetExchangeList added in v1.6.0

func GetExchangeList() []string

GetExchangeList gets a list of all supported exchanges

func SetBaseURL added in v1.7.0

func SetBaseURL(baseURL string) error

SetBaseURL allows setting the base URL for ccxt

Types

type Ccxt

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

Ccxt Rest SDK (https://github.com/franz-see/ccxt-rest, https://github.com/ccxt/ccxt/)

func MakeInitializedCcxtExchange

func MakeInitializedCcxtExchange(exchangeName string, apiKey api.ExchangeAPIKey, params []api.ExchangeParam, headers []api.ExchangeHeader) (*Ccxt, error)

MakeInitializedCcxtExchange constructs an instance of Ccxt that is bound to a specific exchange instance on the CCXT REST server

func (*Ccxt) CancelOrder added in v1.3.0

func (c *Ccxt) CancelOrder(orderID string, tradingPair string) (*CcxtOpenOrder, error)

CancelOrder calls the /cancelOrder endpoint on CCXT with the orderID and tradingPair

func (*Ccxt) CreateLimitOrder added in v1.3.0

func (c *Ccxt) CreateLimitOrder(tradingPair string, side string, amount float64, price float64, maybeExchangeSpecificParams interface{}) (*CcxtOpenOrder, error)

CreateLimitOrder calls the /createOrder endpoint on CCXT with a limit price and the order type set to "limit"

func (*Ccxt) FetchBalance added in v1.3.0

func (c *Ccxt) FetchBalance() (map[string]CcxtBalance, error)

FetchBalance calls the /fetchBalance endpoint on CCXT

func (*Ccxt) FetchMyTrades added in v1.3.0

func (c *Ccxt) FetchMyTrades(tradingPair string, limit int, maybeCursorStart interface{}) ([]CcxtTrade, error)

FetchMyTrades calls the /fetchMyTrades endpoint on CCXT, trading pair is the CCXT version of the trading pair

func (*Ccxt) FetchOpenOrders added in v1.3.0

func (c *Ccxt) FetchOpenOrders(tradingPairs []string) (map[string][]CcxtOpenOrder, error)

FetchOpenOrders calls the /fetchOpenOrders endpoint on CCXT

func (*Ccxt) FetchOrderBook

func (c *Ccxt) FetchOrderBook(tradingPair string, limit *int) (map[string][]CcxtOrder, error)

FetchOrderBook calls the /fetchOrderBook endpoint on CCXT, trading pair is the CCXT version of the trading pair

func (*Ccxt) FetchTicker

func (c *Ccxt) FetchTicker(tradingPair string) (map[string]interface{}, error)

FetchTicker calls the /fetchTicker endpoint on CCXT, trading pair is the CCXT version of the trading pair

func (*Ccxt) FetchTrades

func (c *Ccxt) FetchTrades(tradingPair string) ([]CcxtTrade, error)

FetchTrades calls the /fetchTrades endpoint on CCXT, trading pair is the CCXT version of the trading pair TODO take in since and limit values to match CCXT's API

func (*Ccxt) GetMarket added in v1.5.0

func (c *Ccxt) GetMarket(tradingPair string) *CcxtMarket

GetMarket returns the CcxtMarket instance

func (*Ccxt) GetMarkets added in v1.8.0

func (c *Ccxt) GetMarkets() map[string]CcxtMarket

GetMarkets returns all the markets

type CcxtBalance added in v1.3.0

type CcxtBalance struct {
	Total float64
	Used  float64
	Free  float64
}

CcxtBalance represents the balance for an asset

type CcxtMarket added in v1.5.0

type CcxtMarket struct {
	// only contains currently needed data
	Symbol string `json:"symbol"`
	Base   string `json:"base"`
	Quote  string `json:"quote"`
	Limits struct {
		Amount struct {
			Min float64 `json:"min"`
		} `json:"amount"`
		Price struct {
			Min float64 `json:"min"`
		} `json:"price"`
		Cost struct {
			Min float64 `json:"min"`
		} `json:"cost"`
	} `json:"limits"`
	Precision struct {
		Amount int8 `json:"amount"`
		Price  int8 `json:"price"`
	} `json:"precision"`
}

CcxtMarket represents the result of a LoadMarkets call

type CcxtOpenOrder added in v1.3.0

type CcxtOpenOrder struct {
	Amount    float64
	Cost      float64
	Filled    float64
	ID        string
	Price     float64
	Side      string
	Status    string
	Symbol    string
	Type      string
	Timestamp int64
}

CcxtOpenOrder represents an open order

type CcxtOrder

type CcxtOrder struct {
	Price  float64
	Amount float64
}

CcxtOrder represents an order in the orderbook

type CcxtTrade

type CcxtTrade struct {
	Amount    float64     `json:"amount"`
	Cost      float64     `json:"cost"`
	Datetime  string      `json:"datetime"`
	ID        string      `json:"id"`   // tradeID
	Info      interface{} `json:"info"` // raw trade response gotten from the exchange site's API
	Price     float64     `json:"price"`
	Side      string      `json:"side"`
	Symbol    string      `json:"symbol"`
	Timestamp int64       `json:"timestamp"`
	Fee       struct {
		Cost     float64 `json:"cost"`
		Currency string  `json:"currency"`
	} `json:"fee"`
}

CcxtTrade represents a trade

Jump to

Keyboard shortcuts

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