websocket

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 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 MarketDataClient

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

PublicClient connects via websocket to cryptomarket to get market information of the exchange.

func NewMarketDataClient

func NewMarketDataClient() (*MarketDataClient, error)

NewPublicClient returns a new chan client if the connection with the cryptomarket server is successful, and error otherwise.

Subscriptions reuse channels between symbols if there are any already. different speeds and depths means diferent channels. e.g. a subscription for the tickers of ETHBTC at speed '3s' uses the same channel that a new subscription for the tickers of XLMETH at speed '3s', while a new subscription is used for a new subscription for the tickers of USDTBTC at speed '1s'

Unsubscriptions only closes the relevant channel, and does not make the server stop recieving the subscription data it is safe to unsubscribe to an unsubscribed channel

func (*MarketDataClient) Close

func (client *MarketDataClient) Close()

Close closes all the channels related to the client as well as the websocket connection. trying to make requests over a closed client may result in error.

func (*MarketDataClient) GetActiveSubscriptions

func (client *MarketDataClient) GetActiveSubscriptions(
	ctx context.Context,
	arguments ...args.Argument,
) ([]string, error)

func (*MarketDataClient) SubscribeToCandles

func (client *MarketDataClient) SubscribeToCandles(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSCandleFeed], err error)

SubscribeToCandles subscribe to a feed of candles

subscription is only for the specified symbols

normal subscriptions have one update message per symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-candles

Arguments:

Period(PeriodType)  // A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month.
Symbols([]string)  // Optional. A list of symbol ids
Limit(int64)  // Number of historical entries returned in the first feed. Min is 0. Max is 1000. Default is 0

func (*MarketDataClient) SubscribeToConvertedCandles added in v3.1.1

func (client *MarketDataClient) SubscribeToConvertedCandles(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSCandleFeed], err error)

SubscribeToConvertedCandles subscribes to a feed of candles regarding the last price converted to the target currency for the specified symbols

subscription is only for the specified symbols

Candles are used for OHLC representation

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

Conversion from the symbol quote currency to the target currency is the mean of "best" bid price and "best" ask price in the order book. If there is no "best" bid of ask price, the last price is returned.

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-converted-candles

Arguments:

TargetCurrency(string)  // Target currency for conversion
Symbols([]string)  // A list of symbol ids. If empty then gets for all symbols
Period(PeriodType)  // A valid tick interval. Period1Minute, Period3Minutes, Period5Minutes, Period15Minutes, Period30Minutes, Period1Hour, Period4Hours, Period1Day, Period7Days, Period1Month.
Limit(int)  // Optional. Prices per currency pair. Defaul is 10. Min is 1. Max is 1000

func (*MarketDataClient) SubscribeToFullOrderbook

func (client *MarketDataClient) SubscribeToFullOrderbook(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSOrderbookFeed], err error)

SubscribeToFullOrderbook subscribe to a feed of a full orderbook

subscription is only for the specified symbols

normal subscriptions have one update message per symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-full-order-book

Arguments:

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

func (*MarketDataClient) SubscribeToMiniTicker

func (client *MarketDataClient) SubscribeToMiniTicker(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.MiniTickerFeed], err error)

SubscribeToMiniTicker subscribe to a feed of mini tickers

subscription is for the specified symbols

normal subscriptions have one update message per symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-mini-ticker

Arguments:

TickerSpeed(TickerSpeedType)  // The speed of the feed. TickerSpeed1s or TickerSpeed3s
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToMiniTickerInBatches

func (client *MarketDataClient) SubscribeToMiniTickerInBatches(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.MiniTickerFeed], err error)

SubscribeToMiniTickerInBatches subscribe to a feed of mini tickers

subscription is for all symbols or for the specified symbols

batch subscriptions have a joined update for all symbols

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-mini-ticker-in-batches

Arguments:

TickerSpeed(TickerSpeedType)  // The speed of the feed. TickerSpeed1s or TickerSpeed3s
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToOrderbookTop

func (client *MarketDataClient) SubscribeToOrderbookTop(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.OrderbookTopFeed], err error)

SubscribeToTopOfOrderbook subscribe to a feed of the top of the orderbook

subscription is for all symbols or for the specified symbols

normal subscriptions have one update message per symbol

https://api.exchange.cryptomkt.com/#subscribe-to-top-of-book

Arguments:

OrderBookSpeed(OrderBookSpeedType)  // The speed of the feed. OrderBookSpeedType100ms, OrderBookSpeedType500ms or OrderBookSpeedType1000ms
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToOrderbookTopInBatches added in v3.1.1

func (client *MarketDataClient) SubscribeToOrderbookTopInBatches(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.OrderbookTopFeed], err error)

SubscribeToTopOfOrderbookInBatches subscribe to a feed of the top of the orderbook

subscription is for all symbols or for the specified symbols

batch subscriptions have a joined update for all symbols

https://api.exchange.cryptomkt.com/#subscribe-to-top-of-book-in-batches

Arguments:

OrderBookSpeed(OrderBookSpeedType)  // The speed of the feed. OrderBookSpeedType100ms, OrderBookSpeedType500ms or OrderBookSpeedType1000ms
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToPartialOrderbook

func (client *MarketDataClient) SubscribeToPartialOrderbook(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSOrderbookFeed], err error)

SubscribeToPartialOrderbook subscribe to a feed of a partial orderbook

subscription is for all symbols or for the specified symbols

normal subscriptions have one update message per symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-partial-order-book

Arguments:

OrderBookSpeed(OrderBookSpeedType)  // The speed of the feed. OrderBookSpeedType100ms, OrderBookSpeedType500ms or OrderBookSpeedType1000ms
WSDepth(WSDepthType)  // The depth of the partial orderbook, WSDepth5, WSDepth10 or WSDepth20
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToPartialOrderbookInBatches added in v3.1.1

func (client *MarketDataClient) SubscribeToPartialOrderbookInBatches(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSOrderbookFeed], err error)

SubscribeToPartialOrderbookInBatches subscribe to a feed of a partial orderbook in batches

subscription is for all symbols or for the specified symbols

batch subscriptions have a joined update for all symbols

https://api.exchange.cryptomkt.com/#subscribe-to-partial-order-book-in-batches

Arguments:

OrderBookSpeed(OrderBookSpeedType)  // The speed of the feed. OrderBookSpeedType100ms, OrderBookSpeedType500ms or OrderBookSpeedType1000ms
WSDepth(WSDepthType)  // The depth of the partial orderbook, WSDepth5, WSDepth10 or WSDepth20
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToPriceRates

func (client *MarketDataClient) SubscribeToPriceRates(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.PriceFeed], err error)

SubscribeToPriceRates subscribe to a feed of price rates.

subscription is for all currencies or specified currencies (bases), against a target currency (quote). indexed by currency id (bases)

https://api.exchange.cryptomkt.com/#subscribe-to-price-rates

Arguments:

PriceRateSpeed(TickerSpeedType)  // The speed of the feed. PriceRateSpeed1s or PriceRateSpeed3s
Currencies([]string)  // Optional. A list of currencies ids for the base currencies for the price rates
TargetCurrency(string) quote currency for the price rates

func (*MarketDataClient) SubscribeToPriceRatesInBatches added in v3.1.1

func (client *MarketDataClient) SubscribeToPriceRatesInBatches(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.PriceFeed], err error)

SubscribeToPriceRates subscribe to a feed of price rates.

subscription is for all currencies or specified currencies (bases), against a target currency (quote). indexed by currency id (bases)

batch subscriptions have a joined update for all currencies

https://api.exchange.cryptomkt.com/#subscribe-to-price-rates

Arguments:

PriceRateSpeed(TickerSpeedType)  // The speed of the feed. PriceRateSpeed1s or PriceRateSpeed3s
Currencies([]string)  // Optional. A list of currencies ids for the base currencies for the price rates
TargetCurrency(string) quote currency for the price rates

func (*MarketDataClient) SubscribeToTicker

func (client *MarketDataClient) SubscribeToTicker(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSTickerFeed], err error)

SubscribeToTicker subscribe to a feed of tickers

subscription is for all symbols or for the specified symbols

normal subscriptions have one update message per symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-ticker

Arguments:

TickerSpeed(TickerSpeedType)  // The speed of the feed. TickerSpeed1s or TickerSpeed3s
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToTickerInBatches

func (client *MarketDataClient) SubscribeToTickerInBatches(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSTickerFeed], err error)

SubscribeToTickerInBatches subscribe to a feed of tickers

subscription is for all symbols or for the specified symbols

batch subscriptions have a joined update for all symbols

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-ticker-in-batches

Arguments:

TickerSpeed(TickerSpeedType)  // The speed of the feed. TickerSpeed1s or TickerSpeed3s
Symbols([]string)  // Optional. A list of symbol ids

func (*MarketDataClient) SubscribeToTrades

func (client *MarketDataClient) SubscribeToTrades(
	arguments ...args.Argument,
) (subscription *models.Subscription[models.WSTradeFeed], err error)

SubscribeToTrades subscribe to a feed of trades

subscription is only for the specified symbols

normal subscriptions have one update message per symbol

Requires no API key Access Rights

https://api.exchange.cryptomkt.com/#subscribe-to-trades

Arguments:

Symbols([]string)  // Optional. A list of symbol ids
Limit(int64)  // Number of historical entries returned in the first feed. Min is 0. Max is 1000. Default is 0

func (*MarketDataClient) UnsubscribeTo

func (client *MarketDataClient) UnsubscribeTo(notificationChannel string)

UnsubscribeTo closes the receiving channel of a subscription, given his NorificationChannel name. Further messages recieved from the server on the corresponding channel will be droped.

type SpotTradingClient

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

SpotTradingClient connects via websocket to cryptomarket to enable the user to manage orders. uses SHA256 as auth method and authenticates automatically.

func NewSpotTradingClient

func NewSpotTradingClient(apiKey, apiSecret string, window int) (*SpotTradingClient, error)

NewSpotTradingClient returns a new spot trading client if the connection with the cryptomarket server is successful and if the authentication is successfull. return error otherwise. Arguments:

apiKey // The API key
apiSecret // The API secret
window // Maximum difference between the creation of the request and the moment of request processing in milliseconds. Max is 60_000. Defaul is 10_000 (use 0 as argument for default)

func (*SpotTradingClient) CancelAllSpotOrders

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

CancelAllSpotOrders cancel all active spot orders and returns the ones that could not be canceled

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

func (*SpotTradingClient) CancelSpotOrder

func (client *SpotTradingClient) CancelSpotOrder(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.Report, error)

CancelSpotOrders cancels a spot order

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

Arguments:

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

func (*SpotTradingClient) Close

func (client *SpotTradingClient) Close()

Close closes all the channels related to the client as well as the websocket connection. trying to make requests over a closed client may result in error.

func (*SpotTradingClient) CreateSpotOrder

func (client *SpotTradingClient) CreateSpotOrder(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.Report, error)

CreateSpotOrder creates a new spot order

For fee, for price accuracy and quantity, and for order status information see the api docs at https://api.exchange.cryptomkt.com/#create-new-spot-order

https://api.exchange.cryptomkt.com/#place-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 (*SpotTradingClient) CreateSpotOrderList

func (client *SpotTradingClient) CreateSpotOrderList(
	ctx context.Context,
	arguments ...args.Argument,
) ([]models.Report, error)

CreateSpotOrderList creates a list of spot orders and returns a list of reports of the created 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:

OrderListID(string)  // order list identifier. If ommited, it will be generated by the system. Must be equal to the client order id of the first order in the request
Contingency(ContingencyType)  // order list type. ContingencyAON, ContingencyOCO or ContingencyOTOCO
Orders([]Order)  // the list of orders, orders from the args package

func (*SpotTradingClient) GetActiveSpotOrders

func (client *SpotTradingClient) GetActiveSpotOrders(
	ctx context.Context,
) ([]models.Report, error)

GetActiveSpotOrders gets the user's active spot orders

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

func (*SpotTradingClient) GetSpotFee

func (client *SpotTradingClient) GetSpotFee(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.TradingCommission, error)

GetTradingCommissionOfSymbol gets the personal trading commission rate of a symbol

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

Arguments:

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

func (*SpotTradingClient) GetSpotTradingBalance added in v3.1.1

func (client *SpotTradingClient) GetSpotTradingBalance(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.Balance, error)

GetSpotTradingBalance is an alias of GetSpotTradingBalanceOfCurrency

func (*SpotTradingClient) GetSpotTradingBalanceByCurrency added in v3.1.1

func (client *SpotTradingClient) GetSpotTradingBalanceByCurrency(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.Balance, error)

GetSpotTradingBalanceByCurrency is an alias of GetSpotTradingBalanceOfCurrency

func (*SpotTradingClient) GetSpotTradingBalanceOfCurrency

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

GetSpotTradingBalanceOfCurrency gets the user spot trading balance of a currency

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

Arguments:

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

func (*SpotTradingClient) GetSpotTradingBalances

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

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

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

func (*SpotTradingClient) GetSpotTradingFee added in v3.1.1

func (client *SpotTradingClient) GetSpotTradingFee(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.TradingCommission, error)

func (*SpotTradingClient) GetTradingCommissions

func (client *SpotTradingClient) GetTradingCommissions(
	ctx context.Context,
) ([]models.TradingCommission, error)

GetTradingCommissions gets the personal trading commission rates for all symbols

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

func (*SpotTradingClient) ReplaceSpotOrder

func (client *SpotTradingClient) ReplaceSpotOrder(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.Report, error)

ReplaceSpotOrder changes the parameters of an existing order, quantity or price

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

Arguments:

ClientOrderID(string)  // the client order id of the order to change
NewClientOrderID(string)  // the new client order id for the modified order. must be unique within the trading day
Quantity(string)  // new order quantity
Price(string)  // new order price
StrictValidate(bool)  //  price and quantity will be checked for the incrementation with tick size and quantity step. See symbol's tick_size and quantity_increment

func (*SpotTradingClient) SubscribeToReports

func (client *SpotTradingClient) SubscribeToReports() (notificationCh chan models.Notification[[]models.Report], err error)

SubscribeToReports subscribe to a feed of execution reports of the user's orders

recieves a snapshot and updates notifications

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

func (*SpotTradingClient) SubscribeToSpotBalance

func (client *SpotTradingClient) SubscribeToSpotBalance(arguments ...args.Argument) (notificationCh chan models.Notification[[]models.Balance], err error)

Subscribes to the user's balances.

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

https://api.exchange.cryptomkt.com/#subscribe-to-spot-balances

Arguments:

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

func (*SpotTradingClient) UnsubscribeToReports

func (client *SpotTradingClient) UnsubscribeToReports() (err error)

UnsubscribeToReports stop recieveing the report feed subscription

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

func (*SpotTradingClient) UnsubscribeToSpotBalance

func (client *SpotTradingClient) UnsubscribeToSpotBalance() (err error)

Unubscribes to the user's balances.

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

https://api.exchange.cryptomkt.com/#subscribe-to-spot-balances

type WalletManagementClient

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

func NewWalletManagementClient

func NewWalletManagementClient(apiKey, apiSecret string, window int) (*WalletManagementClient, error)

NewWalletManagementClient returns a new wallet client if the connection with the cryptomarket server is successful and if the authentication is successful. return error otherwise. Arguments:

apiKey // The API key
apiSecret // The API secret
window // Maximum difference between the creation of the request and the moment of request processing in milliseconds. Max is 60_000. Defaul is 10_000 (use 0 as argument for default)

func (*WalletManagementClient) Close

func (client *WalletManagementClient) Close()

Close closes all the channels related to the client as well as the websocket connection. trying to make requests over a closed client may result in error.

func (*WalletManagementClient) GetTransactions

func (client *WalletManagementClient) GetTransactions(
	ctx context.Context,
	arguments ...args.Argument,
) ([]models.Transaction, error)

GetTransactions gets the transactions 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

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

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
OrderBy(OrderByType)  // Optional. sorting parameter. OrderByID, OrderByCreatedAt, OrderByUpdateAt or OrderByLastActivityAt. Default is OrderByCreatedAt
From(string)  // Optional. Optional. Interval initial value (inclusive). The value type depends on orderBy
Till(string)  // Optional. Interval end value (inclusive). The value type depends on orderBy
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(int64)  // Optional. Transactions per query. Defaul is 100. Max is 1000
Offset(int64)  // Optional. Default is 0. Max is 100000

func (*WalletManagementClient) GetWalletBalance added in v3.1.1

func (client *WalletManagementClient) GetWalletBalance(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.Balance, error)

GetWalletBalance is an alias of GetWalletBalanceOfCurrency

func (*WalletManagementClient) GetWalletBalanceByCurrency added in v3.1.1

func (client *WalletManagementClient) GetWalletBalanceByCurrency(
	ctx context.Context,
	arguments ...args.Argument,
) (*models.Balance, error)

GetWalletBalanceByCurrency is an alias of GetWalletBalanceOfCurrency

func (*WalletManagementClient) GetWalletBalanceOfCurrency

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

GetWalletBalanceOfCurrency gets the user's wallet balance of a currency

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

Arguments:

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

func (*WalletManagementClient) GetWalletBalances

func (client *WalletManagementClient) GetWalletBalances(
	ctx context.Context,
) ([]models.Balance, error)

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

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

func (*WalletManagementClient) SubscribeToTransactions

func (client *WalletManagementClient) SubscribeToTransactions() (notificationCh chan models.Notification[models.Transaction], err error)

SubscribeToTransactions A transaction notification occurs each time a transaction has been changed, such as creating a transaction, updating the pending state (e.g., the hash assigned) or completing a transaction

this subscriptions only sends updates, no snapshot, with a transaction

https://api.exchange.cryptomkt.com/#subscribe-to-transactions

func (*WalletManagementClient) SubscribeToWalletBalances

func (client *WalletManagementClient) SubscribeToWalletBalances() (notificationCh chan models.Notification[[]models.Balance], err error)

SubscribeToWalletBalances subscribe to a feed of the user's wallet balances

only non-zero values are present

the subscriptions sends a snapshot for with all balances and one update with one balance at a time

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

func (*WalletManagementClient) UnsubscribeToTransactions

func (client *WalletManagementClient) UnsubscribeToTransactions() error

UnsubscribeToTransactions stop recieving the feed of transactions changes

https://api.exchange.cryptomkt.com/#subscribe-to-transactions

func (*WalletManagementClient) UnsubscribeToWalletBalances

func (client *WalletManagementClient) UnsubscribeToWalletBalances() error

UnsubscribeToWalletBalances stop recieving the feed of balances changes

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

Jump to

Keyboard shortcuts

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