rest

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client handles all the comunication with the rest API

func NewClient

func NewClient(apiKey, apiSecret string, window int) *Client

NewClient creates a new rest client to communicate with the exchange. Requests to the exchange via this client use the args package for aguments. All requests accept contexts for cancellation. arguments:

apiKey // the key of the user
apiSecret // the secret key of the user
window // the window of execution for requests to the server in milliseconds. Max is 60_000 (miliseconds). Use 0 for default window (10 seconds)

func NewPublicClient

func NewPublicClient() *Client

NewPublicClient creates a new rest client with no credentials to communicate with the exchange. Only works with public calls. Requests to the exchange via this client use the args package for arguments. All requests accept contexts for cancellation

func (*Client) ActivateSubAccounts

func (client *Client) ActivateSubAccounts(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

ActivateSubAccounts unfreezes sub-accounts listed and returns a bool indicating whether the sub accounts where activated

Requires no API key Access Rights. Requires to be authenticated

https://api.exchange.cryptomkt.com/#activate-sub-account

Arguments:

SubAccountIDs(...string)  // currency code of the sub-accounts to activate. Ids as hexadecimal code

func (*Client) CancelAllSpotOrders

func (client *Client) CancelAllSpotOrders(
	ctx context.Context,
) (result []models.Order, err error)

CancelAllSpotOrders Cancel all active spot orders, or all active orders for a specified symbol

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#cancel-all-spot-orders

func (*Client) CancelSpotOrder

func (client *Client) CancelSpotOrder(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Order, err error)

CancelSpotOrder Cancel the order with the client order id

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#cancel-spot-order

Arguments:

ClientOrderID(string)  // client order id of the order to cancel

func (*Client) ChangeACLSettings

func (client *Client) ChangeACLSettings(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

ChangeACLSettings changes the ACL settings of subaccounts and returns a list of acl settings of the changed sub-accounts

Disables or enables withdrawals for a sub-account

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#change-acl-settings

Arguments:

SubAccountIDs(...string)  // currency code for transfering
DepositAddressGenerationEnabled(bool)	// Optional. value indicaiting permission for deposits
WithdrawEnabled(bool)  // Optional. value indicating permission for withdrawals
Description(string)  // Optional. Textual description.
CreatedAt(string)  // Optional. ACL creation time
UpdatedAt(string)  // Optional. ACL update time

func (*Client) CheckIfCryptoAddressBelongsToCurrentAccount

func (client *Client) CheckIfCryptoAddressBelongsToCurrentAccount(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

CheckIfCryptoAddressBelongsToCurrentAccount checks if an address is from this account

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#check-if-crypto-address-belongs-to-current-account

Arguments:

Address(string)  // address to check

func (*Client) CheckIfOffchainIsAvailable

func (client *Client) CheckIfOffchainIsAvailable(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

CheckIfOffchainIsAvailable gets the status of the offchain

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#check-if-offchain-is-available

Arguments:

Currency(string)  // currency code
Address(string)  // address identifier
PaymentID(string)  // Optional.

func (*Client) ConvertBetweenCurrencies

func (client *Client) ConvertBetweenCurrencies(
	ctx context.Context,
	arguments ...args.Argument,
) (result []string, err error)

ConvertBetweenCurrencies Converts between currencies

Successful response to the request does not necessarily mean the resulting transaction got executed immediately. It has to be processed first and may eventually be rolled back

To see whether a transaction has been finalized, call

getTransaction(id string)

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#convert-between-currencies

Arguments:

FromCurrency(string)  // currency code of origin
ToCurrency(string)  // currency code of destiny
Amount(string)  // the amount to be converted

func (*Client) CreateDepositCryptoAddress

func (client *Client) CreateDepositCryptoAddress(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.CryptoAddress, err error)

func (*Client) CreateSpotOrder

func (client *Client) CreateSpotOrder(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Order, err error)

CreateSpotOrder creates a new spot order

For fee, for price accuracy and quantity, and for order status information see the api docs

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#create-new-spot-order

Arguments:

Symbol(string)  // Trading symbol
Side(SideType)  // Either SideBuy or SideSell
Quantity(string)  // Order quantity
ClientOrderID(string)  // Optional. If given must be unique within the trading day, including all active orders. If not given, is generated by the server
Type(OrderType)  // Optional. OrderLimit, OrderMarket, OrderStopLimit, OrderStopMarket, OrderTakeProfitLimit or OrderTakeProfitMarket. Default is OrderLimit
TimeInForce(TimeInForceType)  // Optional. TimeInForceGTC, TimeInForceIOC, TimeInForceFOK, TimeInForceDay, TimeInForceGTD. Default to TimeInForceGTC
Price(string)  // Optional. Required for OrderLimit and OrderStopLimit. limit price of the order
StopPrice(string)  // Optional. Required for OrderStopLimit and OrderStopMarket orders. stop price of the order
ExpireTime(string)  // Optional. Required for orders with timeInForceGDT
StrictValidate(bool)  // Optional. If False, the server rounds half down for tickerSize and quantityIncrement. Example of ETHBTC: tickSize = '0.000001', then price '0.046016' is valid, '0.0460165' is invalid
PostOnly(bool)  // Optional. If True, your postOnly order causes a match with a pre-existing order as a taker, then the order will be cancelled
TakeRate(string)  // Optional. Liquidity taker fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.
MakeRate(string)  // Optional. Liquidity provider fee, a fraction of order volume, such as 0.001 (for 0.1% fee). Can only increase the fee. Used for fee markup.

func (*Client) CreateSpotOrderList

func (client *Client) CreateSpotOrderList(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.Order, err error)

CreateSpotOrderList creates a list of spot orders and returns a list of the created spot orders or a possible error

Types or contingency:

  • ContingencyTypeAllOrNone (ContingencyTypeAON) (AON)
  • ContingencyTypeOneCancelOther (ContingencyTypeOCO) (OCO)
  • ContingencyOneTriggerOther (ContingencyTypeOTO) (OTO)
  • ContingencyOneTriggerOneCancelOther (ContingencyTypeOTOCO) (OTOCO)

Restriction in the number of orders:

  • An AON list must have 2 or 3 orders
  • An OCO list must have 2 or 3 orders
  • An OTO list must have 2 or 3 orders
  • An OTOCO must have 3 or 4 orders

Symbol restrictions:

  • For an AON order list, the symbol code of orders must be unique for each order in the list.
  • For an OCO order list, there are no symbol code restrictions.
  • For an OTO order list, there are no symbol code restrictions.
  • For an OTOCO order list, the symbol code of orders must be the same for all orders in the list (placing orders in different order books is not supported).

ORDER_TYPE restrictions:

  • For an AON order list, orders must be OrderLimit or OrderMarket
  • For an OCO order list, orders must be OrderLimit, OrderStopLimit, OrderStopMarket, OrderTakeProfitLimit or OrderTakeProfitMarket.
  • An OCO order list cannot include more than one limit order (the same applies to secondary orders in an OTOCO order list).
  • For an OTO order list there are no order type restrictions.
  • For an OTOCO order list, the first order must be OrderLimit, OrderMarket, OrderStopLimit, OrderStopMarket, OrderTakeProfitLimit or OrderTakeProfitMarket.
  • For an OTOCO order list, the secondary orders have the same restrictions as an OCO order
  • Default is OrderTypeLimit.

https://api.exchange.cryptomkt.com/#create-new-spot-order-list-2

Arguments:

ContingencyType(ContingencyTypeType) order list type.
Orders(OrderRequest[]) the list of OrderRequests in the order list
OrderListID(string) order list identifier. If not provided, it will be generated by the system. Must be equal to the client order id of the first order in the requests list.

func (*Client) FreezeSubAccounts

func (client *Client) FreezeSubAccounts(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

FreezeSubAccounts freezes sub-accounts listed and returnes a boolean indicating whether the sub-accounts where frozen

A frozen wouldn't be able to:

- login

- withdraw funds

- trade

- complete pending orders

- use API keys

For any sub-account listed, all orders will be canceled and all funds will be transferred form the Trading balance

Requires no API key Access Rights. Requires to be authenticated

https://api.exchange.cryptomkt.com/#freeze-sub-account

Arguments:

SubAccountIDs(...string)  // A list of sub account ids. Ids as hexadecimal code

func (*Client) GetACLSettings

func (client *Client) GetACLSettings(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.ACLSettings, err error)

GetACLSettings get a list of withdrawal settings for all sub-accounts or for the specified sub-accounts and returns A list of ACL settings for subaccounts

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#get-acl-settings

Arguments:

SubAccountIDs(...string)  // A list of sub account ids. Ids as hexadecimal code

func (*Client) GetActiveSpotOrder

func (client *Client) GetActiveSpotOrder(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Order, err error)

GetActiveSpotOrder gets an active spot order by its client order id

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#get-active-spot-orders

Arguments:

ClientOrderID(string)  // The client order id of the order

func (*Client) GetAllActiveSpotOrders

func (client *Client) GetAllActiveSpotOrders(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.Order, err error)

GetAllActiveSpotOrders gets the user's active spot orders

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#get-all-active-spot-orders

Arguments:

Symbol(string)  // Optional. A symbol for filtering the active spot orders

func (*Client) GetAllTradingCommissions

func (client *Client) GetAllTradingCommissions(
	ctx context.Context,
) (result []models.TradingCommission, err error)

GetAllTradingCommissions gets the personal trading commission rates for all symbols

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#get-all-trading-commission

func (*Client) GetAmountLocks

func (client *Client) GetAmountLocks(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.AmountLock, err error)

GetAmountLocks gets the list of amount locks

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#get-amount-locks

Arguments:

Currency(string)  // Optional. Currency code
Active(bool)  // Optional. value showing whether the lock is active
Limit(int)  // Optional. Dafault is 100. Min is 0. Max is 1000
Offset(int)  // Optional. Default is 0. Min is 0
From(string)  // Optional. Interval initial value. As Datetime
Till(string)  // Optional. Interval end value. As Datetime

func (*Client) GetCandles

func (client *Client) GetCandles(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string][]models.Candle, err error)

GetCandles gets a map of candles for all symbols or for specified symbols

Candels are used for OHLC representation

The result contains candles with non-zero volume only (no trades = no candles)

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#candles

Arguments:

Symbols([]string)  // A list of symbol ids
Period(PeriodType)  // Optional. A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month. Default is Period30Minutes
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
From(string)  // Optional. Initial value of the queried interval. As DateTime
Till(string)  // Optional. Last value of the queried interval. As DateTime
Limit(int)  // Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000

func (*Client) GetCandlesOfSymbol

func (client *Client) GetCandlesOfSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.Candle, err error)

GetCandlesOfSymbol get candles of a symbol

Candels are used for OHLC representation

The result contains candles with non-zero volume only (no trades = no candles)

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#candles

Arguments:

Symbol(string)  // A symbol id
Period(PeriodType)  // Optional. A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month. Default is Period30Minutes
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
From(string)  // Optional. Initial value of the queried interval. As DateTime
Till(string)  // Optional. Last value of the queried interval. As DateTime
Limit(int)  // Optional. Prices per currency pair. Defaul is 100. Min is 1. Max is 1000
Offset(int)  // Optional. Default is 0. Min is 0. Max is 100000

func (*Client) GetCurrencies

func (client *Client) GetCurrencies(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string]models.Currency, err error)

GetCurrencies gets a map of all currencies or specified currencies. indexed by id

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#currencies

Arguments:

Currencies([]CurrenciesType)  // Optional. A list of currencies ids
PreferredNetwork(String) // Optional. Code of the default network of the currency

func (*Client) GetCurrency

func (client *Client) GetCurrency(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Currency, err error)

GetCurrency gets the data of a currency

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#currencies

Arguments:

Currency(string)  // A currency id

func (*Client) GetDepositCryptoAddressOfCurrency

func (client *Client) GetDepositCryptoAddressOfCurrency(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.CryptoAddress, err error)

func (*Client) GetDepositCryptoAddresses

func (client *Client) GetDepositCryptoAddresses(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.CryptoAddress, err error)

GetDepositCryptoAddresses gets a list of addresses with the current addresses of all currencies

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#deposit-crypto-address

func (*Client) GetEstimateWithdrawFee

func (client *Client) GetEstimateWithdrawFee(
	ctx context.Context,
	arguments ...args.Argument,
) (result string, err error)

GetEstimateWithdrawalFee gets an estimate of the withdrawal fee

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#estimate-withdraw-fee

Arguments:

Currency(string)  // the currency code for withdrawal
Amount(string)  // the expected withdraw amount
NetworkCode(String) // Optional. network code

func (*Client) GetEstimateWithdrawFees

func (client *Client) GetEstimateWithdrawFees(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.Fee, err error)

GetEstimateWithdrawalFees gets a list of estimates of the withdrawal fee of a currency

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#estimate-withdrawal-fees

Arguments:

FeeRequests([]FeeRequest) // the fees to request

func (*Client) GetLast10DepositCryptoAddresses

func (client *Client) GetLast10DepositCryptoAddresses(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.CryptoAddress, err error)

func (*Client) GetLast10WithdrawalCryptoAddresses

func (client *Client) GetLast10WithdrawalCryptoAddresses(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.CryptoAddress, err error)

func (*Client) GetOrderBookOfSymbol

func (client *Client) GetOrderBookOfSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.OrderBook, err error)

GetOrderBookOfSymbol get order book of a symbol

An Order Book is an electronic list of buy and sell orders for a specific symbol, structured by price level

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#order-books

Arguments:

Symbol(string)  // A symbol id
Depth(int)  // Optional. Order Book depth. Default value is 100. Set to 0 to view the full Order Book

func (*Client) GetOrderBookVolumeOfSymbol

func (client *Client) GetOrderBookVolumeOfSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.OrderBook, err error)

GetOrderBookVolumeOfSymbol get order book of a symbol with the desired volume for market depth search

An Order Book is an electronic list of buy and sell orders for a specific symbol, structured by price level

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#order-books

Arguments:

Symbol(string)  // A symbol id
Volume(string)  // Desired volume for market depth search

func (*Client) GetOrderbooks

func (client *Client) GetOrderbooks(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string]models.OrderBook, err error)

GetOrderBooks gets a map of orderbooks for all symbols or for the specified symbols

An Order Book is an electronic list of buy and sell orders for a specific symbol, structured by price level

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#order-books

Arguments:

Symbols([]string)  // Optional. A list of symbol ids
Depth(int)  // Optional. Order Book depth. Default value is 100. Set to 0 to view the full Order Book

func (*Client) GetPrices

func (client *Client) GetPrices(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string]models.Price, err error)

GetPrices gets a map of quotation prices of currencies

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#prices

Arguments:

To(string)  // Target currency code
From(string)  // Optional. Source currency rate

func (*Client) GetPricesHistory

func (client *Client) GetPricesHistory(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string]models.PriceHistory, err error)

GetPricesHistory get the quotation prices history

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#prices

Arguments:

To(string)  // Target currency code
From(string)  // Optional. Source currency rate
Period(PeriodType)  // Optional. A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month. Default is Period30Minutes
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
Since(string)  // Optional. Initial value of the queried interval. As Datetime
Until(string)  // Optional. Last value of the queried interval. As Datetime
Limit(int)  // Optional. Prices per currency pair. Defaul is 1. Min is 1. Max is 1000

func (*Client) GetSpotOrdersHistory

func (client *Client) GetSpotOrdersHistory(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.Order, err error)

GetSpotOrderHistory gets all the spot orders

Orders without executions are deleted after 24 hours

'from' param and 'till' param must have the same format, both id or both timestamp

Requires the "Orderbook, History, Trading balance" API key Access Right

https://api.exchange.cryptomkt.com/#spot-orders-history

Arguments:

Symbol(string)  // Optional. Filter orders by symbol
SortBy(SortByType)  // Optional. Sorting parameter. SortByID or SortByTimestamp. Default is SortByTimestamp
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
From(string)  // Optional. Initial value of the queried interval
Till(string)  // Optional. Last value of the queried interval
Limit(int)  // Optional. Prices per currency pair. Defaul is 100. Max is 1000
Offset(int)  // Optional. Default is 0. Max is 100000

func (*Client) GetSpotTradesHistory

func (client *Client) GetSpotTradesHistory(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.Trade, err error)

GetSpotTradesHistory gets the user's spot trading history

Requires the "Orderbook, History, Trading balance" API key Access Right

https://api.exchange.cryptomkt.com/#spot-trades-history

Arguments:

OrderID(string)  // Optional. Order unique identifier as assigned by the exchange
Symbol(string)  // Optional. Filter orders by symbol
SortBy(SortByType)  // Optional. Sorting parameter. SortByID or SortByTimestamp. Default is SortByTimestamp
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
From(string)  // Optional. Initial value of the queried interval
Till(string)  // Optional. Last value of the queried interval
Limit(int)  // Optional. Prices per currency pair. Defaul is 100. Max is 1000
Offset(int)  // Optional. Default is 0. Max is 100000

func (*Client) GetSpotTradingBalanceOfCurrency

func (client *Client) GetSpotTradingBalanceOfCurrency(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Balance, err error)

GetSpotTradingBalanceOfCurrency gets the user spot trading balance of a currency

Requires the "Orderbook, History, Trading balance" API key Access Right

https://api.exchange.cryptomkt.com/#get-spot-trading-balance

Arguments:

Currency(string)  // The currency code to query the balance

func (*Client) GetSpotTradingBalances

func (client *Client) GetSpotTradingBalances(
	ctx context.Context,
) (result []models.Balance, err error)

GetSpotTradingBalances gets the user's spot trading balance for all currencies with balance

Requires the "Orderbook, History, Trading balance" API key Access Right

https://api.exchange.cryptomkt.com/#get-spot-trading-balance

func (*Client) GetSubAccountBalances

func (client *Client) GetSubAccountBalances(
	ctx context.Context,
	arguments ...args.Argument,
) (result models.SubAccountBalances, err error)

GetSubAccountBalances Get the non-zero balances of a sub-account

Report will include the wallet and Trading balances.

Works independent of account state.

Requires the "Payment information" API key Access Right.

https://api.exchange.cryptomkt.com/#get-sub-account-balance

Arguments:

SubAccountID(string)  // id of the sub-account to get the balances

func (*Client) GetSubAccountCryptoAddress

func (client *Client) GetSubAccountCryptoAddress(
	ctx context.Context,
	arguments ...args.Argument,
) (result string, err error)

GetSubAccountCryptoAddress get the crypto address of the sub-account

Requires the "Payment information" API key Access Right.

https://api.exchange.cryptomkt.com/#get-sub-account-crypto-address

Arguments:

SubAccountID(string)  // the sub-account id
Currency(string)  // the currency code of the crypto address
NetworkCode(String) // Optional. network code

func (*Client) GetSubAccounts

func (client *Client) GetSubAccounts(
	ctx context.Context,
) (result []models.SubAccount, err error)

GetSubAccounts gets the list of sub-accounts

Requires no API key Access Rights.

https://api.exchange.cryptomkt.com/#get-sub-accounts-list

func (*Client) GetSymbol

func (client *Client) GetSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Symbol, err error)

GetSymbol gets a symbol by its id

A symbol is the combination of the base currency (first one) and quote currency (second one)

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#symbols

Arguments:

Symbol(string)  // A symbol id

func (*Client) GetSymbols

func (client *Client) GetSymbols(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string]models.Symbol, err error)

GetSymbols gets a map of all symbols or for specified symbols

A symbol is the combination of the base currency (first one) and quote currency (second one)

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#symbols

Arguments:

Symbols([]string)  // Optional. A list of symbol ids

func (*Client) GetTickerLastPrices

func (client *Client) GetTickerLastPrices(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string]models.Price, err error)

GetTickerLastPrices gets a map of the ticker's last prices for all symbols or for the specified symbols

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#prices

Arguments:

Symbols([]string)  // Optional. A list of symbol ids

func (*Client) GetTickerLastPricesOfSymbol

func (client *Client) GetTickerLastPricesOfSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Price, err error)

GetTickerLastPriceOfSymbol gets the ticker's last price of a symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#prices

Arguments:

Symbol(string)  // A symbol id

func (*Client) GetTickerOfSymbol

func (client *Client) GetTickerOfSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Ticker, err error)

GetTickerOfSymbol gets the ticker of a symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#tickers

Arguments:

Symbol(string)  // A symbol id

func (*Client) GetTickers

func (client *Client) GetTickers(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string]models.Ticker, err error)

GetTickers gets a map of tickers for all symbols or for specified symbols. indexed by symbol id

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#tickers

Arguments:

Symbols([]string)  // Optional. A list of symbol ids

func (*Client) GetTrades

func (client *Client) GetTrades(
	ctx context.Context,
	arguments ...args.Argument,
) (result map[string][]models.PublicTrade, err error)

GetTrades gets a map of trades for all symbols or for specified symbols. indexed by symbol

From param and Till param must have the same format, both id or both timestamp

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#trades

Arguments:

Symbols([]string)  // Optional. A list of symbol ids
SortBy(SortByType)  // Optional. Sorting parameter. SortByID or SortByTimestamp. Default is SortByTimestamp
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
From(string)  // Optional. Initial value of the queried interval
Till(string)  // Optional. Last value of the queried interval
Limit(int)  // Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000

func (*Client) GetTradesOfSymbol

func (client *Client) GetTradesOfSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.PublicTrade, err error)

GetTradesOfSymbol gets trades of a symbol

From param and Till param must have the same format, both index of both timestamp

https://api.exchange.cryptomarket.com/#trades

Arguments:

Symbol(string)  // A symbol id
SortBy(SortByType)  // Optional. Sorting parameter. SortByID or SortByTimestamp. Default is SortByTimestamp
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
Since(string)  // Optional. Initial value of the queried interval
Until(string)  // Optional. Last value of the queried interval
Limit(int)  // Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000
Offset(int)  // Optional. Default is 0. Min is 0. Max is 100000

func (*Client) GetTradingCommissionOfSymbol

func (client *Client) GetTradingCommissionOfSymbol(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.TradingCommission, err error)

GetTradingCommissionOfSymbol gets the personal trading commission rate of a symbol

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#get-trading-commission

Arguments:

Symbol(string)  // The symbol of the commission rate

func (*Client) GetTransaction

func (client *Client) GetTransaction(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Transaction, err error)

GetTransaction gets a transaction by its identifier

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#get-transactions-history

Arguments:

ID(string)  // The identifier of the transaction

func (*Client) GetTransactionHistory

func (client *Client) GetTransactionHistory(
	ctx context.Context,
	arguments ...args.Argument,
) (result []models.Transaction, err error)

GetTransactionHistory gets the transaction history of the account

Important:

  • The list of supported transaction types may be expanded in future versions

  • Some transaction subtypes are reserved for future use and do not purport to provide any functionality on the platform

  • The list of supported transaction subtypes may be expanded in future versions

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#get-transactions-history

Arguments:

TransactionIds([]string)  // Optional. List of transaction identifiers to query
TransactionTypes([]TransactionType)  // Optional. List of types to query. valid types are: TransactionDeposit, TransactionWithdraw, TransactionTransfer and TransactionSwap
TransactionSubTypes([]TransactionSubType)  // Optional. List of subtypes to query. valid subtypes are: TransactionSubTypeUnclassified, TransactionSubTypeBlockchain,  TransactionSubTypeAffiliate,  TransactionSubtypeOffchain, TransactionSubTypeFiat, TransactionSubTypeSubAccount, TransactionSubTypeWalletToSpot, TransactionSubTypeSpotToWallet, TransactionSubTypeChainSwitchFrom and TransactionSubTypeChainSwitchTo
TransactionStatuses([]TransactionStatusType)  // Optional. List of statuses to query. valid subtypes are: TransactionStatusCreated, TransactionStatusPending, TransactionStatusFailed, TransactionStatusSuccess and TransactionStatusRolledBack
SortBy(SortByType)  // Optional. sorting parameter. SortByCreatedAt or SortByID. Default is SortByCreatedAt
From(string)  // Optional. Interval initial value when ordering by CreatedAt. As Datetime.
Till(string)  // Optional. Interval end value when ordering by CreatedAt. As Datetime.
IDFrom(string)  // Optional. Interval initial value when ordering by id. Min is 0
IDTill(string)  // Optional. Interval end value when ordering by id. Min is 0
Sort(SortType)  // Optional. Sort direction. SortASC or SortDESC. Default is SortDESC
Limit(int)  // Optional. Transactions per query. Defaul is 100. Max is 1000
Offset(int)  // Optional. Default is 0. Max is 100000

func (*Client) GetWalletBalanceOfCurrency

func (client *Client) GetWalletBalanceOfCurrency(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Balance, err error)

GetWalletBalanceOfCurrency gets the user's wallet balance of a currency

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#wallet-balance

Arguments:

Currency(string)  // The currency code to query the balance

func (*Client) GetWalletBallances

func (client *Client) GetWalletBallances(
	ctx context.Context,
) (result []models.Balance, err error)

GetWalletBalance gets the user's wallet balance for all currencies with balance

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#wallet-balance

func (*Client) ReplaceSpotOrder

func (client *Client) ReplaceSpotOrder(
	ctx context.Context,
	arguments ...args.Argument,
) (result *models.Order, err error)

ReplaceSpotOrder replaces a spot order

For fee, for price accuracy and quantity, and for order status information see the api docs

Requires the "Place/cancel orders" API key Access Right

https://api.exchange.cryptomkt.com/#replace-spot-order

Arguments:

ClientOrderID(string)  // client order id of the old order
NewClientOrderID(string)  // client order id for the new order
Quantity(string)  // Order quantity
StrictValidate(bool)  // Price and quantity will be checked for incrementation within the symbol’s tick size and quantity step. See the symbol's TickSize and QuantityIncrement
Price(string)  // Required for OrderLimit, OrderStopLimit, or OrderTakeProfitLimit. Order price

func (*Client) TransferBetweenWalletAndExchange

func (client *Client) TransferBetweenWalletAndExchange(
	ctx context.Context,
	arguments ...args.Argument,
) (transactionID string, err error)

TransferBetweenWalletAndExchange Transfer funds between account types

Source param and Destination params must be different account types

Requires the "Payment information" API key Access Right

https://api.exchange.cryptomkt.com/#transfer-between-wallet-and-exchange

Arguments:

Currency(string)  // currency code for transfering
Amount(string)  // amount to be transfered
Source(AccountType)  // transfer source account type. Either AccountWallet or AccountSpot
Destination(AccountType)  // transfer source account type. Either AccountWallet or AccountSpot

func (*Client) TransferFunds

func (client *Client) TransferFunds(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

TransferFunds transfers funds from the super-account to a sub-account or from a sub-account to the super-account, and returns the transaction id

Requires the "Withdraw cryptocurrencies" API key Access Right

https://api.exchange.cryptomkt.com/#transfer-funds

Arguments:

SubAccountID(string)  // id of the sub-account to transfer with the super-account
Amount(string)  // amount of funds to transfer
Currency(string)  // currency of transfer
TransferType(TransferTypeType)  // TransferToSubAccount or TransferFromSubAccount

func (*Client) TransferMoneyToAnotherUser

func (client *Client) TransferMoneyToAnotherUser(
	ctx context.Context,
	arguments ...args.Argument,
) (result string, err error)

TransferMoneyToAnotherUser Transfer funds to another user

Requires the "Withdraw cryptocurrencies" API key Access Right

https://api.exchange.cryptomkt.com/#transfer-money-to-another-user

Arguments:

Currency(string)  // currency code
Amount(string)  // amount to be transfered
IdentifyBy(IdentifyByType)  // type of identifier. Either IdentifyByEmail or IdentifyByUsername
Identifier(string)  // the email or username of the recieving user

func (*Client) WithdrawCryptoCommit

func (client *Client) WithdrawCryptoCommit(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

WithdrawCryptoCommit commits a withdrawal

Requires the "Withdraw cryptocurrencies" API key Access Right

https://api.exchange.cryptomkt.com/#withdraw-crypto-commit-or-rollback

Arguments:

ID(string)  // the withdrawal transaction identifier

func (*Client) WithdrawCryptoRollback

func (client *Client) WithdrawCryptoRollback(
	ctx context.Context,
	arguments ...args.Argument,
) (result bool, err error)

WithdrawCryptoRollback Rollback a withdrawal

Requires the "Withdraw cryptocurrencies" API key Access Right

https://api.exchange.cryptomkt.com/#withdraw-crypto-commit-or-rollback

Arguments:

ID(string)  // the withdrawal transaction identifier

type RequestData

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

Jump to

Keyboard shortcuts

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