package
0.0.0-20250311023717-5c21e974eed8
Repository: https://github.com/thrasher-corp/gocryptotrader.git
Documentation: pkg.go.dev

# 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 our GoCryptoTrader Kanban board.

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.UpdateTicker(...)
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.UpdateOrderbook(...)
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

# Functions

GetRateLimit returns the rate limit for the exchange.

# Constants

crypto withdrawals status codes description.
crypto withdrawals status codes description.
crypto withdrawals status codes description.
crypto withdrawals status codes description.
crypto withdrawals status codes description.
crypto withdrawals status codes description.
crypto withdrawals status codes description.

# Variables

BinanceRequestParamsOrderLimit Limit order.
BinanceRequestParamsOrderLimitMarker LIMIT_MAKER.
BinanceRequestParamsOrderMarket Market order.
BinanceRequestParamsOrderStopLoss STOP_LOSS.
BinanceRequestParamsOrderStopLossLimit STOP_LOSS_LIMIT.
BinanceRequestParamsOrderTakeProfit TAKE_PROFIT.
BinanceRequestParamsOrderTakeProfitLimit TAKE_PROFIT_LIMIT.
BinanceRequestParamsTimeFOK FOK.
BinanceRequestParamsTimeGTC GTC.
BinanceRequestParamsTimeIOC IOC.

# Structs

Account holds the account data.
AccountStatusResponse holds information related to the User Account status information request.
AggregatedTrade holds aggregated trade information.
AggregatedTradeRequestParams holds request params.
AssetDistributionHistories this endpoint to query asset distribution records, including for staking, referrals and airdrops etc.
AssetHistory holds the asset type and translation info.
AssetInfo holds asset information.
AssetWalletDetail represents the wallet asset information.
AveragePrice holds current average symbol price.
Balance holds query order data.
BestPrice holds best price data.
Binanceus is the overarching type across this package.
CancelOrderRequestParams this struct will be used as a parameter for cancel order method.
CandleStick holds kline data.
CoinPairInfo holds supported coin pair for conversion with its detailed information.
CommonOrder instance holds the order information common to both for Order and OrderReportItem.
DepositAddress stores the deposit address info.
DepositHistory stores deposit history info.
ExchangeInfo holds the full exchange information type.
FiatAssetRecord asset information for fiat.
FiatAssetsHistory holds list of available fiat asset records.
FiatWithdrawalRequestParams to fetch your fiat (USD) withdrawal history.
GetOCOOrderRequestParams a parameter model to query specific list of OCO orders using their id.
GetTradesParams request param to get the trade history.
HistoricalTrade holds recent trade data.
HistoricalTradeParams represents historical trades request params.
KlinesRequestParams represents Klines request data.
KlineStream holds the kline stream data.
KlineStreamData defines kline streaming data.
NewOrderRequest request type.
NewOrderResponse represents trade order's detailed information.
OCBSOrder holds OCBS orders details.
OCBSOrderRequestParams holds parameters to retrieve OCBS orders.
OCBSTradeOrdersResponse holds the quantity and list of OCBS Orders.
OCOFullOrderResponse holds detailed OCO order information with the corresponding transaction time.
OCOOrderInputParams One-cancel-the-other order creation input Parameter.
OCOOrderReportItem this is used by the OCO order creating response.
OCOOrderResponse this model is to be used to fetch the response of create new OCO order response.
OCOOrdersDeleteRequestParams holds the params to delete a new order.
OCOOrdersRequestParams a parameter model to query from list of OCO orders.
Order struct represents an ordinary order response.
OrderBook actual structured data that can be used for orderbook.
OrderBookData is resp data from orderbook endpoint.
OrderBookDataRequestParams represents Klines request data.
OrderbookItem stores an individual orderbook item.
OrderBookTickerStream contains websocket orderbook data.
OrderRateLimit holds rate limits type, interval, and related information of trade orders.
OrderRequestParams this struct will be used to get a order and its related information.
OrderShortResponse holds symbol Identification information of trade orders.
OTCTradeOrder holds OTC(over-the-counter) orders response.
OTCTradeOrderRequestParams request param for Over-the-Counter trade order params.
OTCTradeOrderResponse holds OTC(over-the-counter) order identification and status information.
PriceChangeStats contains statistics for the last 24 hours trade.
Quote holds quote information for from-to-coin pair.
RecentTrade holds recent trade data.
RecentTradeRequestParams represents Klines request data.
ReferralRewardHistoryResponse holds reward history response.
ReferralWithdrawalItem holds reward history item.
RequestQuoteParams a parameter model to query quote information.
Response holds basic binance api response data.
ServerTime holds the exchange server time.
SpotAssetsSnapshotResponse represents spot asset types snapshot information.
SpotUSDMasterAccounts holds the USD assets of a sub user.
SubAccount holds a single sub account instance in a Binance US account.
SubAccountAssets holds all the balance and email of a subaccount.
SubAccountDepositAddress holds sub-accounts deposit address information.
SubAccountDepositAddressRequestParams holds query parameters for Sub-account deposit addresses.
SubAccountDepositItem holds the sub-account deposit information.
SubAccountStatus represents single sub accounts status information.
SubAccountTransferRequestParams contains argument variables holder used to transfer an asset from one account to another subaccount.
SubAccountTransferResponse represents a suabccount transfer history having the transaction id which is to be returned due to the transfer.
SubUserToBTCAssets holds the number of BTC assets and the corresponding sub user email.
SymbolPrice represents a symbol and it's price.
TickerStream holds the ticker stream data.
Trade this struct represents a trade response.
TradeFee represents the symbol and corresponding maker and taker trading fee value.
TradeFeeList list of trading fee for different trade symbols.
TradeStatus represents trade status and holds list of trade status indicator Item instances.
TradeStream holds the trade stream data.
TradingStatusIndicatorItem represents Trade Status Indication.
TransferHistory a single asset transfer history between Sub accounts.
UserAccountStream represents the response for getting the listen key for the websocket.
WebsocketAggregateTradeStream aggregate trade streams push data.
WebsocketDepthDiffStream websocket response of depth diff stream.
WebsocketDepthStream is the difference for the update depth stream.
WebsocketPayload defines the payload through the websocket connection.
WithdrawalRequestParam represents the params for the input parameters of Withdraw Crypto.
WithdrawalResponse holds the transaction id for a withdrawal action.
WithdrawFiatRequestParams represents the fiat withdrawal request params.
WithdrawStatusResponse defines a withdrawal status response.
WsAccountInfoData defines websocket account info data.
WsAccountPositionData defines websocket account position data.
WsBalanceUpdateData defines websocket account balance data.
WsListStatus holder for websocket account listing status response including the stream information.
WsListStatusData holder for websocket account listing status response.
WsOrderUpdateData defines websocket account order update data.

# Type aliases

AssetWalletList list of asset wallet details.
RequestParamsOrderType trade order type.
RequestParamsTimeForceType Time in force.
SymbolPrices lis tof Symbol Price.