kucoin

package
v0.0.0-...-4ca6365 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Handles HTTP requests logic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Accounts

type Accounts struct {
	Data []struct {
		ID        string `json:"id"`
		Currency  string `json:"currency"`
		Type      string `json:"type"`
		Balance   string `json:"balance"`
		Available string `json:"available"`
		Holds     string `json:"holds"`
	} `json:"data"`
}

func GetAccounts

func GetAccounts() (*Accounts, error)

Get Kucoin accounts

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
	APIKey     string
	SecretKey  string
	Passphrase string
	RetryDelay time.Duration
	MaxRetries int
	MaxHistory int
}

func NewClient

func NewClient() *Client

Create a new Client object

func (*Client) RequestWithRetries

func (c *Client) RequestWithRetries(endpoint string, parameters map[string]string) ([]byte, error)

Retry mechanism for HTTP requests

type DepositHistory

type DepositHistory struct {
	Data struct {
		Pagination Pagination
		Items      []struct {
			Address   string `json:"address"`
			Amount    string `json:"amount"`
			Fee       string `json:"fee"`
			Currency  string `json:"currency"`
			IsInner   bool   `json:"isInner"`
			Status    string `json:"status"`
			CreatedAt int64  `json:"createdAt"`
		} `json:"items"`
	} `json:"data"`
}

func GetDepositHistory

func GetDepositHistory() (*DepositHistory, error)

Get deposit history

type Kucoin

type Kucoin struct {
	Accounts        *Accounts
	DepositHistory  *DepositHistory
	WithdrawHistory *WithdrawHistory
}

func New

func New() *Kucoin

Create a new Kucoin object

func (*Kucoin) ProcessKucoinData

func (k *Kucoin) ProcessKucoinData(verbose bool)

Retrieve all account data from Kucoin

type Pagination

type Pagination struct {
	CurrentPage int `json:"currentPage"`
	PageSize    int `json:"pageSize"`
	TotalNum    int `json:"totalNum"`
	TotalPage   int `json:"totalPage"`
}

type WithdrawHistory

type WithdrawHistory struct {
	Data struct {
		Pagination Pagination
		Items      []struct {
			Address   string `json:"address"`
			Amount    string `json:"amount"`
			Fee       string `json:"fee"`
			Currency  string `json:"currency"`
			IsInner   bool   `json:"isInner"`
			Status    string `json:"status"`
			CreatedAt int64  `json:"createdAt"`
		} `json:"items"`
	} `json:"data"`
}

func GetWithdrawHistory

func GetWithdrawHistory() (*WithdrawHistory, error)

Get withdraw history

Jump to

Keyboard shortcuts

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