binanceus

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: MIT Imports: 37 Imported by: 0

README

GoCryptoTrader package Binanceus

Build Status Software License GoDoc Coverage Status Go Report Card

This binanceus package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Binanceus Exchange

Current Features
  • REST Support
  • Websocket Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var b exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "Binanceus" {
		b = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
	// Handle error
}
How to do Websocket public/private calls
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

View Source
const (
	EmailSent = iota
	Cancelled
	AwaitingApproval
	Rejected
	Processing
	Failure
	Completed
)

crypto withdrawals status codes description

Variables

View Source
var (
	// BinanceRequestParamsOrderLimit Limit order
	BinanceRequestParamsOrderLimit = RequestParamsOrderType("LIMIT")
	// BinanceRequestParamsOrderMarket Market order
	BinanceRequestParamsOrderMarket = RequestParamsOrderType("MARKET")
	// BinanceRequestParamsOrderStopLoss STOP_LOSS
	BinanceRequestParamsOrderStopLoss = RequestParamsOrderType("STOP_LOSS")
	// BinanceRequestParamsOrderStopLossLimit STOP_LOSS_LIMIT
	BinanceRequestParamsOrderStopLossLimit = RequestParamsOrderType("STOP_LOSS_LIMIT")
	// BinanceRequestParamsOrderTakeProfit TAKE_PROFIT
	BinanceRequestParamsOrderTakeProfit = RequestParamsOrderType("TAKE_PROFIT")
	// BinanceRequestParamsOrderTakeProfitLimit TAKE_PROFIT_LIMIT
	BinanceRequestParamsOrderTakeProfitLimit = RequestParamsOrderType("TAKE_PROFIT_LIMIT")
	// BinanceRequestParamsOrderLimitMarker LIMIT_MAKER
	BinanceRequestParamsOrderLimitMarker = RequestParamsOrderType("LIMIT_MAKER")
)
View Source
var (
	// BinanceRequestParamsTimeGTC GTC
	BinanceRequestParamsTimeGTC = RequestParamsTimeForceType("GTC")

	// BinanceRequestParamsTimeIOC IOC
	BinanceRequestParamsTimeIOC = RequestParamsTimeForceType("IOC")

	// BinanceRequestParamsTimeFOK FOK
	BinanceRequestParamsTimeFOK = RequestParamsTimeForceType("FOK")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	MakerCommission  int64     `json:"makerCommission"`
	TakerCommission  int64     `json:"takerCommission"`
	BuyerCommission  int64     `json:"buyerCommission"`
	SellerCommission int64     `json:"sellerCommission"`
	CanTrade         bool      `json:"canTrade"`
	CanWithdraw      bool      `json:"canWithdraw"`
	CanDeposit       bool      `json:"canDeposit"`
	UpdateTime       time.Time `json:"updateTime"`
	AccountType      string    `json:"accountType"`
	Balances         []Balance `json:"balances"`
	Permissions      []string  `json:"permissions"`
}

Account holds the account data

func (*Account) UnmarshalJSON

func (a *Account) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type AccountStatusResponse

type AccountStatusResponse struct {
	Msg     string   `json:"msg"`
	Success bool     `json:"success"`
	Objs    []string `json:"objs,omitempty"`
}

AccountStatusResponse holds information related to the User Account status information request

type AggregatedTrade

type AggregatedTrade struct {
	ATradeID       int64     `json:"a"`
	Price          float64   `json:"p,string"`
	Quantity       float64   `json:"q,string"`
	FirstTradeID   int64     `json:"f"`
	LastTradeID    int64     `json:"l"`
	TimeStamp      time.Time `json:"T"`
	Maker          bool      `json:"m"`
	BestMatchPrice bool      `json:"M"`
}

AggregatedTrade holds aggregated trade information

func (*AggregatedTrade) UnmarshalJSON

func (a *AggregatedTrade) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type AggregatedTradeRequestParams

type AggregatedTradeRequestParams struct {
	Symbol currency.Pair // Required field; example LTCBTC, BTCUSDT
	// The first trade to retrieve
	FromID int64
	// The API seems to accept (start and end time) or FromID and no other combinations
	StartTime int64
	EndTime   int64
	// Default 500; max 1000.
	Limit int
}

AggregatedTradeRequestParams holds request params

type AssetDistributionHistories

type AssetDistributionHistories struct {
	Rows  []AssetHistory `json:"rows"`
	Total uint64         `json:"total"`
}

AssetDistributionHistories this endpoint to query asset distribution records, including for staking, referrals and airdrops etc.

type AssetHistory

type AssetHistory struct {
	Amount  float64 `json:"amount,string"` // Amount
	Asset   string  `json:"asset"`         // Asset Type eg. BHFT
	DivTime uint64  `json:"divTime"`       // DivTime
	EnInfo  string  `json:"enInfo"`        //
	TranID  uint64  `json:"tranId"`        // Transaction ID
}

AssetHistory holds the asset type and translation info

type AssetInfo

type AssetInfo struct {
	Asset  string `json:"asset"`
	Free   uint64 `json:"free"`
	Locked uint64 `json:"locked"`
}

AssetInfo holds asset information

type AssetWalletDetail

type AssetWalletDetail struct {
	Coin              string `json:"coin"`
	DepositAllEnable  bool   `json:"depositAllEnable"`
	WithdrawAllEnable bool   `json:"withdrawAllEnable"`
	Name              string `json:"name"`
	Free              string `json:"free"`
	Locked            string `json:"locked"`
	Freeze            string `json:"freeze"`
	Withdrawing       string `json:"withdrawing"`
	Ipoing            string `json:"ipoing"`
	Ipoable           string `json:"ipoable"`
	Storage           string `json:"storage"`
	IsLegalMoney      bool   `json:"isLegalMoney"`
	Trading           bool   `json:"trading"`
	NetworkList       []struct {
		Network                 string  `json:"network"`
		Coin                    string  `json:"coin"`
		WithdrawIntegerMultiple string  `json:"withdrawIntegerMultiple"`
		IsDefault               bool    `json:"isDefault"`
		DepositEnable           bool    `json:"depositEnable"`
		WithdrawEnable          bool    `json:"withdrawEnable"`
		DepositDesc             string  `json:"depositDesc"`
		WithdrawDesc            string  `json:"withdrawDesc"`
		Name                    string  `json:"name"`
		ResetAddressStatus      bool    `json:"resetAddressStatus"`
		WithdrawFee             float64 `json:"withdrawFee,string"`
		WithdrawMin             float64 `json:"withdrawMin,string"`
		WithdrawMax             float64 `json:"withdrawMax,string"`
		AddressRegex            string  `json:"addressRegex,omitempty"`
		MemoRegex               string  `json:"memoRegex,omitempty"`
		MinConfirm              int64   `json:"minConfirm,omitempty"`
		UnLockConfirm           int64   `json:"unLockConfirm,omitempty"`
	} `json:"networkList"`
}

AssetWalletDetail represents the wallet asset information.

type AssetWalletList

type AssetWalletList []AssetWalletDetail

AssetWalletList list of asset wallet details

type AveragePrice

type AveragePrice struct {
	Mins  int64   `json:"mins"`
	Price float64 `json:"price,string"`
}

AveragePrice holds current average symbol price

type Balance

type Balance struct {
	Asset  string          `json:"asset"`
	Free   decimal.Decimal `json:"free"`
	Locked decimal.Decimal `json:"locked"`
}

Balance holds query order data

type BestPrice

type BestPrice struct {
	Symbol   string  `json:"symbol"`
	BidPrice float64 `json:"bidPrice,string"`
	BidQty   float64 `json:"bidQty,string"`
	AskPrice float64 `json:"askPrice,string"`
	AskQty   float64 `json:"askQty,string"`
}

BestPrice holds best price data

type Binanceus

type Binanceus struct {
	exchange.Base
	// contains filtered or unexported fields
}

Binanceus is the overarching type across this package

func (*Binanceus) CancelAllOrders

func (bi *Binanceus) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*Binanceus) CancelBatchOrders

func (bi *Binanceus) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)

CancelBatchOrders cancels orders by their corresponding ID numbers

func (*Binanceus) CancelExistingOrder

func (bi *Binanceus) CancelExistingOrder(ctx context.Context, arg *CancelOrderRequestParams) (*Order, error)

CancelExistingOrder to cancel an active trade order.

func (*Binanceus) CancelOCOOrder

CancelOCOOrder to cancel an entire order list.

func (*Binanceus) CancelOpenOrdersForSymbol

func (bi *Binanceus) CancelOpenOrdersForSymbol(ctx context.Context, symbol string) ([]Order, error)

CancelOpenOrdersForSymbol request to cancel an open orders.

func (*Binanceus) CancelOrder

func (bi *Binanceus) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*Binanceus) CheckLimit

func (bi *Binanceus) CheckLimit(limit int64) error

CheckLimit checks value against a variable list

func (*Binanceus) CloseUserDataStream

func (bi *Binanceus) CloseUserDataStream(ctx context.Context) error

CloseUserDataStream Close out a user data stream.

func (*Binanceus) CreateNewOCOOrder

func (bi *Binanceus) CreateNewOCOOrder(ctx context.Context, arg *OCOOrderInputParams) (*OCOFullOrderResponse, error)

CreateNewOCOOrder o place a new OCO(one-cancels-the-other) order.

func (*Binanceus) DepositHistory

func (bi *Binanceus) DepositHistory(ctx context.Context, c currency.Code, status uint8, startTime, endTime time.Time, offset, limit int) ([]DepositHistory, error)

DepositHistory returns the deposit history based on the supplied params status `param` used as string to prevent default value 0 (for int) interpreting as EmailSent status

func (*Binanceus) ExecuteSubAccountTransfer

func (bi *Binanceus) ExecuteSubAccountTransfer(ctx context.Context, arg *SubAccountTransferRequestParams) (*SubAccountTransferResponse, error)

ExecuteSubAccountTransfer to execute sub-account asset transfers.

func (*Binanceus) FetchAccountInfo

func (bi *Binanceus) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*Binanceus) FetchOrderbook

func (bi *Binanceus) FetchOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*Binanceus) FetchTicker

func (bi *Binanceus) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*Binanceus) FetchTradablePairs

func (bi *Binanceus) FetchTradablePairs(ctx context.Context, a asset.Item) (currency.Pairs, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*Binanceus) FiatDepositHistory

func (bi *Binanceus) FiatDepositHistory(ctx context.Context, arg *FiatWithdrawalRequestParams) (FiatAssetsHistory, error)

FiatDepositHistory fetch your fiat (USD) deposit history as Fiat Assets History

func (*Binanceus) FiatWithdrawalHistory

func (bi *Binanceus) FiatWithdrawalHistory(ctx context.Context, arg *FiatWithdrawalRequestParams) (FiatAssetsHistory, error)

FiatWithdrawalHistory to fetch your fiat (USD) withdrawal history. returns FiatAssetHistory containing list of fiat asset records.

func (*Binanceus) GenerateSubscriptions

func (bi *Binanceus) GenerateSubscriptions() ([]subscription.Subscription, error)

GenerateSubscriptions generates the default subscription set

func (*Binanceus) GetAccount

func (bi *Binanceus) GetAccount(ctx context.Context) (*Account, error)

GetAccount returns binance user accounts

func (*Binanceus) GetAccountFundingHistory

func (bi *Binanceus) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)

GetAccountFundingHistory returns funding history, deposits and withdrawals

func (*Binanceus) GetActiveOrders

func (bi *Binanceus) GetActiveOrders(ctx context.Context, getOrdersRequest *order.MultiOrderRequest) (order.FilteredOrders, error)

GetActiveOrders retrieves any orders that are active/open

func (*Binanceus) GetAggregateTrades

func (bi *Binanceus) GetAggregateTrades(ctx context.Context, agg *AggregatedTradeRequestParams) ([]AggregatedTrade, error)

GetAggregateTrades to get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.

func (*Binanceus) GetAllOCBSTradeOrders

func (bi *Binanceus) GetAllOCBSTradeOrders(ctx context.Context, arg OCBSOrderRequestParams) (*OCBSTradeOrdersResponse, error)

GetAllOCBSTradeOrders use this endpoint to query all OCBS orders by condition.

func (*Binanceus) GetAllOCOOrder

func (bi *Binanceus) GetAllOCOOrder(ctx context.Context, arg *OCOOrdersRequestParams) ([]OCOOrderResponse, error)

GetAllOCOOrder to retrieve all OCO orders based on provided optional parameters. Please note the maximum limit is 1,000 orders.

func (*Binanceus) GetAllOTCTradeOrders

func (bi *Binanceus) GetAllOTCTradeOrders(ctx context.Context, arg *OTCTradeOrderRequestParams) ([]OTCTradeOrder, error)

GetAllOTCTradeOrders returns list of OTC Trade Orders

func (*Binanceus) GetAllOpenOrders

func (bi *Binanceus) GetAllOpenOrders(ctx context.Context, symbol string) ([]Order, error)

GetAllOpenOrders to get all open trade orders on a token symbol. Do not access this without a token symbol as this would return all pair data.

func (*Binanceus) GetAssetDistributionHistory

func (bi *Binanceus) GetAssetDistributionHistory(ctx context.Context, asset string, startTime, endTime uint64, recvWindow uint) (*AssetDistributionHistories, error)

GetAssetDistributionHistory this endpoint to query asset distribution records, including for staking, referrals and airdrops etc.

INPUTS: asset: string , startTime & endTime unix time in Milli seconds, recvWindow(duration in milli seconds > 2000 to < 6000)

func (*Binanceus) GetAssetFeesAndWalletStatus

func (bi *Binanceus) GetAssetFeesAndWalletStatus(ctx context.Context) (AssetWalletList, error)

GetAssetFeesAndWalletStatus to fetch the details of all crypto assets, including fees, withdrawal limits and network status. returns the asset wallet detail as a list.

func (*Binanceus) GetAvailableTransferChains

func (bi *Binanceus) GetAvailableTransferChains(ctx context.Context, cryptocurrency currency.Code) ([]string, error)

GetAvailableTransferChains returns the available transfer blockchains for the specific cryptocurrency

func (*Binanceus) GetAveragePrice

func (bi *Binanceus) GetAveragePrice(ctx context.Context, symbol currency.Pair) (AveragePrice, error)

GetAveragePrice returns current average price for a symbol.

symbol: string of currency pair

func (*Binanceus) GetBestPrice

func (bi *Binanceus) GetBestPrice(ctx context.Context, symbol currency.Pair) (BestPrice, error)

GetBestPrice returns the latest best price for symbol symbol: string of currency pair

func (*Binanceus) GetCurrencyTradeURL

func (bi *Binanceus) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)

GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair

func (*Binanceus) GetDepositAddress

func (bi *Binanceus) GetDepositAddress(ctx context.Context, c currency.Code, _, chain string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*Binanceus) GetDepositAddressForCurrency

func (bi *Binanceus) GetDepositAddressForCurrency(ctx context.Context, currency, chain string) (*DepositAddress, error)

GetDepositAddressForCurrency retrieves the wallet address for a given currency

func (*Binanceus) GetExchangeInfo

func (bi *Binanceus) GetExchangeInfo(ctx context.Context) (ExchangeInfo, error)

GetExchangeInfo to get the current exchange trading rules and trading pair information.

func (*Binanceus) GetFee

func (bi *Binanceus) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee to fetch trading fees.

func (*Binanceus) GetFeeByType

func (bi *Binanceus) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on the type of transaction

func (*Binanceus) GetFuturesContractDetails

func (bi *Binanceus) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)

GetFuturesContractDetails returns all contracts from the exchange by asset type

func (*Binanceus) GetHistoricCandles

func (bi *Binanceus) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*Binanceus) GetHistoricCandlesExtended

func (bi *Binanceus) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*Binanceus) GetHistoricTrades

func (bi *Binanceus) GetHistoricTrades(ctx context.Context, p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*Binanceus) GetHistoricalTrades

func (bi *Binanceus) GetHistoricalTrades(ctx context.Context, hist HistoricalTradeParams) ([]HistoricalTrade, error)

GetHistoricalTrades returns historical trade activity symbol: string of currency pair limit: Optional. Default 500; max 1000.

func (*Binanceus) GetIntervalEnum

func (bi *Binanceus) GetIntervalEnum(interval kline.Interval) string

GetIntervalEnum allowed interval params by Binanceus

func (*Binanceus) GetLatestFundingRates

GetLatestFundingRates returns the latest funding rates data

func (*Binanceus) GetMasterAccountTotalUSDValue

func (bi *Binanceus) GetMasterAccountTotalUSDValue(ctx context.Context, email string, page, size int) (*SpotUSDMasterAccounts, error)

GetMasterAccountTotalUSDValue this endpoint to get the total value of assets in the master account in USD.

func (*Binanceus) GetMostRecentTrades

func (bi *Binanceus) GetMostRecentTrades(ctx context.Context, rtr RecentTradeRequestParams) ([]RecentTrade, error)

GetMostRecentTrades to get older trades. maximum limit in the RecentTradeRequestParams is 1,000 trades.

func (*Binanceus) GetOCOOrder

GetOCOOrder to retrieve a specific OCO order based on provided optional parameters.

func (*Binanceus) GetOTCTradeOrder

func (bi *Binanceus) GetOTCTradeOrder(ctx context.Context, orderID uint64) (*OTCTradeOrder, error)

GetOTCTradeOrder returns a single OTC Trade Order instance.

func (*Binanceus) GetOpenOCOOrders

func (bi *Binanceus) GetOpenOCOOrders(ctx context.Context, recvWindow uint64) ([]OCOOrderResponse, error)

GetOpenOCOOrders to query open OCO orders.

func (*Binanceus) GetOrder

func (bi *Binanceus) GetOrder(ctx context.Context, arg *OrderRequestParams) (*Order, error)

GetOrder to check a trade order's status.

func (*Binanceus) GetOrderBookDepth

func (bi *Binanceus) GetOrderBookDepth(ctx context.Context, arg *OrderBookDataRequestParams) (*OrderBook, error)

GetOrderBookDepth to get the order book depth. Please note the limits in the table below.

func (*Binanceus) GetOrderHistory

func (bi *Binanceus) GetOrderHistory(_ context.Context, _ *order.MultiOrderRequest) (order.FilteredOrders, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*Binanceus) GetOrderInfo

func (bi *Binanceus) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (*order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*Binanceus) GetOrderRateLimits

func (bi *Binanceus) GetOrderRateLimits(ctx context.Context, recvWindow uint) ([]OrderRateLimit, error)

GetOrderRateLimits get the current trade order count rate limits for all time intervals. INPUTS: recvWindow <= 60000

func (*Binanceus) GetPriceChangeStats

func (bi *Binanceus) GetPriceChangeStats(ctx context.Context, symbol currency.Pair) (PriceChangeStats, error)

GetPriceChangeStats returns price change statistics for the last 24 hours symbol: string of currency pair

func (*Binanceus) GetPriceDatas

func (bi *Binanceus) GetPriceDatas(ctx context.Context) (SymbolPrices, error)

GetPriceDatas to get the latest price for symbols.

func (*Binanceus) GetRecentTrades

func (bi *Binanceus) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*Binanceus) GetReferralRewardHistory

func (bi *Binanceus) GetReferralRewardHistory(ctx context.Context, userBusinessType, page, rows int) (*ReferralRewardHistoryResponse, error)

GetReferralRewardHistory retrieves the user’s referral reward history.

func (*Binanceus) GetServerTime

func (bi *Binanceus) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error)

GetServerTime this endpoint returns the exchange server time.

func (*Binanceus) GetSinglePriceData

func (bi *Binanceus) GetSinglePriceData(ctx context.Context, symbol currency.Pair) (SymbolPrice, error)

GetSinglePriceData to get the latest price for a token symbol or symbols.

func (*Binanceus) GetSpotKline

func (bi *Binanceus) GetSpotKline(ctx context.Context, arg *KlinesRequestParams) ([]CandleStick, error)

GetSpotKline to get Kline/candlestick bars for a token symbol. Klines are uniquely identified by their open time.

func (*Binanceus) GetSubAccountDepositAddress

func (bi *Binanceus) GetSubAccountDepositAddress(ctx context.Context, arg SubAccountDepositAddressRequestParams) (*SubAccountDepositAddress, error)

GetSubAccountDepositAddress retrieves sub-account’s deposit address.

func (*Binanceus) GetSubAccountDepositHistory

func (bi *Binanceus) GetSubAccountDepositHistory(ctx context.Context, email string, coin currency.Code,
	status int, startTime, endTime time.Time, limit, offset int) ([]SubAccountDepositItem, error)

GetSubAccountDepositHistory retrieves sub-account deposit history.

func (*Binanceus) GetSubaccountAssets

func (bi *Binanceus) GetSubaccountAssets(ctx context.Context, email string) (*SubAccountAssets, error)

GetSubaccountAssets to fetch sub-account assets.

func (*Binanceus) GetSubaccountInformation

func (bi *Binanceus) GetSubaccountInformation(ctx context.Context, page, limit uint, status, email string) ([]SubAccount, error)

GetSubaccountInformation to fetch your sub-account list.

func (*Binanceus) GetSubaccountStatusList

func (bi *Binanceus) GetSubaccountStatusList(ctx context.Context, email string) ([]SubAccountStatus, error)

GetSubaccountStatusList this endpoint retrieves a status list of sub-accounts.

func (*Binanceus) GetSubaccountTransferHistory

func (bi *Binanceus) GetSubaccountTransferHistory(ctx context.Context,
	email string,
	startTime uint64,
	endTime uint64,
	page, limit int) ([]TransferHistory, error)

GetSubaccountTransferHistory to fetch sub-account asset transfer history.

func (*Binanceus) GetSupportedCoinPairs

func (bi *Binanceus) GetSupportedCoinPairs(ctx context.Context, symbol currency.Pair) ([]CoinPairInfo, error)

GetSupportedCoinPairs to get a list of supported coin pairs for convert. returns list of CoinPairInfo

func (*Binanceus) GetSystemStatus

func (bi *Binanceus) GetSystemStatus(ctx context.Context) (int, error)

GetSystemStatus endpoint to fetch whether the system status is normal or under maintenance.

func (*Binanceus) GetTickers

func (bi *Binanceus) GetTickers(ctx context.Context) ([]PriceChangeStats, error)

GetTickers returns the ticker data for the last 24 hrs

func (*Binanceus) GetTradeFee

func (bi *Binanceus) GetTradeFee(ctx context.Context, recvWindow uint, symbol string) (TradeFeeList, error)

GetTradeFee to fetch trading fees.

func (*Binanceus) GetTrades

func (bi *Binanceus) GetTrades(ctx context.Context, arg *GetTradesParams) ([]Trade, error)

GetTrades to get trade data for a specific account and token symbol.

func (*Binanceus) GetUserAPITradingStatus

func (bi *Binanceus) GetUserAPITradingStatus(ctx context.Context, recvWindow uint) (*TradeStatus, error)

GetUserAPITradingStatus to fetch account API trading status details.

func (*Binanceus) GetUserAccountStatus

func (bi *Binanceus) GetUserAccountStatus(ctx context.Context, recvWindow uint) (*AccountStatusResponse, error)

GetUserAccountStatus to fetch account status detail.

func (*Binanceus) GetUsersSpotAssetSnapshot

func (bi *Binanceus) GetUsersSpotAssetSnapshot(ctx context.Context, startTime, endTime time.Time, limit, offset uint) (*SpotAssetsSnapshotResponse, error)

GetUsersSpotAssetSnapshot retrieves a snapshot of list of assets in the account.

func (*Binanceus) GetWithdrawalsHistory

func (bi *Binanceus) GetWithdrawalsHistory(ctx context.Context, c currency.Code, a asset.Item) ([]exchange.WithdrawalHistory, error)

GetWithdrawalsHistory returns previous withdrawals data

func (*Binanceus) GetWsAuthStreamKey

func (bi *Binanceus) GetWsAuthStreamKey(ctx context.Context) (string, error)

GetWsAuthStreamKey this method 'Creates User Data Stream' will retrieve a key to use for authorised WS streaming Same as that of Binance Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.

func (*Binanceus) KeepAuthKeyAlive

func (bi *Binanceus) KeepAuthKeyAlive()

KeepAuthKeyAlive will continuously send messages to keep the WS auth key active

func (*Binanceus) MaintainWsAuthStreamKey

func (bi *Binanceus) MaintainWsAuthStreamKey(ctx context.Context) error

MaintainWsAuthStreamKey will Extend User Data Stream Similar functionality to the same method of Binance. Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes. It's recommended to send a ping about every 30 minutes.

func (*Binanceus) ModifyOrder

func (bi *Binanceus) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*Binanceus) NewOrder

NewOrder sends a new order to Binanceus

func (*Binanceus) NewOrderTest

func (bi *Binanceus) NewOrderTest(ctx context.Context, o *NewOrderRequest) (*NewOrderResponse, error)

NewOrderTest sends a new test order to Binanceus to test new order creation and signature/recvWindow long. The endpoint creates and validates a new order but does not send it into the matching engine.

func (*Binanceus) PlaceOTCTradeOrder

func (bi *Binanceus) PlaceOTCTradeOrder(ctx context.Context, quoteID string) (*OTCTradeOrderResponse, error)

PlaceOTCTradeOrder to place an order using an acquired quote. returns OTCTradeOrderResponse response containing the OrderID,OrderStatus, and CreateTime information of an order.

func (*Binanceus) ProcessUpdate

func (bi *Binanceus) ProcessUpdate(cp currency.Pair, a asset.Item, ws *WebsocketDepthStream) error

ProcessUpdate processes the websocket orderbook update

func (*Binanceus) QuickDisableCryptoWithdrawal

func (bi *Binanceus) QuickDisableCryptoWithdrawal(ctx context.Context) error

QuickDisableCryptoWithdrawal use this endpoint to disable crypto withdrawals.

func (*Binanceus) QuickEnableCryptoWithdrawal

func (bi *Binanceus) QuickEnableCryptoWithdrawal(ctx context.Context) error

QuickEnableCryptoWithdrawal use this endpoint to enable crypto withdrawals.

func (*Binanceus) RequestForQuote

func (bi *Binanceus) RequestForQuote(ctx context.Context, arg *RequestQuoteParams) (*Quote, error)

RequestForQuote endpoint to request a quote for a from-to coin pair.

func (*Binanceus) SeedLocalCache

func (bi *Binanceus) SeedLocalCache(ctx context.Context, p currency.Pair) error

SeedLocalCache seeds depth data

func (*Binanceus) SeedLocalCacheWithBook

func (bi *Binanceus) SeedLocalCacheWithBook(p currency.Pair, orderbookNew *OrderBook) error

SeedLocalCacheWithBook seeds the local orderbook cache

func (*Binanceus) SendAPIKeyHTTPRequest

func (bi *Binanceus) SendAPIKeyHTTPRequest(ctx context.Context, ePath exchange.URL, path string, f request.EndpointLimit, result interface{}) error

SendAPIKeyHTTPRequest is a special API request where the api key is appended to the headers without a secret

func (*Binanceus) SendAuthHTTPRequest

func (bi *Binanceus) SendAuthHTTPRequest(ctx context.Context, ePath exchange.URL, method, path string, params url.Values, f request.EndpointLimit, result interface{}) error

SendAuthHTTPRequest sends an authenticated HTTP request

func (*Binanceus) SendHTTPRequest

func (bi *Binanceus) SendHTTPRequest(ctx context.Context, ePath exchange.URL, path string, f request.EndpointLimit, result interface{}) error

SendHTTPRequest sends an unauthenticated request

func (*Binanceus) SetDefaults

func (bi *Binanceus) SetDefaults()

SetDefaults sets the basic defaults for Binanceus

func (*Binanceus) SetValues

func (bi *Binanceus) SetValues()

SetValues sets the default valid values

func (*Binanceus) Setup

func (bi *Binanceus) Setup(exch *config.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*Binanceus) SubmitOrder

func (bi *Binanceus) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)

SubmitOrder submits a new order

func (*Binanceus) SubmitOrders added in v1.0.7

func (bi *Binanceus) SubmitOrders(ctx context.Context, ss ...*order.Submit) ([]*order.SubmitResponse, error)

func (*Binanceus) Subscribe

func (bi *Binanceus) Subscribe(channelsToSubscribe []subscription.Subscription) error

Subscribe subscribes to a set of channels

func (*Binanceus) SynchroniseWebsocketOrderbook

func (bi *Binanceus) SynchroniseWebsocketOrderbook()

SynchroniseWebsocketOrderbook synchronises full orderbook for currency pair asset

func (*Binanceus) Unsubscribe

func (bi *Binanceus) Unsubscribe(channelsToUnsubscribe []subscription.Subscription) error

Unsubscribe unsubscribes from a set of channels

func (*Binanceus) UpdateAccountInfo

func (bi *Binanceus) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies

func (*Binanceus) UpdateLocalBuffer

func (bi *Binanceus) UpdateLocalBuffer(wsdp *WebsocketDepthStream) (bool, error)

UpdateLocalBuffer updates and returns the most recent iteration of the orderbook

func (*Binanceus) UpdateOrderExecutionLimits

func (bi *Binanceus) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error

UpdateOrderExecutionLimits updates order execution limits

func (*Binanceus) UpdateOrderbook

func (bi *Binanceus) UpdateOrderbook(ctx context.Context, pair currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Binanceus) UpdateTicker

func (bi *Binanceus) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*Binanceus) UpdateTickers

func (bi *Binanceus) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates all currency pairs of a given asset type

func (*Binanceus) UpdateTradablePairs

func (bi *Binanceus) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*Binanceus) ValidateAPICredentials

func (bi *Binanceus) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error

ValidateAPICredentials validates current credentials used for wrapper

func (*Binanceus) WithdrawCrypto

func (bi *Binanceus) WithdrawCrypto(ctx context.Context, arg *withdraw.Request) (string, error)

WithdrawCrypto method to withdraw crypto

func (*Binanceus) WithdrawCryptocurrencyFunds

func (bi *Binanceus) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*Binanceus) WithdrawFiat

func (bi *Binanceus) WithdrawFiat(ctx context.Context, arg *WithdrawFiatRequestParams) (string, error)

WithdrawFiat to submit a USD withdraw request via Silvergate Exchange Network (SEN). returns the Order ID as string

func (*Binanceus) WithdrawFiatFunds

func (bi *Binanceus) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted. But, GCT has no concept of withdrawal via SEN the fiat withdrawal end point of Binance.US is built to submit a USD withdraw request via Silvergate Exchange Network (SEN). So, this method is not implemented.

func (*Binanceus) WithdrawFiatFundsToInternationalBank

func (bi *Binanceus) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted But, GCT has no concept of withdrawal via SEN the fiat withdrawal end point of Binance.US is built to submit a USD withdraw request via Silvergate Exchange Network (SEN).

func (*Binanceus) WithdrawalHistory

func (bi *Binanceus) WithdrawalHistory(ctx context.Context, c currency.Code, status string, startTime, endTime time.Time, offset, limit int) ([]WithdrawStatusResponse, error)

WithdrawalHistory gets the status of recent withdrawals status `param` used as string to prevent default value 0 (for int) interpreting as EmailSent status

func (*Binanceus) WsConnect

func (bi *Binanceus) WsConnect() error

WsConnect initiates a websocket connection

type CancelOrderRequestParams

type CancelOrderRequestParams struct {
	Symbol                currency.Pair
	OrderID               string
	ClientSuppliedOrderID string
	NewClientOrderID      string
	RecvWindow            uint64
}

CancelOrderRequestParams this struct will be used as a parameter for cancel order method.

type CandleStick

type CandleStick struct {
	OpenTime                 time.Time
	Open                     float64
	High                     float64
	Low                      float64
	Close                    float64
	Volume                   float64
	CloseTime                time.Time
	QuoteAssetVolume         float64
	TradeCount               float64
	TakerBuyAssetVolume      float64
	TakerBuyQuoteAssetVolume float64
}

CandleStick holds kline data

type CoinPairInfo

type CoinPairInfo struct {
	FromCoin          string  `json:"fromCoin"`
	ToCoin            string  `json:"toCoin"`
	FromCoinMinAmount float64 `json:"fromCoinMinAmount,string"`
	FromCoinMaxAmount float64 `json:"fromCoinMaxAmount,string"`
	ToCoinMinAmount   float64 `json:"toCoinMinAmount,string"`
	ToCoinMaxAmount   float64 `json:"toCoinMaxAmount,string"`
}

CoinPairInfo holds supported coin pair for conversion with its detailed information

type CommonOrder

type CommonOrder struct {
	Symbol        string `json:"symbol"`
	OrderID       uint64 `json:"orderId"`
	OrderListID   int8   `json:"orderListId"`
	ClientOrderID string `json:"clientOrderId"`

	Price               float64 `json:"price,string"`
	OrigQty             float64 `json:"origQty,string"`
	ExecutedQty         float64 `json:"executedQty,string"`
	CummulativeQuoteQty float64 `json:"cummulativeQuoteQty,string"`
	Status              string  `json:"status"`
	TimeInForce         string  `json:"timeInForce"`
	Type                string  `json:"type"`
	Side                string  `json:"side"`
	StopPrice           float64 `json:"stopPrice,string"`
}

CommonOrder instance holds the order information common to both for Order and OrderReportItem

type DepositAddress

type DepositAddress struct {
	Address string `json:"address"`
	Coin    string `json:"coin"`
	Tag     string `json:"tag"`
	URL     string `json:"url"`
}

DepositAddress stores the deposit address info

type DepositHistory

type DepositHistory struct {
	Amount       string `json:"amount"`
	Coin         string `json:"coin"`
	Network      string `json:"network"`
	Status       int64  `json:"status"`
	Address      string `json:"address"`
	AddressTag   string `json:"addressTag"`
	TxID         string `json:"txId"`
	InsertTime   int64  `json:"insertTime"`
	TransferType int64  `json:"transferType"`
	ConfirmTimes string `json:"confirmTimes"`
}

DepositHistory stores deposit history info.

type ExchangeInfo

type ExchangeInfo struct {
	Code       int64     `json:"code"`
	Msg        string    `json:"msg"`
	Timezone   string    `json:"timezone"`
	ServerTime time.Time `json:"serverTime"`
	RateLimits []struct {
		RateLimitType string `json:"rateLimitType"`
		Interval      string `json:"interval"`
		Limit         int64  `json:"limit"`
	} `json:"rateLimits"`
	ExchangeFilters interface{} `json:"exchangeFilters"`
	Symbols         []struct {
		Symbol                     string   `json:"symbol"`
		Status                     string   `json:"status"`
		BaseAsset                  string   `json:"baseAsset"`
		BaseAssetPrecision         int64    `json:"baseAssetPrecision"`
		QuoteAsset                 string   `json:"quoteAsset"`
		QuotePrecision             int64    `json:"quotePrecision"`
		OrderTypes                 []string `json:"orderTypes"`
		IcebergAllowed             bool     `json:"icebergAllowed"`
		OCOAllowed                 bool     `json:"ocoAllowed"`
		QuoteOrderQtyMarketAllowed bool     `json:"quoteOrderQtyMarketAllowed"`
		IsSpotTradingAllowed       bool     `json:"isSpotTradingAllowed"`
		IsMarginTradingAllowed     bool     `json:"isMarginTradingAllowed"`
		Filters                    []struct {
			FilterType          string  `json:"filterType"`
			MinPrice            float64 `json:"minPrice,string"`
			MaxPrice            float64 `json:"maxPrice,string"`
			TickSize            float64 `json:"tickSize,string"`
			MultiplierUp        float64 `json:"multiplierUp,string"`
			MultiplierDown      float64 `json:"multiplierDown,string"`
			AvgPriceMinutes     int64   `json:"avgPriceMins"`
			MinQty              float64 `json:"minQty,string"`
			MaxQty              float64 `json:"maxQty,string"`
			StepSize            float64 `json:"stepSize,string"`
			MinNotional         float64 `json:"minNotional,string"`
			ApplyToMarket       bool    `json:"applyToMarket"`
			Limit               int64   `json:"limit"`
			MaxNumAlgoOrders    int64   `json:"maxNumAlgoOrders"`
			MaxNumIcebergOrders int64   `json:"maxNumIcebergOrders"`
			MaxNumOrders        int64   `json:"maxNumOrders"`
		} `json:"filters"`
		Permissions []string `json:"permissions"`
	} `json:"symbols"`
}

ExchangeInfo holds the full exchange information type

func (*ExchangeInfo) UnmarshalJSON

func (a *ExchangeInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the server Time timestamp

type FiatAssetRecord

type FiatAssetRecord struct {
	OrderID        string `json:"orderId"`
	PaymentAccount string `json:"paymentAccount"`
	PaymentChannel string `json:"paymentChannel"`
	PaymentMethod  string `json:"paymentMethod"`
	OrderStatus    string `json:"orderStatus"`
	Amount         string `json:"amount"`
	TransactionFee string `json:"transactionFee"`
	PlatformFee    string `json:"platformFee"`
}

FiatAssetRecord asset information for fiat.

type FiatAssetsHistory

type FiatAssetsHistory struct {
	AssetLogRecordList []FiatAssetRecord `json:"assetLogRecordList"`
}

FiatAssetsHistory holds list of available fiat asset records.

type FiatWithdrawalRequestParams

type FiatWithdrawalRequestParams struct {
	FiatCurrency   string
	OrderID        string
	Offset         int64
	PaymentChannel string
	PaymentMethod  string
	StartTime      time.Time
	EndTime        time.Time
}

FiatWithdrawalRequestParams to fetch your fiat (USD) withdrawal history.

type GetOCOOrderRequestParams

type GetOCOOrderRequestParams struct {
	OrderListID       string
	OrigClientOrderID string
}

GetOCOOrderRequestParams a parameter model to query specific list of OCO orders using their id

type GetTradesParams

type GetTradesParams struct {
	Symbol     string     `json:"symbol"`
	OrderID    uint64     `json:"orderId"`
	StartTime  *time.Time `json:"startTime"`
	EndTime    *time.Time `json:"endTime"`
	FromID     uint64     `json:"fromId"`
	Limit      uint64     `json:"limit"`
	RecvWindow uint64     `json:"recvWindow"`
}

GetTradesParams request param to get the trade history

type HistoricalTrade

type HistoricalTrade struct {
	ID            int64     `json:"id"`
	Price         float64   `json:"price,string"`
	Quantity      float64   `json:"qty,string"`
	QuoteQuantity float64   `json:"quoteQty,string"`
	Time          time.Time `json:"time"`
	IsBuyerMaker  bool      `json:"isBuyerMaker"`
	IsBestMatch   bool      `json:"isBestMatch"`
}

HistoricalTrade holds recent trade data

func (*HistoricalTrade) UnmarshalJSON

func (a *HistoricalTrade) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type HistoricalTradeParams

type HistoricalTradeParams struct {
	Symbol string `json:"symbol"` // Required field. example LTCBTC, BTCUSDT
	Limit  int64  `json:"limit"`  // Default 500; max 1000.
	FromID uint64 `json:"fromId"` // Optional Field. Specifies the trade ID to fetch most recent trade histories from
}

HistoricalTradeParams represents historical trades request params.

type KlineStream

type KlineStream struct {
	EventType string          `json:"e"`
	EventTime time.Time       `json:"E"`
	Symbol    string          `json:"s"`
	Kline     KlineStreamData `json:"k"`
}

KlineStream holds the kline stream data

func (*KlineStream) UnmarshalJSON

func (a *KlineStream) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type KlineStreamData

type KlineStreamData struct {
	StartTime                time.Time `json:"t"`
	CloseTime                time.Time `json:"T"`
	Symbol                   string    `json:"s"`
	Interval                 string    `json:"i"`
	FirstTradeID             int64     `json:"f"`
	LastTradeID              int64     `json:"L"`
	OpenPrice                float64   `json:"o,string"`
	ClosePrice               float64   `json:"c,string"`
	HighPrice                float64   `json:"h,string"`
	LowPrice                 float64   `json:"l,string"`
	Volume                   float64   `json:"v,string"`
	NumberOfTrades           int64     `json:"n"`
	KlineClosed              bool      `json:"x"`
	Quote                    float64   `json:"q,string"`
	TakerBuyBaseAssetVolume  float64   `json:"V,string"`
	TakerBuyQuoteAssetVolume float64   `json:"Q,string"`
}

KlineStreamData defines kline streaming data

type KlinesRequestParams

type KlinesRequestParams struct {
	Symbol    currency.Pair // Required field; example LTCBTC, BTCUSDT
	Interval  string        // Time interval period
	Limit     int64         // Default 500; max 500.
	StartTime time.Time
	EndTime   time.Time
}

KlinesRequestParams represents Klines request data.

type NewOrderRequest

type NewOrderRequest struct {
	Symbol           currency.Pair
	Side             string
	TradeType        RequestParamsOrderType
	TimeInForce      RequestParamsTimeForceType
	Quantity         float64
	QuoteOrderQty    float64
	Price            float64
	NewClientOrderID string
	StopPrice        float64 // Used with STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT, and TAKE_PROFIT_LIMIT orders.
	IcebergQty       float64 // Used with LIMIT, STOP_LOSS_LIMIT, and TAKE_PROFIT_LIMIT to create an iceberg order.
	NewOrderRespType string
}

NewOrderRequest request type

type NewOrderResponse

type NewOrderResponse struct {
	Symbol          string    `json:"symbol"`
	OrderID         int64     `json:"orderId"`
	OrderListID     int8      `json:"orderListId"`
	ClientOrderID   string    `json:"clientOrderId"`
	TransactionTime time.Time `json:"transactTime"`
	Price           float64   `json:"price,string"`
	OrigQty         float64   `json:"origQty,string"`
	ExecutedQty     float64   `json:"executedQty,string"`
	// The cumulative amount of the quote that has been spent (with a BUY order) or received (with a SELL order).
	CumulativeQuoteQty float64 `json:"cummulativeQuoteQty,string"`
	Status             string  `json:"status"`
	TimeInForce        string  `json:"timeInForce"`
	Type               string  `json:"type"`
	Side               string  `json:"side"`
	// --
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
	// --
	Fills []struct {
		Price           float64 `json:"price,string"`
		Qty             float64 `json:"qty,string"`
		Commission      float64 `json:"commission,string"`
		CommissionAsset string  `json:"commissionAsset"`
	} `json:"fills"`
}

NewOrderResponse represents trade order's detailed information.

func (*NewOrderResponse) UnmarshalJSON

func (a *NewOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type OCBSOrder

type OCBSOrder struct {
	QuoteID     string    `json:"quoteId"`
	OrderID     string    `json:"orderId"`
	OrderStatus string    `json:"orderStatus"`
	FromCoin    string    `json:"fromCoin"`
	FromAmount  float64   `json:"fromAmount"`
	ToCoin      string    `json:"toCoin"`
	ToAmount    float64   `json:"toAmount"`
	FeeCoin     string    `json:"feeCoin"`
	FeeAmount   float64   `json:"feeAmount"`
	Ratio       float64   `json:"ratio"`
	CreateTime  time.Time `json:"createTime"`
}

OCBSOrder holds OCBS orders details.

func (*OCBSOrder) UnmarshalJSON

func (a *OCBSOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises createTime timestamp to built in time.

type OCBSOrderRequestParams

type OCBSOrderRequestParams struct {
	OrderID   string
	StartTime time.Time
	EndTime   time.Time
	Limit     uint64
}

OCBSOrderRequestParams holds parameters to retrieve OCBS orders.

type OCBSTradeOrdersResponse

type OCBSTradeOrdersResponse struct {
	Total     int64       `json:"total"`
	OCBSOrder []OCBSOrder `json:"dataList"`
}

OCBSTradeOrdersResponse holds the quantity and list of OCBS Orders.

type OCOFullOrderResponse

type OCOFullOrderResponse struct {
	*OCOOrderResponse
	OrderReports []OCOOrderReportItem `json:"orderReports"`
}

OCOFullOrderResponse holds detailed OCO order information with the corresponding transaction time

type OCOOrderInputParams

type OCOOrderInputParams struct {
	Symbol               string  `json:"symbol"`    // Required
	StopPrice            float64 `json:"stopPrice"` // Required
	Side                 string  `json:"side"`      // Required
	Quantity             float64 `json:"quantity"`  // Required
	Price                float64 `json:"price"`     // Required
	ListClientOrderID    string  `json:"listClientOrderId"`
	LimitClientOrderID   string  `json:"limitClientOrderId"`
	LimitIcebergQty      float64 `json:"limitIcebergQty"`
	StopClientOrderID    string  `json:"stopClientOrderId"`
	StopLimitPrice       float64 `json:"stopLimitPrice"`
	StopIcebergQty       float64 `json:"stopIcebergQty"`
	StopLimitTimeInForce string  `json:"stopLimitTimeInForce"`
	NewOrderRespType     string  `json:"newOrderRespType"`
	RecvWindow           uint64  `json:"recvWindow"`
}

OCOOrderInputParams One-cancel-the-other order creation input Parameter

type OCOOrderReportItem

type OCOOrderReportItem struct {
	CommonOrder
	TransactionTime time.Time `json:"transactionTime"`
}

OCOOrderReportItem this is used by the OCO order creating response

func (*OCOOrderReportItem) UnmarshalJSON

func (a *OCOOrderReportItem) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the ( TransactionTime )timestamp

type OCOOrderResponse

type OCOOrderResponse struct {
	OrderListID       int64                `json:"orderListId"`
	ContingencyType   string               `json:"contingencyType"`
	ListStatusType    string               `json:"listStatusType"`
	ListOrderStatus   string               `json:"listOrderStatus"`
	ListClientOrderID string               `json:"listClientOrderId"`
	TransactionTime   time.Time            `json:"transactionTime"`
	Symbol            string               `json:"symbol"`
	Orders            []OrderShortResponse `json:"orders"`
}

OCOOrderResponse this model is to be used to fetch the response of create new OCO order response

func (*OCOOrderResponse) UnmarshalJSON

func (a *OCOOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the (TransactioTime) timestamp

type OCOOrdersDeleteRequestParams

type OCOOrdersDeleteRequestParams struct {
	Symbol            string
	OrderListID       uint64
	ListClientOrderID string
	NewClientOrderID  string
	RecvWindow        uint64
}

OCOOrdersDeleteRequestParams holds the params to delete a new order

type OCOOrdersRequestParams

type OCOOrdersRequestParams struct {
	FromID     uint64
	StartTime  time.Time
	EndTime    time.Time
	Limit      uint64
	RecvWindow uint64
}

OCOOrdersRequestParams a parameter model to query from list of OCO orders.

type OTCTradeOrder

type OTCTradeOrder struct {
	QuoteID      string    `json:"quoteId"`
	OrderID      uint64    `json:"orderId,string"`
	OrderStatus  string    `json:"orderStatus"`
	FromCoin     string    `json:"fromCoin"`
	FromAmount   float64   `json:"fromAmount"`
	ToCoin       string    `json:"toCoin"`
	ToAmount     float64   `json:"toAmount"`
	Ratio        float64   `json:"ratio"`
	InverseRatio float64   `json:"inverseRatio"`
	CreateTime   time.Time `json:"createTime"`
}

OTCTradeOrder holds OTC(over-the-counter) orders response

func (*OTCTradeOrder) UnmarshalJSON

func (a *OTCTradeOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the (Create Time) timestamp

type OTCTradeOrderRequestParams

type OTCTradeOrderRequestParams struct {
	OrderID   string
	FromCoin  string
	ToCoin    string
	StartTime time.Time
	EndTime   time.Time
	Limit     int8
}

OTCTradeOrderRequestParams request param for Over-the-Counter trade order params.

type OTCTradeOrderResponse

type OTCTradeOrderResponse struct {
	OrderID     uint64    `json:"orderId,string"`
	OrderStatus string    `json:"orderStatus"`
	CreateTime  time.Time `json:"createTime"`
}

OTCTradeOrderResponse holds OTC(over-the-counter) order identification and status information

func (*OTCTradeOrderResponse) UnmarshalJSON

func (a *OTCTradeOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the (Create Time) timestamp

type Order

type Order struct {
	CommonOrder
	IcebergQty        float64   `json:"icebergQty,string"`
	Time              time.Time `json:"time"`
	UpdateTime        time.Time `json:"updateTime"`
	IsWorking         bool      `json:"isWorking"`
	OrigQuoteOrderQty float64   `json:"origQuoteOrderQty,string"`
}

Order struct represents an ordinary order response.

func (*Order) UnmarshalJSON

func (a *Order) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON infos, including the order time and update time timestamps

type OrderBook

type OrderBook struct {
	Symbol       string
	LastUpdateID int64
	Code         int
	Msg          string
	Bids         []OrderbookItem
	Asks         []OrderbookItem
}

OrderBook actual structured data that can be used for orderbook

type OrderBookData

type OrderBookData struct {
	LastUpdateID int64       `json:"lastUpdateId"`
	Bids         [][2]string `json:"bids"`
	Asks         [][2]string `json:"asks"`
}

OrderBookData is resp data from orderbook endpoint

type OrderBookDataRequestParams

type OrderBookDataRequestParams struct {
	Symbol currency.Pair `json:"symbol"` // Required field; example LTCBTC,BTCUSDT
	Limit  int64         `json:"limit"`  // Default 100; max 1000. Valid limits:[5, 10, 20, 50, 100, 500, 1000]
}

OrderBookDataRequestParams represents Klines request data.

type OrderBookTickerStream

type OrderBookTickerStream struct {
	LastUpdateID int64  `json:"u"`
	S            string `json:"s"`
	Symbol       currency.Pair
	BestBidPrice float64 `json:"b,string"`
	BestBidQty   float64 `json:"B,string"`
	BestAskPrice float64 `json:"a,string"`
	BestAskQty   float64 `json:"A,string"`
}

OrderBookTickerStream contains websocket orderbook data

type OrderRateLimit

type OrderRateLimit struct {
	RateLimitType string `json:"rateLimitType"`
	Interval      string `json:"interval"`
	IntervalNum   uint64 `json:"intervalNum"`
	Limit         uint64 `json:"limit"`
	Count         uint64 `json:"count"`
}

OrderRateLimit holds rate limits type, interval, and related information of trade orders.

type OrderRequestParams

type OrderRequestParams struct {
	Symbol            string `json:"symbol"` // REQUIRED
	OrderID           uint64 `json:"orderId"`
	OrigClientOrderID string `json:"origClientOrderId"`
	// contains filtered or unexported fields
}

OrderRequestParams this struct will be used to get a order and its related information

type OrderShortResponse

type OrderShortResponse struct {
	Symbol        string `json:"symbol"`
	OrderID       uint64 `json:"orderId"`
	ClientOrderID string `json:"clientOrderId"`
}

OrderShortResponse holds symbol Identification information of trade orders.

type OrderbookItem

type OrderbookItem struct {
	Price    float64
	Quantity float64
}

OrderbookItem stores an individual orderbook item

type PriceChangeStats

type PriceChangeStats struct {
	Symbol             string    `json:"symbol"`
	PriceChange        float64   `json:"priceChange,string"`
	PriceChangePercent float64   `json:"priceChangePercent,string"`
	WeightedAvgPrice   float64   `json:"weightedAvgPrice,string"`
	PrevClosePrice     float64   `json:"prevClosePrice,string"`
	LastPrice          float64   `json:"lastPrice,string"`
	LastQty            float64   `json:"lastQty,string"`
	BidPrice           float64   `json:"bidPrice,string"`
	AskPrice           float64   `json:"askPrice,string"`
	OpenPrice          float64   `json:"openPrice,string"`
	HighPrice          float64   `json:"highPrice,string"`
	LowPrice           float64   `json:"lowPrice,string"`
	Volume             float64   `json:"volume,string"`
	QuoteVolume        float64   `json:"quoteVolume,string"`
	OpenTime           time.Time `json:"openTime"`
	CloseTime          time.Time `json:"closeTime"`
	FirstID            int64     `json:"firstId"`
	LastID             int64     `json:"lastId"`
	Count              int64     `json:"count"`
}

PriceChangeStats contains statistics for the last 24 hours trade

func (*PriceChangeStats) UnmarshalJSON

func (a *PriceChangeStats) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type Quote

type Quote struct {
	Symbol         string    `json:"symbol"`
	Ratio          float64   `json:"ratio,string"`
	InverseRatio   float64   `json:"inverseRatio,string"`
	ValidTimestamp time.Time `json:"validTimestamp"`
	ToAmount       float64   `json:"toAmount,string"`
	FromAmount     float64   `json:"fromAmount,string"`
}

Quote holds quote information for from-to-coin pair

func (*Quote) UnmarshalJSON

func (a *Quote) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises ValidTimestamp timestamp to built in time.Time instance.

type RateLimit

type RateLimit struct {
	SpotRate       *rate.Limiter
	SpotOrdersRate *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

Limit executes rate limiting functionality for Binance

type RecentTrade

type RecentTrade struct {
	ID           int64     `json:"id"`
	Price        float64   `json:"price,string"`
	Quantity     float64   `json:"qty,string"`
	Time         time.Time `json:"time"`
	IsBuyerMaker bool      `json:"isBuyerMaker"`
	IsBestMatch  bool      `json:"isBestMatch"`
}

RecentTrade holds recent trade data

func (*RecentTrade) UnmarshalJSON

func (a *RecentTrade) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type RecentTradeRequestParams

type RecentTradeRequestParams struct {
	Symbol currency.Pair `json:"symbol"` // Required field. example LTCBTC, BTCUSDT
	Limit  int64         `json:"limit"`  // Default 500; max 1000.
}

RecentTradeRequestParams represents Klines request data.

type ReferralRewardHistoryResponse

type ReferralRewardHistoryResponse struct {
	Total int64                    `json:"total"`
	Rows  []ReferralWithdrawalItem `json:"rows"`
}

ReferralRewardHistoryResponse holds reward history response

type ReferralWithdrawalItem

type ReferralWithdrawalItem struct {
	UserID          int64     `json:"userId"`
	RewardAmount    string    `json:"rewardAmount"`
	ReceiveDateTime time.Time `json:"receiveDateTime"`
	RewardType      string    `json:"rewardType"`
}

ReferralWithdrawalItem holds reward history item

func (*ReferralWithdrawalItem) UnmarshalJSON

func (a *ReferralWithdrawalItem) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises createTime timestamp to built in time.

type RequestParamsOrderType

type RequestParamsOrderType string

RequestParamsOrderType trade order type

type RequestParamsTimeForceType

type RequestParamsTimeForceType string

RequestParamsTimeForceType Time in force

type RequestQuoteParams

type RequestQuoteParams struct {
	FromCoin      string  `json:"fromCoin"`
	ToCoin        string  `json:"toCoin"`
	RequestCoin   string  `json:"requestCoin"`
	RequestAmount float64 `json:"requestAmount"`
}

RequestQuoteParams a parameter model to query quote information

type Response

type Response struct {
	Code int64  `json:"code"`
	Msg  string `json:"msg"`
}

Response holds basic binance api response data

type ServerTime

type ServerTime struct {
	Timestamp time.Time `json:"serverTime"`
}

ServerTime holds the exchange server time

func (*ServerTime) UnmarshalJSON

func (a *ServerTime) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises createTime timestamp to built in time.

type SpotAssetsSnapshotResponse

type SpotAssetsSnapshotResponse struct {
	Code        int64    `json:"code"`
	Msg         string   `json:"msg"`
	SnapshotVos []string `json:"snapshotVos"`
}

SpotAssetsSnapshotResponse represents spot asset types snapshot information.

type SpotUSDMasterAccounts

type SpotUSDMasterAccounts struct {
	TotalCount                    int64                `json:"totalCount"`
	MasterAccountTotalAsset       int64                `json:"masterAccountTotalAsset"`
	SpotSubUserAssetBTCVolumeList []SubUserToBTCAssets `json:"spotSubUserAssetBtcVoList"`
}

SpotUSDMasterAccounts holds the USD assets of a sub user.

type SubAccount

type SubAccount struct {
	Email      string    `json:"email"`
	Status     string    `json:"status"`
	Activated  bool      `json:"activated"`
	Mobile     string    `json:"mobile"`
	GAuth      bool      `json:"gAuth"`
	CreateTime time.Time `json:"createTime"`
}

SubAccount holds a single sub account instance in a Binance US account. including the email and related information related to it.

func (*SubAccount) UnmarshalJSON

func (a *SubAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type SubAccountAssets

type SubAccountAssets struct {
	Balances        []AssetInfo `json:"balances"`
	Success         bool        `json:"success"`
	SubaccountEmail string      `json:"email,omitempty"`
}

SubAccountAssets holds all the balance and email of a subaccount

type SubAccountDepositAddress

type SubAccountDepositAddress struct {
	Coin    string `json:"coin"`
	Address string `json:"address"`
	Tag     string `json:"tag"`
	URL     string `json:"url"`
}

SubAccountDepositAddress holds sub-accounts deposit address information

type SubAccountDepositAddressRequestParams

type SubAccountDepositAddressRequestParams struct {
	Email   string        // [Required] Sub-account email
	Coin    currency.Code // [Required]
	Network string        // Network (If empty, returns the default network)
}

SubAccountDepositAddressRequestParams holds query parameters for Sub-account deposit addresses.

type SubAccountDepositItem

type SubAccountDepositItem struct {
	Amount        string    `json:"amount"`
	Coin          string    `json:"coin"`
	Network       string    `json:"network"`
	Status        int64     `json:"status"`
	Address       string    `json:"address"`
	AddressTag    string    `json:"addressTag"`
	TransactionID string    `json:"txId"`
	InsertTime    time.Time `json:"insertTime"`
	TransferType  int64     `json:"transferType"`
	ConfirmTimes  string    `json:"confirmTimes"`
}

SubAccountDepositItem holds the sub-account deposit information

func (*SubAccountDepositItem) UnmarshalJSON

func (a *SubAccountDepositItem) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises createTime timestamp to built in time.

type SubAccountStatus

type SubAccountStatus struct {
	Email            string    `json:"email"`
	InsertTime       time.Time `json:"insertTime"`
	Mobile           string    `json:"mobile"`
	IsUserActive     bool      `json:"isUserActive"`
	IsMarginEnabled  bool      `json:"isMarginEnabled"`
	IsSubUserEnabled bool      `json:"isSubUserEnabled"`
	IsFutureEnabled  bool      `json:"isFutureEnabled"`
}

SubAccountStatus represents single sub accounts status information.

func (*SubAccountStatus) UnmarshalJSON

func (a *SubAccountStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises createTime timestamp to built in time.

type SubAccountTransferRequestParams

type SubAccountTransferRequestParams struct {
	FromEmail  string  // Mandatory
	ToEmail    string  // Mandatory
	Asset      string  // Mandatory
	Amount     float64 // Mandatory
	RecvWindow uint64
}

SubAccountTransferRequestParams contains argument variables holder used to transfer an asset from one account to another subaccount

type SubAccountTransferResponse

type SubAccountTransferResponse struct {
	Success bool   `json:"success"`
	TxnID   uint64 `json:"txnId,string"`
}

SubAccountTransferResponse represents a suabccount transfer history having the transaction id which is to be returned due to the transfer

type SubUserToBTCAssets

type SubUserToBTCAssets struct {
	Email      string `json:"email"`
	TotalAsset int64  `json:"totalAsset"`
}

SubUserToBTCAssets holds the number of BTC assets and the corresponding sub user email.

type SymbolPrice

type SymbolPrice struct {
	Symbol string  `json:"symbol"`
	Price  float64 `json:"price,string"`
}

SymbolPrice represents a symbol and it's price.

type SymbolPrices

type SymbolPrices []SymbolPrice

SymbolPrices lis tof Symbol Price

type TickerStream

type TickerStream struct {
	EventType              string    `json:"e"`
	EventTime              time.Time `json:"E"`
	Symbol                 string    `json:"s"`
	PriceChange            float64   `json:"p,string"`
	PriceChangePercent     float64   `json:"P,string"`
	WeightedAvgPrice       float64   `json:"w,string"`
	ClosePrice             float64   `json:"x,string"`
	LastPrice              float64   `json:"c,string"`
	LastPriceQuantity      float64   `json:"Q,string"`
	BestBidPrice           float64   `json:"b,string"`
	BestBidQuantity        float64   `json:"B,string"`
	BestAskPrice           float64   `json:"a,string"`
	BestAskQuantity        float64   `json:"A,string"`
	OpenPrice              float64   `json:"o,string"`
	HighPrice              float64   `json:"h,string"`
	LowPrice               float64   `json:"l,string"`
	TotalTradedVolume      float64   `json:"v,string"`
	TotalTradedQuoteVolume float64   `json:"q,string"`
	OpenTime               time.Time `json:"O"`
	CloseTime              time.Time `json:"C"`
	FirstTradeID           int64     `json:"F"`
	LastTradeID            int64     `json:"L"`
	NumberOfTrades         int64     `json:"n"`
}

TickerStream holds the ticker stream data

func (*TickerStream) UnmarshalJSON

func (a *TickerStream) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including (EventTime , OpenTime, and TransactionTime) timestamp

type Trade

type Trade struct {
	Symbol          string    `json:"symbol"`
	ID              uint64    `json:"id"`
	OrderID         uint64    `json:"orderId"`
	OrderListID     int64     `json:"orderListId"`
	Price           float64   `json:"price"`
	Qty             float64   `json:"qty"`
	QuoteQty        float64   `json:"quoteQty"`
	Commission      float64   `json:"commission"`
	CommissionAsset float64   `json:"commissionAsset"`
	Time            time.Time `json:"time"`
	IsBuyer         bool      `json:"isBuyer"`
	IsMaker         bool      `json:"isMaker"`
	IsBestMatch     bool      `json:"isBestMatch"`
}

Trade this struct represents a trade response.

func (*Trade) UnmarshalJSON

func (a *Trade) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type TradeFee

type TradeFee struct {
	Symbol string  `json:"symbol"`
	Maker  float64 `json:"maker"`
	Taker  float64 `json:"taker"`
}

TradeFee represents the symbol and corresponding maker and taker trading fee value.

type TradeFeeList

type TradeFeeList struct {
	TradeFee []TradeFee `json:"tradeFee"`
	Success  bool       `json:"success,omitempty"`
}

TradeFeeList list of trading fee for different trade symbols.

type TradeStatus

type TradeStatus struct {
	IsLocked           bool                                  `json:"isLocked"`
	PlannedRecoverTime uint64                                `json:"plannedRecoverTime"`
	TriggerCondition   map[string]uint64                     `json:"triggerCondition"`
	Indicators         map[string]TradingStatusIndicatorItem `json:"indicators"`
	UpdateTime         time.Time                             `json:"updateTime"`
}

TradeStatus represents trade status and holds list of trade status indicator Item instances.

func (*TradeStatus) UnmarshalJSON

func (a *TradeStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type TradeStream

type TradeStream struct {
	EventType      string    `json:"e"`
	EventTime      time.Time `json:"E"`
	Symbol         string    `json:"s"`
	TradeID        int64     `json:"t"`
	Price          string    `json:"p"`
	Quantity       string    `json:"q"`
	BuyerOrderID   int64     `json:"b"`
	SellerOrderID  int64     `json:"a"`
	TimeStamp      time.Time `json:"T"`
	Maker          bool      `json:"m"`
	BestMatchPrice bool      `json:"M"`
}

TradeStream holds the trade stream data

func (*TradeStream) UnmarshalJSON

func (a *TradeStream) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the (Timestamp and EventTime) timestamp

type TradingStatusIndicatorItem

type TradingStatusIndicatorItem struct {
	IndicatorSymbol  string  `json:"i"`
	CountOfAllOrders float32 `json:"c"`
	CurrentValue     float32 `json:"v"`
	TriggerValue     float32 `json:"t"`
}

TradingStatusIndicatorItem represents Trade Status Indication

type TransferHistory

type TransferHistory struct {
	From      string    `json:"from"`
	To        string    `json:"to"`
	Asset     string    `json:"asset"`
	Qty       uint64    `json:"qty,string"`
	TimeStamp time.Time `json:"time"`
}

TransferHistory a single asset transfer history between Sub accounts

func (*TransferHistory) UnmarshalJSON

func (a *TransferHistory) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the timestamp

type UserAccountStream

type UserAccountStream struct {
	ListenKey string `json:"listenKey"`
}

UserAccountStream represents the response for getting the listen key for the websocket

type WebsocketAggregateTradeStream

type WebsocketAggregateTradeStream struct {
	EventType        string    `json:"e"`
	EventTime        time.Time `json:"E"`
	Symbol           string    `json:"s"`
	AggregateTradeID int64     `json:"a"`
	Price            float64   `json:"p,string"`
	Quantity         float64   `json:"q,string"`
	FirstTradeID     int64     `json:"f"`
	LastTradeID      int64     `json:"l"`
	TradeTime        time.Time `json:"T"`
	IsMaker          bool      `json:"m"`
}

WebsocketAggregateTradeStream aggregate trade streams push data

func (*WebsocketAggregateTradeStream) UnmarshalJSON

func (a *WebsocketAggregateTradeStream) UnmarshalJSON(data []byte) error

UnmarshalJSON .. .

type WebsocketDepthDiffStream

type WebsocketDepthDiffStream struct {
	LastUpdateID int64       `json:"lastUpdateId"`
	Bids         [][2]string `json:"bids"`
	Asks         [][2]string `json:"asks"`
}

WebsocketDepthDiffStream websocket response of depth diff stream

type WebsocketDepthStream

type WebsocketDepthStream struct {
	Event         string      `json:"e"`
	Timestamp     time.Time   `json:"E"`
	Pair          string      `json:"s"`
	FirstUpdateID int64       `json:"U"`
	LastUpdateID  int64       `json:"u"`
	UpdateBids    [][2]string `json:"b"`
	UpdateAsks    [][2]string `json:"a"`
}

WebsocketDepthStream is the difference for the update depth stream

func (*WebsocketDepthStream) UnmarshalJSON

func (a *WebsocketDepthStream) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the (Timestamp)timestamp

type WebsocketPayload

type WebsocketPayload struct {
	Method string        `json:"method"`
	Params []interface{} `json:"params"`
	ID     int64         `json:"id"`
}

WebsocketPayload defines the payload through the websocket connection

type WithdrawFiatRequestParams

type WithdrawFiatRequestParams struct {
	PaymentChannel string
	PaymentMethod  string
	PaymentAccount string
	FiatCurrency   string
	Amount         float64
	RecvWindow     uint64
}

WithdrawFiatRequestParams represents the fiat withdrawal request params.

type WithdrawStatusResponse

type WithdrawStatusResponse struct {
	ID             string  `json:"id"`
	Amount         float64 `json:"amount,string"`
	TransactionFee float64 `json:"transactionFee,string"`
	Coin           string  `json:"coin"`
	Status         int64   `json:"status"`
	Address        string  `json:"address"`
	ApplyTime      string  `json:"applyTime"`
	Network        string  `json:"network"`
	TransferType   int64   `json:"transferType"`
}

WithdrawStatusResponse defines a withdrawal status response

type WithdrawalRequestParam

type WithdrawalRequestParam struct {
	Coin            string  `json:"coin"`
	Network         string  `json:"network"`
	WithdrawOrderID string  `json:"withdrawOrderId"` // Client ID for withdraw
	Address         string  `json:"address"`
	AddressTag      string  `json:"addressTag"`
	Amount          float64 `json:"amount"`
	RecvWindow      uint64  `json:"recvWindow"`
}

WithdrawalRequestParam represents the params for the input parameters of Withdraw Crypto

type WithdrawalResponse

type WithdrawalResponse struct {
	ID string `json:"id"`
}

WithdrawalResponse holds the transaction id for a withdrawal action.

type WsAccountInfoData

type WsAccountInfoData struct {
	CanDeposit       bool      `json:"D"`
	CanTrade         bool      `json:"T"`
	CanWithdraw      bool      `json:"W"`
	EventTime        time.Time `json:"E"`
	LastUpdated      time.Time `json:"u"`
	BuyerCommission  float64   `json:"b"`
	MakerCommission  float64   `json:"m"`
	SellerCommission float64   `json:"s"`
	TakerCommission  float64   `json:"t"`
	EventType        string    `json:"e"`
	Currencies       []struct {
		Asset     string  `json:"a"`
		Available float64 `json:"f,string"`
		Locked    float64 `json:"l,string"`
	} `json:"B"`
}

WsAccountInfoData defines websocket account info data

type WsAccountPositionData

type WsAccountPositionData struct {
	Currencies []struct {
		Asset     string  `json:"a"`
		Available float64 `json:"f,string"`
		Locked    float64 `json:"l,string"`
	} `json:"B"`
	EventTime   time.Time `json:"E"`
	LastUpdated time.Time `json:"u"`
	EventType   string    `json:"e"`
}

WsAccountPositionData defines websocket account position data

type WsBalanceUpdateData

type WsBalanceUpdateData struct {
	EventTime    time.Time `json:"E"`
	ClearTime    time.Time `json:"T"`
	BalanceDelta float64   `json:"d,string"`
	Asset        string    `json:"a"`
	EventType    string    `json:"e"`
}

WsBalanceUpdateData defines websocket account balance data.

type WsListStatus

type WsListStatus struct {
	Stream string           `json:"stream"`
	Data   WsListStatusData `json:"data"`
}

WsListStatus holder for websocket account listing status response including the stream information

func (*WsListStatus) UnmarshalJSON

func (a *WsListStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON deserialises the JSON info, including the (EventTime , and TransactionTime) timestamp

type WsListStatusData

type WsListStatusData struct {
	ListClientOrderID string    `json:"C"`
	EventTime         time.Time `json:"E"`
	ListOrderStatus   string    `json:"L"`
	Orders            []struct {
		ClientOrderID string `json:"c"`
		OrderID       int64  `json:"i"`
		Symbol        string `json:"s"`
	} `json:"O"`
	TransactionTime time.Time `json:"T"`
	ContingencyType string    `json:"c"`
	EventType       string    `json:"e"`
	OrderListID     int64     `json:"g"`
	ListStatusType  string    `json:"l"`
	RejectionReason string    `json:"r"`
	Symbol          string    `json:"s"`
}

WsListStatusData holder for websocket account listing status response.

type WsOrderUpdateData

type WsOrderUpdateData struct {
	EventType                         string    `json:"e"`
	EventTime                         time.Time `json:"E"`
	Symbol                            string    `json:"s"`
	ClientOrderID                     string    `json:"c"`
	Side                              string    `json:"S"`
	OrderType                         string    `json:"o"`
	TimeInForce                       string    `json:"f"`
	Quantity                          float64   `json:"q,string"`
	Price                             float64   `json:"p,string"`
	StopPrice                         float64   `json:"P,string"`
	IcebergQuantity                   float64   `json:"F,string"`
	OrderListID                       int64     `json:"g"`
	CancelledClientOrderID            string    `json:"C"`
	CurrentExecutionType              string    `json:"x"`
	OrderStatus                       string    `json:"X"`
	RejectionReason                   string    `json:"r"`
	OrderID                           int64     `json:"i"`
	LastExecutedQuantity              float64   `json:"l,string"`
	CumulativeFilledQuantity          float64   `json:"z,string"`
	LastExecutedPrice                 float64   `json:"L,string"`
	Commission                        float64   `json:"n,string"`
	CommissionAsset                   string    `json:"N"`
	TransactionTime                   time.Time `json:"T"`
	TradeID                           int64     `json:"t"`
	Ignored                           int64     `json:"I"` // Must be ignored explicitly, otherwise it overwrites 'i'.
	IsOnOrderBook                     bool      `json:"w"`
	IsMaker                           bool      `json:"m"`
	Ignored2                          bool      `json:"M"` // See the comment for "I".
	OrderCreationTime                 time.Time `json:"O"`
	CumulativeQuoteTransactedQuantity float64   `json:"Z,string"`
	LastQuoteAssetTransactedQuantity  float64   `json:"Y,string"`
	QuoteOrderQuantity                float64   `json:"Q,string"`
}

WsOrderUpdateData defines websocket account order update data

Jump to

Keyboard shortcuts

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