types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	X_btk_apikey   = "X-BTK-APIKEY"
	BaseAPIMainURL = "https://api.bitkub.com"

	OrderTypeLimit  OrderType = "LIMIT"
	OrderTypeMarket OrderType = "MARKET"

	OrderSideBuy  OrderSide = "buy"
	OrderSideSell OrderSide = "sell"
)

Variables

View Source
var (
	ErrSymbolMandatory      = errors.New("symbol is mandatory")
	ErrAmountMandatory      = errors.New("amount is mandatory")
	ErrAmountMustBePositive = errors.New("amount must be positive")
	ErrRateMandatory        = errors.New("rate is mandatory")
	ErrOrderTypeMandatory   = errors.New("order type is mandatory")
	ErrPageMustBePositive   = errors.New("page must be positive")
	ErrLimitMustBePositive  = errors.New("limit must be positive")
	ErrCurrencyMandatory    = errors.New("currency is mandatory")
	ErrAddressMandatory     = errors.New("address is mandatory")
	ErrNetworkMandatory     = errors.New("network is mandatory")
	ErrFiatAccIDMandatory   = errors.New("fiat account id is mandatory")
	ErrInvalidOrderSide     = errors.New("invalid order side")
	ErrOrderIDMandatory     = errors.New("order id is mandatory")
	ErrInvalidTimeStamp     = errors.New("invalid timestamp")
)
View Source
var BitkubAPIErrors = map[BitKubAPIError]string{
	APINoError:                       "No Error",
	APIInvalidJSON:                   "Invalid JSON payload",
	APIMissingAPIKey:                 "Missing X-BTK-APIKEY",
	APIInvalidAPIKey:                 "Invalid API key",
	APIPendingForActivation:          "API pending for activation",
	APIIpNotAllowed:                  "IP not allowed",
	APIInvalidSignature:              "Missing / Invalid signature",
	APIMissingTimeStamp:              "Missing timestamp",
	APIInvalidTimeStamp:              "Invalid timestamp",
	APIInvalidUser:                   "Invalid user",
	APIInvalidParamiter:              "Invalid parameter",
	APIInvalidSymbol:                 "Invalid symbol",
	APIInvalidAmount:                 "Invalid amount",
	APIInvalidPrice:                  "Invalid price",
	APIImproperRate:                  "Improper rate",
	APIAmountTooLow:                  "Amount too low",
	APIFailedToGetBalance:            "Failed to get balance",
	APIEmptyWallet:                   "Wallet is empty",
	APIInsufficientBalance:           "Insufficient balance",
	APIInsertOrderFailed:             "Failed to insert order into db",
	APIDeductBalanceFailed:           "Failed to deduct balance",
	APIInvalidOrderForCancellation:   "Invalid order for cancellation",
	APIInvalidSide:                   "Invalid side",
	APIUpdateOrderStatusFailed:       "Failed to update order status",
	APIInvalidOrderForLookup:         "Invalid order for lookup",
	APIKYCRequired:                   "KYC level 1 is required to proceed",
	APILimitExceeded:                 "Limit exceeded",
	APIPendingWidrawalExists:         "Pending withdrawal exists",
	APIInvalidCurrencyForWithdrawal:  "Invalid currency for withdrawal",
	APIAddressIsNotWhitelisted:       "Address is not whitelisted",
	APIDeductCryptoFailed:            "Failed to deduct crypto",
	APICreateWidthdrawalRecordFailed: "Failed to create withdrawal record",
	APINonceHasToBeNumeric:           "Nonce has to be numeric",
	APIInvalidNonce:                  "Invalid nonce",
	APIWithdrawalLimitExceeded:       "Withdrawal limit exceeded",
	APIInvalidBankAccount:            "Invalid bank account",
	APIBankLimitExceeded:             "Bank limit exceeded",
	APIPendingWitdrawalExists:        "Pending withdrawal exists",
	APIWitdrawalUnderMaintenance:     "Withdrawal is under maintenance",
	APIInvalidPermission:             "Invalid permission",
	APIInvalidInternalAddress:        "Invalid internal address",
	APIAddressDepreciated:            "Address has been depreciated",
	APICancelOnlyMode:                "Cancel only mode",
	APIUserSuspendedFromPurchasing:   "User has been suspended from purchasing",
	APIUserSuspendedFromSelling:      "User has been suspended from selling",
	APIServerError:                   "Server error",
}

Functions

This section is empty.

Types

type APIError

type APIError struct {
	ErrorID   BitKubAPIError `json:"error"`
	ErrorDesc string         `json:"error_description"`
}

type APIResponseError

type APIResponseError struct {
	Error BitKubAPIError `json:"error"`
}

type BalancesPayload

type BalancesPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type BalancesProps

type BalancesProps struct {
	Available float64 `json:"available"`
	Reserved  float64 `json:"reserved"`
}

type BalancesResponse

type BalancesResponse struct {
	Error  int            `json:"error"`
	Result BalancesResult `json:"result"`
}

type BalancesResponseAny

type BalancesResponseAny struct {
	Error  int                      `json:"error"`
	Result map[string]BalancesProps `json:"result"`
}

func (*BalancesResponseAny) Compile

func (b *BalancesResponseAny) Compile() *BalancesResponse

type BalancesResult

type BalancesResult struct {
	THB   BalancesProps `json:"THB"`
	BTC   BalancesProps `json:"BTC"`
	ETH   BalancesProps `json:"ETH"`
	WAN   BalancesProps `json:"WAN"`
	ADA   BalancesProps `json:"ADA"`
	OMG   BalancesProps `json:"OMG"`
	BCH   BalancesProps `json:"BCH"`
	USDT  BalancesProps `json:"USDT"`
	XRP   BalancesProps `json:"XRP"`
	ZIL   BalancesProps `json:"ZIL"`
	SNT   BalancesProps `json:"SNT"`
	CVC   BalancesProps `json:"CVC"`
	LINK  BalancesProps `json:"LINK"`
	IOST  BalancesProps `json:"IOST"`
	ZRX   BalancesProps `json:"ZRX"`
	KNC   BalancesProps `json:"KNC"`
	ABT   BalancesProps `json:"ABT"`
	MANA  BalancesProps `json:"MANA"`
	CTXC  BalancesProps `json:"CTXC"`
	XLM   BalancesProps `json:"XLM"`
	SIX   BalancesProps `json:"SIX"`
	JFIN  BalancesProps `json:"JFIN"`
	BNB   BalancesProps `json:"BNB"`
	POW   BalancesProps `json:"POW"`
	DOGE  BalancesProps `json:"DOGE"`
	DAI   BalancesProps `json:"DAI"`
	BAND  BalancesProps `json:"BAND"`
	KSM   BalancesProps `json:"KSM"`
	DOT   BalancesProps `json:"DOT"`
	USDC  BalancesProps `json:"USDC"`
	BAT   BalancesProps `json:"BAT"`
	NEAR  BalancesProps `json:"NEAR"`
	SCRT  BalancesProps `json:"SCRT"`
	GLM   BalancesProps `json:"GLM"`
	YFI   BalancesProps `json:"YFI"`
	UNI   BalancesProps `json:"UNI"`
	COMP  BalancesProps `json:"COMP"`
	MKR   BalancesProps `json:"MKR"`
	DON   BalancesProps `json:"DON"`
	AAVE  BalancesProps `json:"AAVE"`
	KUB   BalancesProps `json:"KUB"`
	ENJ   BalancesProps `json:"ENJ"`
	ALPHA BalancesProps `json:"ALPHA"`
	BAL   BalancesProps `json:"BAL"`
	CRV   BalancesProps `json:"CRV"`
	AXS   BalancesProps `json:"AXS"`
	SAND  BalancesProps `json:"SAND"`
	SUSHI BalancesProps `json:"SUSHI"`
}

type BaseRequestPayload

type BaseRequestPayload struct {
	TS  int64  `json:"ts,omitempty"`
	Sig string `json:"sig,omitempty"`
}

type BidsAsksResponse

type BidsAsksResponse struct {
	Error  int             `json:"error"`
	Result [][]interface{} `json:"result"`
}

type BitKubAPIError

type BitKubAPIError int //
const (
	APINoError BitKubAPIError = iota
	APIInvalidJSON
	APIMissingAPIKey
	APIInvalidAPIKey
	APIPendingForActivation
	APIIpNotAllowed
	APIInvalidSignature
	APIMissingTimeStamp
	APIInvalidTimeStamp
	APIInvalidUser
	APIInvalidParamiter
	APIInvalidSymbol
	APIInvalidAmount
	APIInvalidPrice
	APIImproperRate
	APIAmountTooLow
	APIFailedToGetBalance
	APIEmptyWallet
	APIInsufficientBalance
	APIInsertOrderFailed
	APIDeductBalanceFailed
	APIInvalidOrderForCancellation
	APIInvalidSide
	APIUpdateOrderStatusFailed
	APIInvalidOrderForLookup
	APIKYCRequired
	APILimitExceeded         BitKubAPIError = 30
	APIPendingWidrawalExists BitKubAPIError = iota + 13
	APIInvalidCurrencyForWithdrawal
	APIAddressIsNotWhitelisted
	APIDeductCryptoFailed
	APICreateWidthdrawalRecordFailed
	APINonceHasToBeNumeric
	APIInvalidNonce
	APIWithdrawalLimitExceeded
	APIInvalidBankAccount
	APIBankLimitExceeded
	APIPendingWitdrawalExists
	APIWitdrawalUnderMaintenance
	APIInvalidPermission
	APIInvalidInternalAddress
	APIAddressDepreciated
	APICancelOnlyMode
	APIUserSuspendedFromPurchasing
	APIUserSuspendedFromSelling
	APIServerError = 90
)

type BlockChainNetwork

type BlockChainNetwork string

type CancelOrderPayload

type CancelOrderPayload struct {
	TS        Timestamp `json:"ts,omitempty"`
	Sig       Signature `json:"sig,omitempty"`
	Symbol    Symbol    `json:"sym"`
	OrderID   OrderID   `json:"id"` // OrderID is string in cancel order payload
	OrderSide OrderSide `json:"sd"`
	OrderHash OrderHash `json:"hash"`
}

type CancelOrderResponse

type CancelOrderResponse struct {
	Error int `json:"error"`
}

type CryptoAddressesPayload

type CryptoAddressesPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type CryptoAddressesResponse

type CryptoAddressesResponse struct {
	Error  int `json:"error"`
	Result []struct {
		Currency string `json:"currency"`
		Address  string `json:"address"`
		Tag      string `json:"tag"`
		Time     int    `json:"time"`
		Network  string `json:"network,omitempty"`
	} `json:"result"`
	Pagination struct {
		Page int `json:"page,omitempty"`
		Last int `json:"last"`
		Next int `json:"next"`
		Prev int `json:"prev"`
	} `json:"pagination"`
}

In some Response behavior of pagination, it's not the same as the documentation. and not consistent. All Response that have pagination, Will have all Possible keys.

type CryptoAddressesResponseWithAllQuery

type CryptoAddressesResponseWithAllQuery struct {
	Error  int `json:"error"`
	Result []struct {
		Currency string `json:"currency"`
		Address  string `json:"address"`
		Tag      string `json:"tag"`
		Time     int    `json:"time"`
		Network  string `json:"network,omitempty"`
	} `json:"result"`
	Pagination struct {
		Page string `json:"page,omitempty"`
		Last int    `json:"last"`
		Next int    `json:"next"`
		Prev int    `json:"prev"`
	} `json:"pagination"`
}

type CryptoGenerateAddressPayload

type CryptoGenerateAddressPayload struct {
	TS     Timestamp `json:"ts,omitempty"`
	Sig    Signature `json:"sig,omitempty"`
	Symbol Symbol    `json:"sym,omitempty"`
}

type CryptoGenerateAddressResponse

type CryptoGenerateAddressResponse struct {
	Error  int `json:"error"`
	Result []struct {
		Currency string `json:"currency"`
		Address  string `json:"address"`
		Memo     string `json:"memo"`
	} `json:"result"`
}

type CryptoInternalWidthdrawPayload

type CryptoInternalWidthdrawPayload struct {
	TS      Timestamp `json:"ts,omitempty"`
	Sig     Signature `json:"sig,omitempty"`
	Cur     string    `json:"cur,omitempty"`
	Amount  float64   `json:"amt,omitempty"`
	Address string    `json:"adr,omitempty"`
	Memo    string    `json:"mem,omitempty"`
}

type CryptoWithdrawPayload

type CryptoWithdrawPayload struct {
	TS      Timestamp         `json:"ts,omitempty"`
	Sig     Signature         `json:"sig,omitempty"`
	Cur     string            `json:"cur,omitempty"`
	Amount  float64           `json:"amt,omitempty"`
	Address string            `json:"adr,omitempty"`
	Memo    string            `json:"mem,omitempty"`
	Network BlockChainNetwork `json:"net,omitempty"`
}

type CryptoWithdrawResponse

type CryptoWithdrawResponse struct {
	Error  int `json:"error"`
	Result struct {
		Txn string  `json:"txn"`
		Adr string  `json:"adr"`
		Mem string  `json:"mem"`
		Cur string  `json:"cur"`
		Amt float64 `json:"amt"`
		Fee float64 `json:"fee"`
		TS  int     `json:"ts"`
	} `json:"result"`
}

type EndPointType

type EndPointType string
const (
	/*
		Non-secure endpoints
	*/
	StatusEndpoint             EndPointType = "/api/status"
	ServertimeEndpoint         EndPointType = "/api/servertime"
	MarketSymbolsEndpoint      EndPointType = "/api/market/symbols"
	MarketTickerEndpoint       EndPointType = "/api/market/ticker"
	MarketTradesEndpoint       EndPointType = "/api/market/trades"
	MarketBidsEndpoint         EndPointType = "/api/market/bids"
	MarketAsksEndpoint         EndPointType = "/api/market/asks"
	MarketBooksEndpoint        EndPointType = "/api/market/books"
	MarketDepthEndpoint        EndPointType = "/api/market/depth"
	TradingviewHistoryEndpoint EndPointType = "/tradingview/history"

	/*
		Secure endpoints
	*/
	MarketWalletEndpoint          EndPointType = "/api/market/wallet"
	MarketBalancesEndpoint        EndPointType = "/api/market/balances"
	MarketPlaceBidEndpoint        EndPointType = "/api/market/place-bid"
	MarketPlaceAskEndpoint        EndPointType = "/api/market/place-ask"
	MarketPlaceAskByFiatEndpoint  EndPointType = "/api/market/place-ask-by-fiat"
	MarketCancelOrderEndpoint     EndPointType = "/api/market/cancel-order"
	MarketMyOpenOrdersEndpoint    EndPointType = "/api/market/my-open-orders"
	MarketMyOrderHistoryEndpoint  EndPointType = "/api/market/my-order-history"
	MarketOrderInfoEndpoint       EndPointType = "/api/market/order-info"
	CryptoAddressesEndpoint       EndPointType = "/api/crypto/addresses"
	CryptoWithdrawEndpoint        EndPointType = "/api/crypto/withdraw"
	CryptoInternalWidrawEndpoint  EndPointType = "/api/crypto/internal-withdraw"
	CryptoDepositHistoryEndpoint  EndPointType = "/api/crypto/deposit-history"
	CryptoWithdrawHistoryEndpoint EndPointType = "/api/crypto/withdraw-history"
	CryptoGeneratreAddress        EndPointType = "/api/crypto/generate-address"
	FiatAccountsEndpoint          EndPointType = "/api/fiat/accounts"
	FiatWithdrawEndpoint          EndPointType = "/api/fiat/withdraw"
	FiatDepositHistoryEndpoint    EndPointType = "/api/fiat/deposit-history"
	FiatWithdrawHistoryEndpoint   EndPointType = "/api/fiat/withdraw-history"

	MarketWstokenEndpoint EndPointType = "/api/market/wstoken"
	UserLimitsEndpoint    EndPointType = "/api/user/limits"
	UserTradingCredits    EndPointType = "/api/user/trading-credits"

	MarketPlaceBidEndpointV2     EndPointType = "/api/market/v2/place-bid"
	MarketPlaceAskEndpointV2     EndPointType = "/api/market/v2/place-ask"
	MarketPCancelOrderEndpointV2 EndPointType = "/api/market/v2/cancel-order"

	PlaceBidTestEndpoint EndPointType = "/api/market/place-bid/test"
	PlaceAskTestEndpoint EndPointType = "/api/market/place-ask/test"
)

func NewEndPoint

func NewEndPoint(endpoint string) EndPointType

func (EndPointType) String

func (e EndPointType) String() string

type FiatAccountPayload

type FiatAccountPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type FiatAccountsResponse

type FiatAccountsResponse struct {
	Error  int `json:"error"`
	Result []struct {
		ID   string `json:"id"`
		Bank string `json:"bank"`
		Name string `json:"name"`
		Time int    `json:"time"`
	} `json:"result"`
	Pagination struct {
		Page int `json:"page,omitempty"`
		Last int `json:"last"`
		Next int `json:"next"`
		Prev int `json:"prev"`
	} `json:"pagination"`
}

type FiatWithdrawPayload

type FiatWithdrawPayload struct {
	TS        Timestamp `json:"ts,omitempty"`
	Sig       Signature `json:"sig,omitempty"`
	FiatAccID string    `json:"id,omitempty"`
	Amount    float64   `json:"amt,omitempty"`
}

type FiatWithdrawResponse

type FiatWithdrawResponse struct {
	Error  int `json:"error"`
	Result struct {
		Txn string  `json:"txn"`
		Acc string  `json:"acc"`
		Cur string  `json:"cur"`
		Amt float64 `json:"amt"`
		Fee float64 `json:"fee"`
		Rec float64 `json:"rec"`
		TS  int     `json:"ts"`
	} `json:"result"`
}

type GetCryptoDepositPayload

type GetCryptoDepositPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type GetCryptoDepositResponse

type GetCryptoDepositResponse struct {
	Error  int `json:"error"`
	Result []struct {
		Hash          string      `json:"hash"`
		Currency      string      `json:"currency"`
		Amount        float64     `json:"amount"`
		Address       interface{} `json:"address"`
		Confirmations int         `json:"confirmations"`
		Status        string      `json:"status"`
		Note          interface{} `json:"note"`
		Time          int         `json:"time"`
	} `json:"result"`
	Pagination struct {
		Page int `json:"page,omitempty"`
		Last int `json:"last"`
		Next int `json:"next"`
		Prev int `json:"prev"`
	} `json:"pagination"`
}

type GetCryptoWithdrawPayload

type GetCryptoWithdrawPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type GetCryptoWithdrawResponse

type GetCryptoWithdrawResponse struct {
	Error  int `json:"error"`
	Result []struct {
		TxnID    string  `json:"txn_id"`
		Hash     string  `json:"hash"`
		Currency string  `json:"currency"`
		Amount   string  `json:"amount"`
		Fee      float64 `json:"fee"`
		Address  string  `json:"address"`
		Memo     string  `json:"memo"`
		Status   string  `json:"status"`
		Note     string  `json:"note"`
		Time     int     `json:"time"`
	} `json:"result"`
	Pagination struct {
		Page int `json:"page,omitempty"`
		Last int `json:"last"`
		Next int `json:"next"`
		Prev int `json:"prev"`
	} `json:"pagination"`
}

type GetFiatDepositsPayload

type GetFiatDepositsPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type GetFiatDepositsResponse

type GetFiatDepositsResponse struct {
	Error  int `json:"error"`
	Result []struct {
		TxnID    string  `json:"txn_id"`
		Currency string  `json:"currency"`
		Amount   float64 `json:"amount"`
		Status   string  `json:"status"`
		Time     int     `json:"time"`
	} `json:"result"`
	Pagination struct {
		Page int `json:"page,omitempty"`
		Last int `json:"last"`
		Next int `json:"next"`
		Prev int `json:"prev"`
	} `json:"pagination"`
}

type GetFiatWithdrawsPayload

type GetFiatWithdrawsPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type GetFiatWithdrawsResponse

type GetFiatWithdrawsResponse struct {
	Error  int `json:"error"`
	Result []struct {
		TxnID    string `json:"txn_id"`
		Currency string `json:"currency"`
		Amount   string `json:"amount"`
		Fee      int    `json:"fee"`
		Status   string `json:"status"`
		Time     int    `json:"time"`
	} `json:"result"`
	Pagination struct {
		Page int `json:"page"`
		Last int `json:"last"`
	} `json:"pagination"`
}

type GetOpenOrdersPayload

type GetOpenOrdersPayload struct {
	TS     Timestamp `json:"ts,omitempty"`
	Sig    Signature `json:"sig,omitempty"`
	Symbol Symbol    `json:"sym"`
}

type GetOpenOrdersResponse

type GetOpenOrdersResponse struct {
	Error  int `json:"error"`
	Result []struct {
		ID       string  `json:"id"`
		Hash     string  `json:"hash"`
		Side     string  `json:"side"`
		Type     string  `json:"type"`
		Rate     float64 `json:"rate"`
		Fee      float64 `json:"fee"`
		Credit   float64 `json:"credit"`
		Amount   float64 `json:"amount"`
		Receive  float64 `` /* 206-byte string literal not displayed */
		ParentID string  `json:"parent_id"`
		SuperID  string  `json:"super_id"`
		ClientID string  `json:"client_id"`
		TS       int     `json:"ts"`
	} `json:"result"`
}

type GetOrderHistoryPayload

type GetOrderHistoryPayload struct {
	TS     Timestamp `json:"ts,omitempty"`
	Sig    Signature `json:"sig,omitempty"`
	Symbol Symbol    `json:"sym"`
	Page   int       `json:"page,omitempty"`
	Limit  int       `json:"limit,omitempty"`
	Start  Timestamp `json:"start,omitempty"`
	End    Timestamp `json:"end,omitempty"`
}

type GetOrderHistoryResponse

type GetOrderHistoryResponse struct {
	Error  int `json:"error"`
	Result []struct {
		TxnID           string `json:"txn_id"`
		OrderID         string `json:"order_id"`
		Hash            string `json:"hash"`
		ParentOrderID   string `json:"parent_order_id"`
		ParentOrderHash string `json:"parent_order_hash"`
		SuperOrderID    string `json:"super_order_id"`
		SuperOrderHash  string `json:"super_order_hash"`
		TakenByMe       bool   `json:"taken_by_me"`
		IsMaker         bool   `json:"is_maker"`
		Side            string `json:"side"`
		Type            string `json:"type"`
		Rate            string `json:"rate"`
		Fee             string `json:"fee"`
		Credit          string `json:"credit"`
		Amount          string `json:"amount"`
		TS              int    `json:"ts"`
		Date            string `json:"date"`
	} `json:"result"`
	Pagination struct {
		Page int `json:"page,omitempty"`
		Last int `json:"last"`
		Next int `json:"next"`
		Prev int `json:"prev"`
	} `json:"pagination"`
}

type GetOrdersInfoPayload

type GetOrdersInfoPayload struct {
	TS        Timestamp `json:"ts,omitempty"`
	Sig       Signature `json:"sig,omitempty"`
	Symbol    Symbol    `json:"sym"`
	OrderID   OrderID   `json:"id"` // OrderId is a string in this case **
	OrderSide OrderSide `json:"sd"`
	OrderHash OrderHash `json:"hash,omitempty"`
}

type GetOrdersInfoResponse

type GetOrdersInfoResponse struct {
	Error  int `json:"error"`
	Result struct {
		Amount   int     `json:"amount"`
		ClientID string  `json:"client_id"`
		Credit   int     `json:"credit"`
		Fee      float64 `json:"fee"`
		Filled   int     `json:"filled"`
		First    string  `json:"first"`
		History  []struct {
			Amount    int     `json:"amount"`
			Credit    int     `json:"credit"`
			Fee       float64 `json:"fee"`
			Hash      string  `json:"hash"`
			ID        string  `json:"id"`
			Rate      int     `json:"rate"`
			Timestamp int     `json:"timestamp"`
			TxnID     string  `json:"txn_id"`
		} `json:"history"`
		ID            string  `json:"id"`
		Last          string  `json:"last"`
		Parent        string  `json:"parent"`
		PartialFilled bool    `json:"partial_filled"`
		Rate          float64 `json:"rate"`
		Remaining     float64 `json:"remaining"`
		Side          string  `json:"side"`
		Status        string  `json:"status"`
		Total         int     `json:"total"`
	} `json:"result"`
}

type GetTradingCreditsPayload

type GetTradingCreditsPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type GetTradingCreditsResponse

type GetTradingCreditsResponse struct {
	Error  int     `json:"error"`
	Result float64 `json:"result"`
}

type GetUserLimitsPayload

type GetUserLimitsPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type GetUserLimitsResponse

type GetUserLimitsResponse struct {
	Error  int `json:"error"`
	Result struct {
		Limits struct {
			Crypto struct {
				Deposit  float64 `json:"deposit"`
				Withdraw float64 `json:"withdraw"`
			} `json:"crypto"`
			Fiat struct {
				Deposit  float64 `json:"deposit"`
				Withdraw float64 `json:"withdraw"`
			} `json:"fiat"`
		} `json:"limits"`
		Usage struct {
			Crypto struct {
				Deposit               float64 `json:"deposit"`
				Withdraw              float64 `json:"withdraw"`
				DepositPercentage     float64 `json:"deposit_percentage"`
				WithdrawPercentage    float64 `json:"withdraw_percentage"`
				DepositThbEquivalent  float64 `json:"deposit_thb_equivalent"`
				WithdrawThbEquivalent float64 `json:"withdraw_thb_equivalent"`
			} `json:"crypto"`
			Fiat struct {
				Deposit            float64 `json:"deposit"`
				Withdraw           float64 `json:"withdraw"`
				DepositPercentage  float64 `json:"deposit_percentage"`
				WithdrawPercentage float64 `json:"withdraw_percentage"`
			} `json:"fiat"`
		} `json:"usage"`
		Rate float64 `json:"rate"`
	} `json:"result"`
}

type GetWsTokenPayload

type GetWsTokenPayload struct {
	TS  Timestamp `json:"ts,omitempty"`
	Sig Signature `json:"sig,omitempty"`
}

type GetWsTokenResponse

type GetWsTokenResponse struct {
	Error  int    `json:"error"`
	Result string `json:"result"`
}

type MarketDepthResponse

type MarketDepthResponse struct {
	Asks [][]float64 `json:"asks"`
	Bids [][]float64 `json:"bids"`
}

type OpenBooksResponse

type OpenBooksResponse struct {
	Error  int `json:"error"`
	Result struct {
		Asks [][]interface{} `json:"asks"`
		Bids [][]interface{} `json:"bids"`
	} `json:"result"`
}

type OrderHash

type OrderHash string

type OrderID

type OrderID string // After April 19th, 2023 at 18:00PM(GMT+7) Response Field id, first, parent, last change type from Integer to String.

type OrderSide

type OrderSide string

type OrderType

type OrderType string

type PlaceBidAskPayload

type PlaceBidAskPayload struct {
	TS       Timestamp `json:"ts,omitempty"`
	Sig      Signature `json:"sig,omitempty"`
	Symbol   Symbol    `json:"sym,omitempty"`
	Amount   float64   `json:"amt,omitempty"`
	Rate     float64   `json:"rat"`
	Type     OrderType `json:"typ,omitempty"`
	ClientID string    `json:"client_id,omitempty"`
}

type PlaceBidAskResponse

type PlaceBidAskResponse struct {
	Error  int `json:"error"`
	Result struct {
		ID   int     `json:"id"`
		Hash string  `json:"hash"`
		Typ  string  `json:"typ"`
		Amt  int     `json:"amt"`
		Rat  int     `json:"rat"`
		Fee  float64 `json:"fee"`
		Cre  float64 `json:"cre"`
		Rec  float64 `json:"rec"`
		TS   int     `json:"ts"`
		Ci   string  `json:"ci"`
	} `json:"result"`
}

type ServerStatus

type ServerStatus struct {
	Name    string `json:"name"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

type ServerStatusArray

type ServerStatusArray []ServerStatus

type Signature

type Signature string

type Symbol

type Symbol string

func (Symbol) String

func (s Symbol) String() string

type SymbolsResponse

type SymbolsResponse struct {
	Error  int `json:"error"`
	Result []struct {
		ID     int    `json:"id"`
		Info   string `json:"info"`
		Symbol string `json:"symbol"`
	} `json:"result"`
}

type TickerProperty

type TickerProperty struct {
	ID            int     `json:"id"`
	Last          float64 `json:"last"`
	LowestAsk     float64 `json:"lowestAsk"`
	HighestBid    float64 `json:"highestBid"`
	PercentChange float64 `json:"percentChange"`
	BaseVolume    float64 `json:"baseVolume"`
	QuoteVolume   float64 `json:"quoteVolume"`
	IsFrozen      int     `json:"isFrozen"`
	High24Hr      float64 `json:"high24hr"`
	Low24Hr       float64 `json:"low24hr"`
	Change        float64 `json:"change"`
	PrevClose     float64 `json:"prevClose"`
	PrevOpen      float64 `json:"prevOpen"`
}

type TickerResponse

type TickerResponse struct {
	THB1INCH TickerProperty `json:"THB_1INCH"`
	THBAAVE  TickerProperty `json:"THB_AAVE"`
	THBABT   TickerProperty `json:"THB_ABT"`
	THBADA   TickerProperty `json:"THB_ADA"`
	THBALGO  TickerProperty `json:"THB_ALGO"`
	THBALPHA TickerProperty `json:"THB_ALPHA"`
	THBAPE   TickerProperty `json:"THB_APE"`
	THBARB   TickerProperty `json:"THB_ARB"`
	THBATOM  TickerProperty `json:"THB_ATOM"`
	THBAVAX  TickerProperty `json:"THB_AVAX"`
	THBAXL   TickerProperty `json:"THB_AXL"`
	THBAXS   TickerProperty `json:"THB_AXS"`
	THBBAL   TickerProperty `json:"THB_BAL"`
	THBBAND  TickerProperty `json:"THB_BAND"`
	THBBAT   TickerProperty `json:"THB_BAT"`
	THBBCH   TickerProperty `json:"THB_BCH"`
	THBBNB   TickerProperty `json:"THB_BNB"`
	THBBTC   TickerProperty `json:"THB_BTC"`
	THBBUSD  TickerProperty `json:"THB_BUSD"`
	THBCELO  TickerProperty `json:"THB_CELO"`
	THBCHZ   TickerProperty `json:"THB_CHZ"`
	THBCOMP  TickerProperty `json:"THB_COMP"`
	THBCRV   TickerProperty `json:"THB_CRV"`
	THBCTXC  TickerProperty `json:"THB_CTXC"`
	THBCVC   TickerProperty `json:"THB_CVC"`
	THBDAI   TickerProperty `json:"THB_DAI"`
	THBDOGE  TickerProperty `json:"THB_DOGE"`
	THBDOT   TickerProperty `json:"THB_DOT"`
	THBDYDX  TickerProperty `json:"THB_DYDX"`
	THBENJ   TickerProperty `json:"THB_ENJ"`
	THBENS   TickerProperty `json:"THB_ENS"`
	THBETH   TickerProperty `json:"THB_ETH"`
	THBFLOW  TickerProperty `json:"THB_FLOW"`
	THBFTM   TickerProperty `json:"THB_FTM"`
	THBFXS   TickerProperty `json:"THB_FXS"`
	THBGAL   TickerProperty `json:"THB_GAL"`
	THBGALA  TickerProperty `json:"THB_GALA"`
	THBGF    TickerProperty `json:"THB_GF"`
	THBGLM   TickerProperty `json:"THB_GLM"`
	THBGRT   TickerProperty `json:"THB_GRT"`
	THBGT    TickerProperty `json:"THB_GT"`
	THBHBAR  TickerProperty `json:"THB_HBAR"`
	THBHFT   TickerProperty `json:"THB_HFT"`
	THBILV   TickerProperty `json:"THB_ILV"`
	THBIMX   TickerProperty `json:"THB_IMX"`
	THBIOST  TickerProperty `json:"THB_IOST"`
	THBJFIN  TickerProperty `json:"THB_JFIN"`
	THBKNC   TickerProperty `json:"THB_KNC"`
	THBKSM   TickerProperty `json:"THB_KSM"`
	THBKUB   TickerProperty `json:"THB_KUB"`
	THBLDO   TickerProperty `json:"THB_LDO"`
	THBLINK  TickerProperty `json:"THB_LINK"`
	THBLRC   TickerProperty `json:"THB_LRC"`
	THBLUNA  TickerProperty `json:"THB_LUNA"`
	THBLYXE  TickerProperty `json:"THB_LYXE"`
	THBMANA  TickerProperty `json:"THB_MANA"`
	THBMATIC TickerProperty `json:"THB_MATIC"`
	THBMKR   TickerProperty `json:"THB_MKR"`
	THBNEAR  TickerProperty `json:"THB_NEAR"`
	THBOCEAN TickerProperty `json:"THB_OCEAN"`
	THBOMG   TickerProperty `json:"THB_OMG"`
	THBOP    TickerProperty `json:"THB_OP"`
	THBPOW   TickerProperty `json:"THB_POW"`
	THBSAND  TickerProperty `json:"THB_SAND"`
	THBSCRT  TickerProperty `json:"THB_SCRT"`
	THBSIX   TickerProperty `json:"THB_SIX"`
	THBSNT   TickerProperty `json:"THB_SNT"`
	THBSNX   TickerProperty `json:"THB_SNX"`
	THBSOL   TickerProperty `json:"THB_SOL"`
	THBSTG   TickerProperty `json:"THB_STG"`
	THBSUSHI TickerProperty `json:"THB_SUSHI"`
	THBTRX   TickerProperty `json:"THB_TRX"`
	THBUNI   TickerProperty `json:"THB_UNI"`
	THBUSDC  TickerProperty `json:"THB_USDC"`
	THBUSDT  TickerProperty `json:"THB_USDT"`
	THBWAN   TickerProperty `json:"THB_WAN"`
	THBXLM   TickerProperty `json:"THB_XLM"`
	THBXRP   TickerProperty `json:"THB_XRP"`
	THBXTZ   TickerProperty `json:"THB_XTZ"`
	THBYFI   TickerProperty `json:"THB_YFI"`
	THBZIL   TickerProperty `json:"THB_ZIL"`
	THBZRX   TickerProperty `json:"THB_ZRX"`
}

type TickerResponseAny

type TickerResponseAny map[string]TickerProperty

func (*TickerResponseAny) Compile

func (t *TickerResponseAny) Compile() *TickerResponse

type TimeResolution

type TimeResolution string
const (
	Time1m   TimeResolution = "1"
	Time5m   TimeResolution = "5"
	Time15m  TimeResolution = "15"
	Time1h   TimeResolution = "60"
	Time240m TimeResolution = "240"
	Time1d   TimeResolution = "D"
)

func (TimeResolution) String

func (t TimeResolution) String() string

type Timestamp

type Timestamp int64

type TradesResponse

type TradesResponse struct {
	Error  int             `json:"error"`
	Result [][]interface{} `json:"result"`
}

Result[0] -> [timestamp, rate, amount,side]

type TradingViewHistoryResponse

type TradingViewHistoryResponse struct {
	C []float64 `json:"c"`
	H []float64 `json:"h"`
	L []float64 `json:"l"`
	O []float64 `json:"o"`
	S string    `json:"s"`
	T []int     `json:"t"`
	V []float64 `json:"v"`
}

type WalletResponse

type WalletResponse struct {
	Error  float64      `json:"error"`
	Result WalletResult `json:"result"`
}

type WalletResponseAny

type WalletResponseAny map[string]float64

func (*WalletResponseAny) Compile

func (w *WalletResponseAny) Compile() *WalletResponse

type WalletResult

type WalletResult struct {
	THB   float64 `json:"THB"`
	BTC   float64 `json:"BTC"`
	ETH   float64 `json:"ETH"`
	WAN   float64 `json:"WAN"`
	ADA   float64 `json:"ADA"`
	OMG   float64 `json:"OMG"`
	BCH   float64 `json:"BCH"`
	USDT  float64 `json:"USDT"`
	XRP   float64 `json:"XRP"`
	ZIL   float64 `json:"ZIL"`
	SNT   float64 `json:"SNT"`
	CVC   float64 `json:"CVC"`
	LINK  float64 `json:"LINK"`
	IOST  float64 `json:"IOST"`
	ZRX   float64 `json:"ZRX"`
	KNC   float64 `json:"KNC"`
	ABT   float64 `json:"ABT"`
	MANA  float64 `json:"MANA"`
	CTXC  float64 `json:"CTXC"`
	XLM   float64 `json:"XLM"`
	SIX   float64 `json:"SIX"`
	JFIN  float64 `json:"JFIN"`
	BNB   float64 `json:"BNB"`
	POW   float64 `json:"POW"`
	DOGE  float64 `json:"DOGE"`
	DAI   float64 `json:"DAI"`
	BAND  float64 `json:"BAND"`
	KSM   float64 `json:"KSM"`
	DOT   float64 `json:"DOT"`
	USDC  float64 `json:"USDC"`
	BAT   float64 `json:"BAT"`
	NEAR  float64 `json:"NEAR"`
	SCRT  float64 `json:"SCRT"`
	GLM   float64 `json:"GLM"`
	YFI   float64 `json:"YFI"`
	UNI   float64 `json:"UNI"`
	COMP  float64 `json:"COMP"`
	MKR   float64 `json:"MKR"`
	DON   float64 `json:"DON"`
	AAVE  float64 `json:"AAVE"`
	KUB   float64 `json:"KUB"`
	ENJ   float64 `json:"ENJ"`
	ALPHA float64 `json:"ALPHA"`
	BAL   float64 `json:"BAL"`
	CRV   float64 `json:"CRV"`
	AXS   float64 `json:"AXS"`
	SAND  float64 `json:"SAND"`
	SUSHI float64 `json:"SUSHI"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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