max

package
v1.58.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 28 Imported by: 12

Documentation

Index

Constants

View Source
const (
	All = iota
	Active
	Closed
)
View Source
const (
	OrderStateDone = OrderState("done")

	OrderStateCancel     = OrderState("cancel")
	OrderStateWait       = OrderState("wait")
	OrderStateConvert    = OrderState("convert")
	OrderStateFinalizing = OrderState("finalizing")
	OrderStateFailed     = OrderState("failed")
)
View Source
const (
	OrderTypeMarket     = OrderType("market")
	OrderTypeLimit      = OrderType("limit")
	OrderTypePostOnly   = OrderType("post_only")
	OrderTypeStopLimit  = OrderType("stop_limit")
	OrderTypeStopMarket = OrderType("stop_market")
	OrderTypeIOCLimit   = OrderType("ioc_limit")
)

Order types that the API can return.

View Source
const (
	// ProductionAPIURL is the official MAX API v2 Endpoint
	ProductionAPIURL = "https://max-api.maicoin.com/api/v2"

	UserAgent = "bbgo/" + version.Version

	// 2018-09-01 08:00:00 +0800 CST
	TimestampSince = 1535760000
)
View Source
const (
	RewardAirdrop    = RewardType("airdrop_reward")
	RewardCommission = RewardType("commission")
	RewardHolding    = RewardType("holding_reward")
	RewardMining     = RewardType("mining_reward")
	RewardTrading    = RewardType("trading_reward")
	RewardRedemption = RewardType("redemption_reward")
	RewardVipRebate  = RewardType("vip_rebate")
)
View Source
const Buy = 1
View Source
const Sell = -1

Variables

View Source
var ErrIncorrectBookEntryElementLength = errors.New("incorrect book entry element length")
View Source
var ErrMessageTypeNotSupported = errors.New("message type currently not supported")
View Source
var WebSocketURL = "wss://max-stream.maicoin.com/ws"

Functions

func IsFilledOrderState added in v1.58.0

func IsFilledOrderState(state OrderState) bool

func ParseMessage

func ParseMessage(payload []byte) (interface{}, error)

ParseMessage accepts the raw messages from max public websocket channels and parses them into market data Return types: *BookEvent, *PublicTradeEvent, *SubscriptionEvent, *ErrorEvent

func ParseUserEvent

func ParseUserEvent(v *fastjson.Value) (interface{}, error)

Types

type ADRatio added in v1.33.0

type ADRatio struct {
	ADRatio     fixedpoint.Value `json:"ad"`
	AssetInUSDT fixedpoint.Value `json:"as"`
	DebtInUSDT  fixedpoint.Value `json:"db"`
	IndexPrices []struct {
		Market string           `json:"M"`
		Price  fixedpoint.Value `json:"p"`
	} `json:"idxp"`
	TU types.MillisecondTimestamp `json:"TU"`
}

func (*ADRatio) String added in v1.33.0

func (r *ADRatio) String() string

type ADRatioEvent added in v1.33.0

type ADRatioEvent struct {
	ADRatio ADRatio `json:"ad"`
}

type Account

type Account struct {
	Type     string           `json:"type"`
	Currency string           `json:"currency"`
	Balance  fixedpoint.Value `json:"balance"`
	Locked   fixedpoint.Value `json:"locked"`

	// v3 fields for M wallet
	Principal fixedpoint.Value `json:"principal"`
	Interest  fixedpoint.Value `json:"interest"`

	// v2 fields
	FiatCurrency string           `json:"fiat_currency"`
	FiatBalance  fixedpoint.Value `json:"fiat_balance"`
}

Account is for max rest api v2, Balance and Type will be conflict with types.PrivateBalanceUpdate

type AccountService

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

type AccountSnapshotEvent

type AccountSnapshotEvent struct {
	BaseEvent
	Balances []BalanceMessage `json:"B"`
}

type AccountUpdateEvent

type AccountUpdateEvent struct {
	BaseEvent
	Balances []BalanceMessage `json:"B"`
}

type AuthEvent

type AuthEvent struct {
	Event     string
	ID        string
	Timestamp int64
}

type AuthMessage

type AuthMessage struct {
	Action    string   `json:"action,omitempty"`
	APIKey    string   `json:"apiKey,omitempty"`
	Nonce     int64    `json:"nonce,omitempty"`
	Signature string   `json:"signature,omitempty"`
	ID        string   `json:"id,omitempty"`
	Filters   []string `json:"filters,omitempty"`
}

type BalanceMessage

type BalanceMessage struct {
	Currency  string           `json:"cu"`
	Available fixedpoint.Value `json:"av"`
	Locked    fixedpoint.Value `json:"l"`
}

func (*BalanceMessage) Balance

func (m *BalanceMessage) Balance() (*types.Balance, error)

type BaseEvent

type BaseEvent struct {
	Event     string `json:"e"`
	Timestamp int64  `json:"T"`
}

type BookEvent

type BookEvent struct {
	Event     string `json:"e"`
	Market    string `json:"M"`
	Channel   string `json:"c"`
	Timestamp int64  `json:"t"` // Millisecond timestamp
	Bids      types.PriceVolumeSlice
	Asks      types.PriceVolumeSlice
}

func (*BookEvent) OrderBook

func (e *BookEvent) OrderBook() (snapshot types.SliceOrderBook, err error)

func (*BookEvent) Time

func (e *BookEvent) Time() time.Time

type CancelOrderRequest added in v1.39.0

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

func (*CancelOrderRequest) ClientOrderID added in v1.39.0

func (c *CancelOrderRequest) ClientOrderID(clientOrderID string) *CancelOrderRequest

func (*CancelOrderRequest) Do added in v1.39.0

func (c *CancelOrderRequest) Do(ctx context.Context) (*Order, error)

func (*CancelOrderRequest) GetParameters added in v1.39.0

func (c *CancelOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CancelOrderRequest) GetParametersJSON added in v1.39.0

func (c *CancelOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CancelOrderRequest) GetParametersQuery added in v1.39.0

func (c *CancelOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CancelOrderRequest) GetQueryParameters added in v1.39.0

func (c *CancelOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CancelOrderRequest) GetSlugParameters added in v1.39.0

func (c *CancelOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CancelOrderRequest) GetSlugsMap added in v1.39.0

func (c *CancelOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CancelOrderRequest) Id added in v1.39.0

type CreateOrderRequest

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

func (*CreateOrderRequest) ClientOrderID

func (c *CreateOrderRequest) ClientOrderID(clientOrderID string) *CreateOrderRequest

func (*CreateOrderRequest) Do

func (c *CreateOrderRequest) Do(ctx context.Context) (*Order, error)

func (*CreateOrderRequest) GetParameters added in v1.31.0

func (c *CreateOrderRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*CreateOrderRequest) GetParametersJSON added in v1.31.0

func (c *CreateOrderRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*CreateOrderRequest) GetParametersQuery added in v1.31.0

func (c *CreateOrderRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*CreateOrderRequest) GetQueryParameters added in v1.31.0

func (c *CreateOrderRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*CreateOrderRequest) GetSlugParameters added in v1.31.0

func (c *CreateOrderRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*CreateOrderRequest) GetSlugsMap added in v1.31.0

func (c *CreateOrderRequest) GetSlugsMap() (map[string]string, error)

func (*CreateOrderRequest) GroupID added in v1.31.0

func (c *CreateOrderRequest) GroupID(groupID string) *CreateOrderRequest

func (*CreateOrderRequest) Market

func (c *CreateOrderRequest) Market(market string) *CreateOrderRequest

func (*CreateOrderRequest) OrderType

func (c *CreateOrderRequest) OrderType(orderType OrderType) *CreateOrderRequest

func (*CreateOrderRequest) Price

func (c *CreateOrderRequest) Price(price string) *CreateOrderRequest

func (*CreateOrderRequest) Side

func (*CreateOrderRequest) StopPrice

func (c *CreateOrderRequest) StopPrice(stopPrice string) *CreateOrderRequest

func (*CreateOrderRequest) Volume

func (c *CreateOrderRequest) Volume(volume string) *CreateOrderRequest

type Debt added in v1.33.0

type Debt struct {
	Currency      string                     `json:"cu"`
	DebtPrincipal fixedpoint.Value           `json:"dbp"`
	DebtInterest  fixedpoint.Value           `json:"dbi"`
	TU            types.MillisecondTimestamp `json:"TU"`
}

func (*Debt) String added in v1.33.0

func (d *Debt) String() string

type DebtEvent added in v1.33.0

type DebtEvent struct {
	Debts []Debt `json:"db"`
}

type Deposit

type Deposit struct {
	Currency        string                     `json:"currency"`         // "eth"
	CurrencyVersion string                     `json:"currency_version"` // "eth"
	NetworkProtocol string                     `json:"network_protocol"` // "ethereum-erc20"
	Amount          fixedpoint.Value           `json:"amount"`
	Fee             fixedpoint.Value           `json:"fee"`
	TxID            string                     `json:"txid"`
	State           DepositState               `json:"state"`
	Status          string                     `json:"status"`
	Confirmations   int64                      `json:"confirmations"`
	Address         string                     `json:"to_address"` // 0x5c7d23d516f120d322fc7b116386b7e491739138
	CreatedAt       types.MillisecondTimestamp `json:"created_at"`
	UpdatedAt       types.MillisecondTimestamp `json:"updated_at"`
}

type DepositState added in v1.52.0

type DepositState string
const (
	DepositStateSubmitting DepositState = "submitting"
	DepositStateCancelled  DepositState = "cancelled"
	DepositStateSubmitted  DepositState = "submitted"
	DepositStatePending    DepositState = "pending"
	DepositStateSuspect    DepositState = "suspect"
	DepositStateRejected   DepositState = "rejected"
	DepositStateSuspended  DepositState = "suspended"
	DepositStateAccepted   DepositState = "accepted"
	DepositStateChecking   DepositState = "checking"
)

type ErrorEvent

type ErrorEvent struct {
	Timestamp int64
	Errors    []string
	CommandID string
}

func (ErrorEvent) Time

func (e ErrorEvent) Time() time.Time

type ErrorField

type ErrorField struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorResponse is the custom error type that is returned if the API returns an error.

type ErrorResponse

type ErrorResponse struct {
	*requestgen.Response
	Err ErrorField `json:"error"`
}

func ToErrorResponse added in v1.17.0

func ToErrorResponse(response *requestgen.Response) (errorResponse *ErrorResponse, err error)

ToErrorResponse tries to convert/parse the server response to the standard Error interface object

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type GetAccountRequest added in v1.31.0

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

func (*GetAccountRequest) Currency added in v1.31.0

func (g *GetAccountRequest) Currency(currency string) *GetAccountRequest

func (*GetAccountRequest) Do added in v1.31.0

func (*GetAccountRequest) GetParameters added in v1.31.0

func (g *GetAccountRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountRequest) GetParametersJSON added in v1.31.0

func (g *GetAccountRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountRequest) GetParametersQuery added in v1.31.0

func (g *GetAccountRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountRequest) GetQueryParameters added in v1.31.0

func (g *GetAccountRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountRequest) GetSlugParameters added in v1.31.0

func (g *GetAccountRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountRequest) GetSlugsMap added in v1.31.0

func (g *GetAccountRequest) GetSlugsMap() (map[string]string, error)

type GetAccountsRequest added in v1.31.0

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

func (*GetAccountsRequest) Do added in v1.31.0

func (*GetAccountsRequest) GetParameters added in v1.31.0

func (g *GetAccountsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetAccountsRequest) GetParametersJSON added in v1.31.0

func (g *GetAccountsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetAccountsRequest) GetParametersQuery added in v1.31.0

func (g *GetAccountsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetAccountsRequest) GetQueryParameters added in v1.31.0

func (g *GetAccountsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetAccountsRequest) GetSlugParameters added in v1.31.0

func (g *GetAccountsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetAccountsRequest) GetSlugsMap added in v1.31.0

func (g *GetAccountsRequest) GetSlugsMap() (map[string]string, error)

type GetDepositHistoryRequest

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

func (*GetDepositHistoryRequest) Currency

func (*GetDepositHistoryRequest) Do

func (*GetDepositHistoryRequest) From

func (*GetDepositHistoryRequest) GetParameters added in v1.31.0

func (g *GetDepositHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetDepositHistoryRequest) GetParametersJSON added in v1.31.0

func (g *GetDepositHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetDepositHistoryRequest) GetParametersQuery added in v1.31.0

func (g *GetDepositHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetDepositHistoryRequest) GetQueryParameters added in v1.31.0

func (g *GetDepositHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetDepositHistoryRequest) GetSlugParameters added in v1.31.0

func (g *GetDepositHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetDepositHistoryRequest) GetSlugsMap added in v1.31.0

func (g *GetDepositHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetDepositHistoryRequest) Limit

func (*GetDepositHistoryRequest) State

func (*GetDepositHistoryRequest) To

type GetKLinesRequest added in v1.39.0

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

func (*GetKLinesRequest) Do added in v1.39.0

func (*GetKLinesRequest) GetParameters added in v1.39.0

func (g *GetKLinesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetKLinesRequest) GetParametersJSON added in v1.39.0

func (g *GetKLinesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetKLinesRequest) GetParametersQuery added in v1.39.0

func (g *GetKLinesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetKLinesRequest) GetQueryParameters added in v1.39.0

func (g *GetKLinesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetKLinesRequest) GetSlugParameters added in v1.39.0

func (g *GetKLinesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetKLinesRequest) GetSlugsMap added in v1.39.0

func (g *GetKLinesRequest) GetSlugsMap() (map[string]string, error)

func (*GetKLinesRequest) Limit added in v1.39.0

func (g *GetKLinesRequest) Limit(limit int) *GetKLinesRequest

func (*GetKLinesRequest) Market added in v1.39.0

func (g *GetKLinesRequest) Market(market string) *GetKLinesRequest

func (*GetKLinesRequest) Period added in v1.39.0

func (g *GetKLinesRequest) Period(period int) *GetKLinesRequest

func (*GetKLinesRequest) Timestamp added in v1.39.0

func (g *GetKLinesRequest) Timestamp(timestamp time.Time) *GetKLinesRequest

type GetMarketsRequest added in v1.46.0

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

func (*GetMarketsRequest) Do added in v1.46.0

func (g *GetMarketsRequest) Do(ctx context.Context) ([]Market, error)

func (*GetMarketsRequest) GetParameters added in v1.46.0

func (g *GetMarketsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetMarketsRequest) GetParametersJSON added in v1.46.0

func (g *GetMarketsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetMarketsRequest) GetParametersQuery added in v1.46.0

func (g *GetMarketsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetMarketsRequest) GetQueryParameters added in v1.46.0

func (g *GetMarketsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetMarketsRequest) GetSlugParameters added in v1.46.0

func (g *GetMarketsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetMarketsRequest) GetSlugsMap added in v1.46.0

func (g *GetMarketsRequest) GetSlugsMap() (map[string]string, error)

type GetPrivateTradesRequest added in v1.31.0

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

type GetRewardsOfTypeRequest added in v1.31.0

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

func (*GetRewardsOfTypeRequest) Do added in v1.31.0

func (*GetRewardsOfTypeRequest) From added in v1.31.0

func (*GetRewardsOfTypeRequest) GetParameters added in v1.31.0

func (g *GetRewardsOfTypeRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetRewardsOfTypeRequest) GetParametersJSON added in v1.31.0

func (g *GetRewardsOfTypeRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetRewardsOfTypeRequest) GetParametersQuery added in v1.31.0

func (g *GetRewardsOfTypeRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetRewardsOfTypeRequest) GetQueryParameters added in v1.31.0

func (g *GetRewardsOfTypeRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetRewardsOfTypeRequest) GetSlugParameters added in v1.31.0

func (g *GetRewardsOfTypeRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetRewardsOfTypeRequest) GetSlugsMap added in v1.31.0

func (g *GetRewardsOfTypeRequest) GetSlugsMap() (map[string]string, error)

func (*GetRewardsOfTypeRequest) Limit added in v1.31.0

func (*GetRewardsOfTypeRequest) Offset added in v1.31.0

func (*GetRewardsOfTypeRequest) Page added in v1.31.0

func (*GetRewardsOfTypeRequest) PathType added in v1.31.0

func (*GetRewardsOfTypeRequest) To added in v1.31.0

type GetRewardsRequest added in v1.31.0

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

func (*GetRewardsRequest) Currency added in v1.31.0

func (g *GetRewardsRequest) Currency(currency string) *GetRewardsRequest

func (*GetRewardsRequest) Do added in v1.31.0

func (g *GetRewardsRequest) Do(ctx context.Context) ([]Reward, error)

func (*GetRewardsRequest) From added in v1.31.0

func (g *GetRewardsRequest) From(from int64) *GetRewardsRequest

func (*GetRewardsRequest) GetParameters added in v1.31.0

func (g *GetRewardsRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetRewardsRequest) GetParametersJSON added in v1.31.0

func (g *GetRewardsRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetRewardsRequest) GetParametersQuery added in v1.31.0

func (g *GetRewardsRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetRewardsRequest) GetQueryParameters added in v1.31.0

func (g *GetRewardsRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetRewardsRequest) GetSlugParameters added in v1.31.0

func (g *GetRewardsRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetRewardsRequest) GetSlugsMap added in v1.31.0

func (g *GetRewardsRequest) GetSlugsMap() (map[string]string, error)

func (*GetRewardsRequest) Limit added in v1.31.0

func (g *GetRewardsRequest) Limit(limit int64) *GetRewardsRequest

func (*GetRewardsRequest) Offset added in v1.31.0

func (g *GetRewardsRequest) Offset(offset int64) *GetRewardsRequest

func (*GetRewardsRequest) Page added in v1.31.0

func (g *GetRewardsRequest) Page(page int64) *GetRewardsRequest

func (*GetRewardsRequest) To added in v1.31.0

type GetTickerRequest added in v1.46.0

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

func (*GetTickerRequest) Do added in v1.46.0

func (g *GetTickerRequest) Do(ctx context.Context) (*Ticker, error)

func (*GetTickerRequest) GetParameters added in v1.46.0

func (g *GetTickerRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTickerRequest) GetParametersJSON added in v1.46.0

func (g *GetTickerRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickerRequest) GetParametersQuery added in v1.46.0

func (g *GetTickerRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTickerRequest) GetQueryParameters added in v1.46.0

func (g *GetTickerRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTickerRequest) GetSlugParameters added in v1.46.0

func (g *GetTickerRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTickerRequest) GetSlugsMap added in v1.46.0

func (g *GetTickerRequest) GetSlugsMap() (map[string]string, error)

func (*GetTickerRequest) Market added in v1.46.0

func (g *GetTickerRequest) Market(market string) *GetTickerRequest

type GetTickersRequest added in v1.46.0

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

func (*GetTickersRequest) Do added in v1.46.0

func (*GetTickersRequest) GetParameters added in v1.46.0

func (g *GetTickersRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTickersRequest) GetParametersJSON added in v1.46.0

func (g *GetTickersRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTickersRequest) GetParametersQuery added in v1.46.0

func (g *GetTickersRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTickersRequest) GetQueryParameters added in v1.46.0

func (g *GetTickersRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTickersRequest) GetSlugParameters added in v1.46.0

func (g *GetTickersRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTickersRequest) GetSlugsMap added in v1.46.0

func (g *GetTickersRequest) GetSlugsMap() (map[string]string, error)

type GetTimestampRequest added in v1.46.0

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

func (*GetTimestampRequest) Do added in v1.46.0

func (*GetTimestampRequest) GetParameters added in v1.46.0

func (g *GetTimestampRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetTimestampRequest) GetParametersJSON added in v1.46.0

func (g *GetTimestampRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetTimestampRequest) GetParametersQuery added in v1.46.0

func (g *GetTimestampRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetTimestampRequest) GetQueryParameters added in v1.46.0

func (g *GetTimestampRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetTimestampRequest) GetSlugParameters added in v1.46.0

func (g *GetTimestampRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetTimestampRequest) GetSlugsMap added in v1.46.0

func (g *GetTimestampRequest) GetSlugsMap() (map[string]string, error)

type GetVipLevelRequest added in v1.31.0

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

func (*GetVipLevelRequest) Do added in v1.31.0

func (*GetVipLevelRequest) GetParameters added in v1.31.0

func (g *GetVipLevelRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetVipLevelRequest) GetParametersJSON added in v1.31.0

func (g *GetVipLevelRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetVipLevelRequest) GetParametersQuery added in v1.31.0

func (g *GetVipLevelRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetVipLevelRequest) GetQueryParameters added in v1.31.0

func (g *GetVipLevelRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetVipLevelRequest) GetSlugParameters added in v1.31.0

func (g *GetVipLevelRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetVipLevelRequest) GetSlugsMap added in v1.31.0

func (g *GetVipLevelRequest) GetSlugsMap() (map[string]string, error)

type GetWithdrawHistoryRequest

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

func (*GetWithdrawHistoryRequest) Currency

func (*GetWithdrawHistoryRequest) Do

func (*GetWithdrawHistoryRequest) From

func (*GetWithdrawHistoryRequest) GetParameters added in v1.31.0

func (g *GetWithdrawHistoryRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetWithdrawHistoryRequest) GetParametersJSON added in v1.31.0

func (g *GetWithdrawHistoryRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetWithdrawHistoryRequest) GetParametersQuery added in v1.31.0

func (g *GetWithdrawHistoryRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetWithdrawHistoryRequest) GetQueryParameters added in v1.31.0

func (g *GetWithdrawHistoryRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetWithdrawHistoryRequest) GetSlugParameters added in v1.31.0

func (g *GetWithdrawHistoryRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetWithdrawHistoryRequest) GetSlugsMap added in v1.31.0

func (g *GetWithdrawHistoryRequest) GetSlugsMap() (map[string]string, error)

func (*GetWithdrawHistoryRequest) Limit

func (*GetWithdrawHistoryRequest) State

func (*GetWithdrawHistoryRequest) To

type GetWithdrawalAddressesRequest added in v1.16.0

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

func (*GetWithdrawalAddressesRequest) Currency added in v1.16.0

func (*GetWithdrawalAddressesRequest) Do added in v1.16.0

func (*GetWithdrawalAddressesRequest) GetParameters added in v1.31.0

func (g *GetWithdrawalAddressesRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*GetWithdrawalAddressesRequest) GetParametersJSON added in v1.31.0

func (g *GetWithdrawalAddressesRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*GetWithdrawalAddressesRequest) GetParametersQuery added in v1.31.0

func (g *GetWithdrawalAddressesRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*GetWithdrawalAddressesRequest) GetQueryParameters added in v1.31.0

func (g *GetWithdrawalAddressesRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*GetWithdrawalAddressesRequest) GetSlugParameters added in v1.31.0

func (g *GetWithdrawalAddressesRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*GetWithdrawalAddressesRequest) GetSlugsMap added in v1.31.0

func (g *GetWithdrawalAddressesRequest) GetSlugsMap() (map[string]string, error)

type Interval

type Interval int64

func ParseInterval

func ParseInterval(a string) (Interval, error)

type KLine

type KLine struct {
	Symbol                 string
	Interval               string
	StartTime, EndTime     time.Time
	Open, High, Low, Close fixedpoint.Value
	Volume                 fixedpoint.Value
	Closed                 bool
}

func (KLine) KLine

func (k KLine) KLine() types.KLine

type KLineData added in v1.39.0

type KLineData []float64

type KLineEvent

type KLineEvent struct {
	Event     string `json:"e"`
	Market    string `json:"M"`
	Channel   string `json:"c"`
	KLine     KLine  `json:"k"`
	Timestamp int64  `json:"T"`
}

type KLinePayload

type KLinePayload struct {
	StartTime   int64  `json:"ST"`
	EndTime     int64  `json:"ET"`
	Market      string `json:"M"`
	Resolution  string `json:"R"`
	Open        string `json:"O"`
	High        string `json:"H"`
	Low         string `json:"L"`
	Close       string `json:"C"`
	Volume      string `json:"v"`
	LastTradeID int    `json:"ti"`
	Closed      bool   `json:"x"`
}
{
  "c": "kline",
  "M": "btcusdt",
  "e": "update",
  "T": 1602999650179,
  "k": {
    "ST": 1602999900000,
    "ET": 1602999900000,
    "M": "btcusdt",
    "R": "5m",
    "O": "11417.21",
    "H": "11417.21",
    "L": "11417.21",
    "C": "11417.21",
    "v": "0",
    "ti": 0,
    "x": false
  }
}

func (KLinePayload) KLine

func (k KLinePayload) KLine() types.KLine

type Liquidity added in v1.33.0

type Liquidity string

type MarkerInfo

type MarkerInfo struct {
	Fee         string `json:"fee"`
	FeeCurrency string `json:"fee_currency"`
	OrderID     int    `json:"order_id"`
}

type Market

type Market struct {
	ID                 string           `json:"id"`
	Name               string           `json:"name"`
	Status             string           `json:"market_status"` // active
	BaseUnit           string           `json:"base_unit"`
	BaseUnitPrecision  int              `json:"base_unit_precision"`
	QuoteUnit          string           `json:"quote_unit"`
	QuoteUnitPrecision int              `json:"quote_unit_precision"`
	MinBaseAmount      fixedpoint.Value `json:"min_base_amount"`
	MinQuoteAmount     fixedpoint.Value `json:"min_quote_amount"`
	SupportMargin      bool             `json:"m_wallet_supported"`
}

type Order

type Order struct {
	ID              uint64                     `json:"id,omitempty"`
	WalletType      WalletType                 `json:"wallet_type,omitempty"`
	Side            string                     `json:"side"`
	OrderType       OrderType                  `json:"ord_type"`
	Price           fixedpoint.Value           `json:"price,omitempty"`
	StopPrice       fixedpoint.Value           `json:"stop_price,omitempty"`
	AveragePrice    fixedpoint.Value           `json:"avg_price,omitempty"`
	State           OrderState                 `json:"state,omitempty"`
	Market          string                     `json:"market,omitempty"`
	Volume          fixedpoint.Value           `json:"volume"`
	RemainingVolume fixedpoint.Value           `json:"remaining_volume,omitempty"`
	ExecutedVolume  fixedpoint.Value           `json:"executed_volume,omitempty"`
	TradesCount     int64                      `json:"trades_count,omitempty"`
	GroupID         uint32                     `json:"group_id,omitempty"`
	ClientOID       string                     `json:"client_oid,omitempty"`
	CreatedAt       types.MillisecondTimestamp `json:"created_at"`
	UpdatedAt       types.MillisecondTimestamp `json:"updated_at"`
}

Order represents one returned order (POST order/GET order/GET orders) on the max platform.

type OrderByType added in v1.55.0

type OrderByType string
const (
	OrderByAsc           OrderByType = "asc"
	OrderByDesc          OrderByType = "desc"
	OrderByAscUpdatedAt  OrderByType = "asc_updated_at"
	OrderByDescUpdatedAt OrderByType = "desc_updated_at"
)

type OrderService

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

OrderService manages the Order endpoint.

func (*OrderService) NewCancelOrderRequest added in v1.39.0

func (s *OrderService) NewCancelOrderRequest() *CancelOrderRequest

func (*OrderService) NewCreateOrderRequest

func (s *OrderService) NewCreateOrderRequest() *CreateOrderRequest

type OrderSnapshotEvent

type OrderSnapshotEvent struct {
	BaseEvent

	Orders []OrderUpdate `json:"o"`
}

type OrderState

type OrderState string

type OrderStateToQuery

type OrderStateToQuery int

type OrderType

type OrderType string

type OrderUpdate

type OrderUpdate struct {
	Event     string    `json:"e"`
	ID        uint64    `json:"i"`
	Side      string    `json:"sd"`
	OrderType OrderType `json:"ot"`

	Price     fixedpoint.Value `json:"p"`
	StopPrice fixedpoint.Value `json:"sp"`

	Volume       fixedpoint.Value `json:"v"`
	AveragePrice fixedpoint.Value `json:"ap"`
	State        OrderState       `json:"S"`
	Market       string           `json:"M"`

	RemainingVolume fixedpoint.Value `json:"rv"`
	ExecutedVolume  fixedpoint.Value `json:"ev"`

	TradesCount int64 `json:"tc"`

	GroupID     uint32 `json:"gi"`
	ClientOID   string `json:"ci"`
	CreatedAtMs int64  `json:"T"`
	UpdateTime  int64  `json:"TU"`
}

type OrderUpdateEvent

type OrderUpdateEvent struct {
	BaseEvent

	Orders []OrderUpdate `json:"o"`
}

type PrivateRequestParams

type PrivateRequestParams struct {
	Nonce int64  `json:"nonce"`
	Path  string `json:"path"`
}

type PublicService

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

func (*PublicService) KLines

func (s *PublicService) KLines(symbol string, resolution string, start time.Time, limit int) ([]KLine, error)

func (*PublicService) Markets

func (s *PublicService) Markets(ctx context.Context) ([]Market, error)

func (*PublicService) Ticker

func (s *PublicService) Ticker(market string) (*Ticker, error)

func (*PublicService) Tickers

func (s *PublicService) Tickers(ctx context.Context) (TickerMap, error)

func (*PublicService) Timestamp

func (s *PublicService) Timestamp(ctx context.Context) (int64, error)

type PublicTradeEvent

type PublicTradeEvent struct {
	Event     string       `json:"e"`
	Market    string       `json:"M"`
	Channel   string       `json:"c"`
	Trades    []TradeEntry `json:"t"`
	Timestamp int64        `json:"T"`
}

func (*PublicTradeEvent) Time

func (e *PublicTradeEvent) Time() time.Time

type QueryOrderOptions

type QueryOrderOptions struct {
	GroupID int
	Offset  int
	Limit   int
	Page    int
	OrderBy string
}

type QueryTradeOptions

type QueryTradeOptions struct {
	Market    string `json:"market"`
	Timestamp int64  `json:"timestamp,omitempty"`
	From      int64  `json:"from,omitempty"`
	To        int64  `json:"to,omitempty"`
	OrderBy   string `json:"order_by,omitempty"`
	Page      int    `json:"page,omitempty"`
	Offset    int    `json:"offset,omitempty"`
	Limit     int64  `json:"limit,omitempty"`
}

func (*QueryTradeOptions) Map

func (options *QueryTradeOptions) Map() map[string]interface{}

func (*QueryTradeOptions) Params

func (options *QueryTradeOptions) Params() url.Values

type RestClient

type RestClient struct {
	requestgen.BaseAPIClient

	APIKey, APISecret string

	AccountService    *AccountService
	PublicService     *PublicService
	TradeService      *TradeService
	OrderService      *OrderService
	RewardService     *RewardService
	WithdrawalService *WithdrawalService
}

func NewRestClient

func NewRestClient(baseURL string) *RestClient

func (*RestClient) Auth

func (c *RestClient) Auth(key string, secret string) *RestClient

Auth sets api key and secret for usage is requests that requires authentication.

func (*RestClient) NewAuthenticatedRequest added in v1.31.0

func (c *RestClient) NewAuthenticatedRequest(
	ctx context.Context, m string, refURL string, params url.Values, payload interface{},
) (*http.Request, error)

func (*RestClient) NewGetAccountRequest added in v1.46.0

func (c *RestClient) NewGetAccountRequest() *GetAccountRequest

func (*RestClient) NewGetAccountsRequest added in v1.46.0

func (c *RestClient) NewGetAccountsRequest() *GetAccountsRequest

func (*RestClient) NewGetDepositHistoryRequest added in v1.46.0

func (c *RestClient) NewGetDepositHistoryRequest() *GetDepositHistoryRequest

func (*RestClient) NewGetKLinesRequest added in v1.46.0

func (c *RestClient) NewGetKLinesRequest() *GetKLinesRequest

func (*RestClient) NewGetMarketsRequest added in v1.46.0

func (c *RestClient) NewGetMarketsRequest() *GetMarketsRequest

func (*RestClient) NewGetTickerRequest added in v1.46.0

func (c *RestClient) NewGetTickerRequest() *GetTickerRequest

func (*RestClient) NewGetTickersRequest added in v1.46.0

func (c *RestClient) NewGetTickersRequest() *GetTickersRequest

func (*RestClient) NewGetTimestampRequest added in v1.46.0

func (c *RestClient) NewGetTimestampRequest() *GetTimestampRequest

func (*RestClient) NewGetVipLevelRequest added in v1.46.0

func (c *RestClient) NewGetVipLevelRequest() *GetVipLevelRequest

func (*RestClient) NewGetWithdrawalHistoryRequest added in v1.46.0

func (c *RestClient) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest

type Reward added in v1.13.0

type Reward struct {
	// UUID here is more like SN, not the real UUID
	UUID     string           `json:"uuid"`
	Type     RewardType       `json:"type"`
	Currency string           `json:"currency"`
	Amount   fixedpoint.Value `json:"amount"`
	State    string           `json:"state"`
	Note     string           `json:"note"`

	// Unix timestamp in seconds
	CreatedAt types.Timestamp `json:"created_at"`
}

func (Reward) Reward added in v1.13.0

func (reward Reward) Reward() (*types.Reward, error)

type RewardService added in v1.13.0

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

func (*RewardService) NewGetRewardsOfTypeRequest added in v1.31.0

func (s *RewardService) NewGetRewardsOfTypeRequest(pathType RewardType) *GetRewardsOfTypeRequest

func (*RewardService) NewGetRewardsRequest added in v1.31.0

func (s *RewardService) NewGetRewardsRequest() *GetRewardsRequest

type RewardType added in v1.13.0

type RewardType string

func ParseRewardType added in v1.13.0

func ParseRewardType(s string) (RewardType, error)

func (RewardType) RewardType added in v1.13.0

func (t RewardType) RewardType() (types.RewardType, error)

func (*RewardType) UnmarshalJSON added in v1.13.0

func (t *RewardType) UnmarshalJSON(o []byte) error

type SubmitOrder added in v1.33.0

type SubmitOrder struct {
	Side      string    `json:"side"`
	Market    string    `json:"market"`
	Price     string    `json:"price"`
	StopPrice string    `json:"stop_price,omitempty"`
	OrderType OrderType `json:"ord_type"`
	Volume    string    `json:"volume"`
	GroupID   uint32    `json:"group_id,omitempty"`
	ClientOID string    `json:"client_oid,omitempty"`
}

type SubscribeOptions added in v1.13.0

type SubscribeOptions struct {
	Depth      int    `json:"depth,omitempty"`
	Resolution string `json:"resolution,omitempty"`
}

type Subscription

type Subscription struct {
	Channel    string `json:"channel"`
	Market     string `json:"market"`
	Depth      int    `json:"depth,omitempty"`
	Resolution string `json:"resolution,omitempty"`
}

Subscription is used for presenting the subscription metadata. This is used for sending subscribe and unsubscribe requests

type SubscriptionEvent

type SubscriptionEvent struct {
	Event         string         `json:"e"`
	Timestamp     int64          `json:"T"`
	CommandID     string         `json:"i"`
	Subscriptions []Subscription `json:"s"`
}

func (SubscriptionEvent) Time

func (e SubscriptionEvent) Time() time.Time

type Ticker

type Ticker struct {
	Time time.Time

	At          int64            `json:"at"`
	Buy         fixedpoint.Value `json:"buy"`
	Sell        fixedpoint.Value `json:"sell"`
	Open        fixedpoint.Value `json:"open"`
	High        fixedpoint.Value `json:"high"`
	Low         fixedpoint.Value `json:"low"`
	Last        fixedpoint.Value `json:"last"`
	Volume      fixedpoint.Value `json:"vol"`
	VolumeInBTC fixedpoint.Value `json:"vol_in_btc"`
}

type TickerMap added in v1.46.0

type TickerMap map[string]Ticker

type Timestamp added in v1.13.0

type Timestamp int64

type Trade

type Trade struct {
	ID          uint64                     `json:"id" db:"exchange_id"`
	WalletType  WalletType                 `json:"wallet_type,omitempty"`
	Price       fixedpoint.Value           `json:"price"`
	Volume      fixedpoint.Value           `json:"volume"`
	Funds       fixedpoint.Value           `json:"funds"`
	Market      string                     `json:"market"`
	MarketName  string                     `json:"market_name"`
	CreatedAt   types.MillisecondTimestamp `json:"created_at"`
	Side        string                     `json:"side"`
	OrderID     uint64                     `json:"order_id"`
	Fee         fixedpoint.Value           `json:"fee"` // float number as string
	FeeCurrency string                     `json:"fee_currency"`
	Liquidity   Liquidity                  `json:"liquidity"`
	Info        TradeInfo                  `json:"info,omitempty"`
}

Trade represents one returned trade on the max platform.

func (Trade) IsBuyer

func (t Trade) IsBuyer() bool

func (Trade) IsMaker

func (t Trade) IsMaker() bool

type TradeEntry

type TradeEntry struct {
	Trend     string `json:"tr"`
	Price     string `json:"p"`
	Volume    string `json:"v"`
	Timestamp int64  `json:"T"`
}

func (TradeEntry) Time

func (e TradeEntry) Time() time.Time

type TradeInfo

type TradeInfo struct {
	// Maker tells you the maker trade side
	Maker string      `json:"maker,omitempty"`
	Bid   *MarkerInfo `json:"bid,omitempty"`
	Ask   *MarkerInfo `json:"ask,omitempty"`
}

type TradeService

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

func (*TradeService) NewGetPrivateTradeRequest added in v1.31.0

func (s *TradeService) NewGetPrivateTradeRequest() *GetPrivateTradesRequest

type TradeSnapshotEvent

type TradeSnapshotEvent struct {
	BaseEvent
	Trades []TradeUpdate `json:"t"`
}

type TradeUpdate

type TradeUpdate struct {
	ID     uint64           `json:"i"`
	Side   string           `json:"sd"`
	Price  fixedpoint.Value `json:"p"`
	Volume fixedpoint.Value `json:"v"`
	Funds  fixedpoint.Value `json:"fn"`
	Market string           `json:"M"`

	Fee           fixedpoint.Value `json:"f"`
	FeeCurrency   string           `json:"fc"`
	FeeDiscounted bool             `json:"fd"`

	Timestamp  types.MillisecondTimestamp `json:"T"`
	UpdateTime types.MillisecondTimestamp `json:"TU"`

	OrderID uint64 `json:"oi"`

	Maker bool `json:"m"`
}

type TradeUpdateEvent

type TradeUpdateEvent struct {
	BaseEvent
	Trades []TradeUpdate `json:"t"`
}

type UserBank

type UserBank struct {
	Branch  string `json:"branch"`
	Name    string `json:"name"`
	Account string `json:"account"`
	State   string `json:"state"`
}

type UserInfo

type UserInfo struct {
	Sn              string    `json:"sn"`
	Name            string    `json:"name"`
	Type            string    `json:"member_type"`
	Level           int       `json:"level"`
	VipLevel        int       `json:"vip_level"`
	Email           string    `json:"email"`
	Accounts        []Account `json:"accounts"`
	Bank            *UserBank `json:"bank,omitempty"`
	IsFrozen        bool      `json:"is_frozen"`
	IsActivated     bool      `json:"is_activated"`
	KycApproved     bool      `json:"kyc_approved"`
	KycState        string    `json:"kyc_state"`
	PhoneSet        bool      `json:"phone_set"`
	PhoneNumber     string    `json:"phone_number"`
	ProfileVerified bool      `json:"profile_verified"`
	CountryCode     string    `json:"country_code"`
	IdentityNumber  string    `json:"identity_number"`
	WithDrawable    bool      `json:"withdrawable"`
	ReferralCode    string    `json:"referral_code"`
}

type VipLevel added in v1.14.1

type VipLevel struct {
	Current VipLevelSettings `json:"current_vip_level"`
	Next    VipLevelSettings `json:"next_vip_level"`
}

type VipLevelSettings added in v1.14.1

type VipLevelSettings struct {
	Level                int     `json:"level"`
	MinimumTradingVolume float64 `json:"minimum_trading_volume"`
	MinimumStakingVolume float64 `json:"minimum_staking_volume"`
	MakerFee             float64 `json:"maker_fee"`
	TakerFee             float64 `json:"taker_fee"`
}

type WalletType added in v1.33.0

type WalletType string
const (
	WalletTypeSpot   WalletType = "spot"
	WalletTypeMargin WalletType = "m"
)

type WebsocketCommand

type WebsocketCommand struct {
	// Action is used for specify the action of the websocket session.
	// Valid values are "subscribe", "unsubscribe" and "auth"
	Action        string         `json:"action"`
	Subscriptions []Subscription `json:"subscriptions,omitempty"`
}

type Withdraw

type Withdraw struct {
	UUID            string           `json:"uuid"`
	Currency        string           `json:"currency"`
	CurrencyVersion string           `json:"currency_version"` // "eth"
	Amount          fixedpoint.Value `json:"amount"`
	Fee             fixedpoint.Value `json:"fee"`
	FeeCurrency     string           `json:"fee_currency"`
	TxID            string           `json:"txid"`

	// State can be "submitting", "submitted",
	//     "rejected", "accepted", "suspect", "approved", "delisted_processing",
	//     "processing", "retryable", "sent", "canceled",
	//     "failed", "pending", "confirmed",
	//     "kgi_manually_processing", "kgi_manually_confirmed", "kgi_possible_failed",
	//     "sygna_verifying"
	State         string                     `json:"state"`
	Confirmations int                        `json:"confirmations"`
	CreatedAt     types.MillisecondTimestamp `json:"created_at"`
	UpdatedAt     types.MillisecondTimestamp `json:"updated_at"`
	Notes         string                     `json:"notes"`
}

type WithdrawState added in v1.52.0

type WithdrawState string

submitted -> accepted -> processing -> sent -> confirmed

const (
	WithdrawStateSubmitting WithdrawState = "submitting"
	WithdrawStateConfirmed  WithdrawState = "confirmed"
)

type WithdrawalAddress added in v1.16.0

type WithdrawalAddress struct {
	UUID            string `json:"uuid"`
	Currency        string `json:"currency"`
	CurrencyVersion string `json:"currency_version"`
	Address         string `json:"address"`
	ExtraLabel      string `json:"extra_label"`
	State           string `json:"state"`
	SygnaVaspCode   string `json:"sygna_vasp_code"`
	SygnaUserType   string `json:"sygna_user_type"`
	SygnaUserCode   string `json:"sygna_user_code"`
	IsInternal      bool   `json:"is_internal"`
}

type WithdrawalRequest added in v1.16.0

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

func (*WithdrawalRequest) AddressUUID added in v1.16.0

func (w *WithdrawalRequest) AddressUUID(addressUUID string) *WithdrawalRequest

func (*WithdrawalRequest) Amount added in v1.16.0

func (w *WithdrawalRequest) Amount(amount float64) *WithdrawalRequest

func (*WithdrawalRequest) Currency added in v1.16.0

func (w *WithdrawalRequest) Currency(currency string) *WithdrawalRequest

func (*WithdrawalRequest) Do added in v1.16.0

func (*WithdrawalRequest) GetParameters added in v1.31.0

func (w *WithdrawalRequest) GetParameters() (map[string]interface{}, error)

GetParameters builds and checks the parameters and return the result in a map object

func (*WithdrawalRequest) GetParametersJSON added in v1.31.0

func (w *WithdrawalRequest) GetParametersJSON() ([]byte, error)

GetParametersJSON converts the parameters from GetParameters into the JSON format

func (*WithdrawalRequest) GetParametersQuery added in v1.31.0

func (w *WithdrawalRequest) GetParametersQuery() (url.Values, error)

GetParametersQuery converts the parameters from GetParameters into the url.Values format

func (*WithdrawalRequest) GetQueryParameters added in v1.31.0

func (w *WithdrawalRequest) GetQueryParameters() (url.Values, error)

GetQueryParameters builds and checks the query parameters and returns url.Values

func (*WithdrawalRequest) GetSlugParameters added in v1.31.0

func (w *WithdrawalRequest) GetSlugParameters() (map[string]interface{}, error)

GetSlugParameters builds and checks the slug parameters and return the result in a map object

func (*WithdrawalRequest) GetSlugsMap added in v1.31.0

func (w *WithdrawalRequest) GetSlugsMap() (map[string]string, error)

type WithdrawalService added in v1.16.0

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

func (*WithdrawalService) NewGetWithdrawalAddressesRequest added in v1.16.0

func (s *WithdrawalService) NewGetWithdrawalAddressesRequest() *GetWithdrawalAddressesRequest

func (*WithdrawalService) NewGetWithdrawalHistoryRequest added in v1.16.0

func (s *WithdrawalService) NewGetWithdrawalHistoryRequest() *GetWithdrawHistoryRequest

func (*WithdrawalService) NewWithdrawalRequest added in v1.16.0

func (s *WithdrawalService) NewWithdrawalRequest() *WithdrawalRequest

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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