Documentation
¶
Index ¶
- Constants
- type AccountBalances
- type Binance
- func (e *Binance) ApiKeyGet(mapParams map[string]string, strRequestPath string) string
- func (e *Binance) ApiKeyRequest(strMethod string, mapParams map[string]string, strRequestPath string) string
- func (e *Binance) CanDeposit(coin *coin.Coin) bool
- func (e *Binance) CanWithdraw(coin *coin.Coin) bool
- func (e *Binance) CancelAllOrder() error
- func (e *Binance) CancelOrder(order *exchange.Order) error
- func (e *Binance) ContractApiKeyRequest(strMethod string, mapParams map[string]string, strRequestPath string, ...) string
- func (e *Binance) DeleteCoin(coin *coin.Coin)
- func (e *Binance) DeletePair(pair *pair.Pair)
- func (e *Binance) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *Binance) GetBalance(coin *coin.Coin) float64
- func (e *Binance) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *Binance) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *Binance) GetCoins() []*coin.Coin
- func (e *Binance) GetCoinsData() error
- func (e *Binance) GetConfirmation(coin *coin.Coin) int
- func (e *Binance) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *Binance) GetFee(pair *pair.Pair) float64
- func (e *Binance) GetID() int
- func (e *Binance) GetLotSize(pair *pair.Pair) float64
- func (e *Binance) GetName() exchange.ExchangeName
- func (e *Binance) GetPairBySymbol(symbol string) *pair.Pair
- func (e *Binance) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *Binance) GetPairs() []*pair.Pair
- func (e *Binance) GetPairsData() error
- func (e *Binance) GetPriceFilter(pair *pair.Pair) float64
- func (e *Binance) GetSymbolByCoin(coin *coin.Coin) string
- func (e *Binance) GetSymbolByPair(pair *pair.Pair) string
- func (e *Binance) GetTradingWebURL(pair *pair.Pair) string
- func (e *Binance) GetTxFee(coin *coin.Coin) float64
- func (e *Binance) HasPair(pair *pair.Pair) bool
- func (e *Binance) InitData() error
- func (e *Binance) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Binance) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Binance) ListOrders() ([]*exchange.Order, error)
- func (e *Binance) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *Binance) OrderBook(p *pair.Pair) (*exchange.Maker, error)
- func (e *Binance) OrderStatus(order *exchange.Order) error
- func (e *Binance) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *Binance) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *Binance) TestApi() string
- func (e *Binance) UpdateAllBalances()
- func (e *Binance) UpdateConstraint()
- func (e *Binance) WApiKeyRequest(strMethod string, mapParams map[string]string, strRequestPath string) string
- func (e *Binance) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type CloseOrders
- type CoinsData
- type ContractBalance
- type ContractCancelOrder
- type ContractOpenOrders
- type ContractOrderBook
- type ContractOrderStatus
- type ContractPlaceOrder
- type ContractTransferHistory
- type DepositAddress
- type DepositHistory
- type FutureBalance
- type FutureLeverage
- type OpenOrders
- type OrderBook
- type PairsData
- type PlaceOrder
- type SubAccountBalances
- type SubAccountList
- type SubTransfer
- type TickerPrice
- type TradeHistory
- type TransferHistory
- type WithdrawHistory
- type WithdrawResponse
Constants ¶
const ( API_URL = "https://api.binance.com" CONTRACT_URL = "https://fapi.binance.com" CONTRACT_TESTNET_URL = "https://testnet.binancefuture.com" //// )
The Base Endpoint URL
const ( DEFAULT_ID = 1 DEFAULT_TAKER_FEE = 0.001 DEFAULT_MAKER_FEE = 0.001 DEFAULT_LOT_SIZE = 0.00000001 DEFAULT_PRICE_FILTER = 0.00000001 //PRICE FILTER DEFAULT_TXFEE = 0.005 DEFAULT_WITHDRAW = true DEFAULT_DEPOSIT = true DEFAULT_CONFIRMATION = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalances ¶
type AccountBalances struct { MakerCommission int `json:"makerCommission"` TakerCommission int `json:"takerCommission"` BuyerCommission int `json:"buyerCommission"` SellerCommission int `json:"sellerCommission"` CanTrade bool `json:"canTrade"` CanWithdraw bool `json:"canWithdraw"` CanDeposit bool `json:"canDeposit"` Balances []struct { Asset string `json:"asset"` Free string `json:"free"` Locked string `json:"locked"` } `json:"balances"` }
type Binance ¶
type Binance struct { ID int Name string `bson:"name"` Website string `bson:"website"` API_KEY string API_SECRET string Source exchange.DataSource // / exchange API / microservicve api 1 / PSQL SourceURI string }
func CreateBinance ¶
*************************************************
func (*Binance) ApiKeyGet ¶
************** Signature Http Request ************** Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests
func (*Binance) ApiKeyRequest ¶
func (e *Binance) ApiKeyRequest(strMethod string, mapParams map[string]string, strRequestPath string) string
Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests
func (*Binance) CancelAllOrder ¶
func (*Binance) ContractApiKeyRequest ¶
func (*Binance) DeleteCoin ¶
func (*Binance) DeletePair ¶
func (*Binance) DoAccountOperation ¶
func (e *Binance) DoAccountOperation(operation *exchange.AccountOperation) error
func (*Binance) GetCoinConstraint ¶
func (e *Binance) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*Binance) GetCoinsData ¶
************** Public API ************** Get Coins Information (If API provide) Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)
func (*Binance) GetConstraintFetchMethod ¶
func (e *Binance) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*Binance) GetName ¶
func (e *Binance) GetName() exchange.ExchangeName
func (*Binance) GetPairConstraint ¶
func (e *Binance) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*Binance) GetPairsData ¶
GetPairsData - Get Pairs Information (If API provide)
Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Modify API Path(strRequestUrl)
func (*Binance) LoadPublicData ¶
func (e *Binance) LoadPublicData(operation *exchange.PublicOperation) error
************** PUBLIC API **************
func (*Binance) OrderBook ¶
Get Pair Market Depth Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Add Model of API Response Step 3: Get Exchange Pair Code ex. symbol := e.GetPairCode(p) Step 4: Modify API Path(strRequestUrl) Step 5: Add Params - Depend on API request Step 6: Convert the response to Standard Maker struct
func (*Binance) SetCoinConstraint ¶
func (e *Binance) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*Binance) SetPairConstraint ¶
func (e *Binance) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*Binance) UpdateAllBalances ¶
func (e *Binance) UpdateAllBalances()
func (*Binance) UpdateConstraint ¶
func (e *Binance) UpdateConstraint()
func (*Binance) WApiKeyRequest ¶
func (e *Binance) WApiKeyRequest(strMethod string, mapParams map[string]string, strRequestPath string) string
Method: API Request and Signature is required Step 1: Change Instance Name (e *<exchange Instance Name>) Step 2: Create mapParams Depend on API Signature request Step 3: Add HttpGetRequest below strUrl if API has different requests
type CloseOrders ¶
type CloseOrders []struct { Symbol string `json:"symbol"` ID int `json:"id"` OrderID int `json:"orderId"` OrderListID int `json:"orderListId"` Price string `json:"price"` Qty string `json:"qty"` QuoteQty string `json:"quoteQty"` Commission string `json:"commission"` CommissionAsset string `json:"commissionAsset"` Time int64 `json:"time"` IsBuyer bool `json:"isBuyer"` IsMaker bool `json:"isMaker"` IsBestMatch bool `json:"isBestMatch"` }
type CoinsData ¶
type CoinsData []struct { Coin string `json:"coin"` DepositAllEnable bool `json:"depositAllEnable"` Free string `json:"free"` Freeze string `json:"freeze"` Ipoable string `json:"ipoable"` Ipoing string `json:"ipoing"` IsLegalMoney bool `json:"isLegalMoney"` Locked string `json:"locked"` Name string `json:"name"` NetworkList []struct { AddressRegex string `json:"addressRegex"` Coin string `json:"coin"` DepositDesc string `json:"depositDesc,omitempty"` DepositEnable bool `json:"depositEnable"` IsDefault bool `json:"isDefault"` MemoRegex string `json:"memoRegex"` MinConfirm int `json:"minConfirm"` Name string `json:"name"` Network string `json:"network"` ResetAddressStatus bool `json:"resetAddressStatus"` SpecialTips string `json:"specialTips"` UnLockConfirm int `json:"unLockConfirm"` WithdrawDesc string `json:"withdrawDesc,omitempty"` WithdrawEnable bool `json:"withdrawEnable"` WithdrawFee string `json:"withdrawFee"` WithdrawMin string `json:"withdrawMin"` InsertTime int64 `json:"insertTime,omitempty"` UpdateTime int64 `json:"updateTime,omitempty"` WithdrawIntegerMultiple string `json:"withdrawIntegerMultiple,omitempty"` } `json:"networkList"` Storage string `json:"storage"` Trading bool `json:"trading"` WithdrawAllEnable bool `json:"withdrawAllEnable"` Withdrawing string `json:"withdrawing"` }
type ContractBalance ¶
type ContractBalance struct { Assets []struct { Asset string `json:"asset"` InitialMargin string `json:"initialMargin"` MaintMargin string `json:"maintMargin"` MarginBalance string `json:"marginBalance"` MaxWithdrawAmount string `json:"maxWithdrawAmount"` OpenOrderInitialMargin string `json:"openOrderInitialMargin"` PositionInitialMargin string `json:"positionInitialMargin"` UnrealizedProfit string `json:"unrealizedProfit"` WalletBalance string `json:"walletBalance"` } `json:"assets"` CanDeposit bool `json:"canDeposit"` CanTrade bool `json:"canTrade"` CanWithdraw bool `json:"canWithdraw"` FeeTier int `json:"feeTier"` MaxWithdrawAmount string `json:"maxWithdrawAmount"` Positions []struct { Isolated bool `json:"isolated"` Leverage string `json:"leverage"` InitialMargin string `json:"initialMargin"` MaintMargin string `json:"maintMargin"` OpenOrderInitialMargin string `json:"openOrderInitialMargin"` PositionInitialMargin string `json:"positionInitialMargin"` Symbol string `json:"symbol"` UnrealizedProfit string `json:"unrealizedProfit"` } `json:"positions"` TotalInitialMargin string `json:"totalInitialMargin"` TotalMaintMargin string `json:"totalMaintMargin"` TotalMarginBalance string `json:"totalMarginBalance"` TotalOpenOrderInitialMargin string `json:"totalOpenOrderInitialMargin"` TotalPositionInitialMargin string `json:"totalPositionInitialMargin"` TotalUnrealizedProfit string `json:"totalUnrealizedProfit"` TotalWalletBalance string `json:"totalWalletBalance"` UpdateTime int `json:"updateTime"` }
type ContractCancelOrder ¶
type ContractCancelOrder struct { ClientOrderID string `json:"clientOrderId"` CumQty string `json:"cumQty"` CumQuote string `json:"cumQuote"` ExecutedQty string `json:"executedQty"` OrderID int `json:"orderId"` OrigQty string `json:"origQty"` Price string `json:"price"` ReduceOnly bool `json:"reduceOnly"` Side string `json:"side"` Status string `json:"status"` StopPrice string `json:"stopPrice"` Symbol string `json:"symbol"` TimeInForce string `json:"timeInForce"` OrigType string `json:"origType"` Type string `json:"type"` ActivatePrice string `json:"activatePrice"` PriceRate string `json:"priceRate"` UpdateTime int64 `json:"updateTime"` WorkingType string `json:"workingType"` }
type ContractOpenOrders ¶
type ContractOpenOrders []struct { AvgPrice string `json:"avgPrice"` ClientOrderID string `json:"clientOrderId"` CumQuote string `json:"cumQuote"` ExecutedQty string `json:"executedQty"` OrderID int `json:"orderId"` OrigQty string `json:"origQty"` OrigType string `json:"origType"` Price string `json:"price"` ReduceOnly bool `json:"reduceOnly"` Side string `json:"side"` PositionSide string `json:"positionSide"` Status string `json:"status"` StopPrice string `json:"stopPrice"` Symbol string `json:"symbol"` Time int64 `json:"time"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` ActivatePrice string `json:"activatePrice"` PriceRate string `json:"priceRate"` UpdateTime int64 `json:"updateTime"` WorkingType string `json:"workingType"` }
type ContractOrderBook ¶
type ContractOrderStatus ¶
type ContractOrderStatus struct { AvgPrice string `json:"avgPrice"` ClientOrderID string `json:"clientOrderId"` CumQuote string `json:"cumQuote"` ExecutedQty string `json:"executedQty"` OrderID int `json:"orderId"` OrigQty string `json:"origQty"` OrigType string `json:"origType"` Price string `json:"price"` ReduceOnly bool `json:"reduceOnly"` Side string `json:"side"` Status string `json:"status"` StopPrice string `json:"stopPrice"` Symbol string `json:"symbol"` Time int64 `json:"time"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` ActivatePrice string `json:"activatePrice"` PriceRate string `json:"priceRate"` UpdateTime int64 `json:"updateTime"` WorkingType string `json:"workingType"` }
type ContractPlaceOrder ¶
type ContractPlaceOrder struct { ClientOrderID string `json:"clientOrderId"` CumQuote string `json:"cumQuote"` ExecutedQty string `json:"executedQty"` OrderID int `json:"orderId"` OrigQty string `json:"origQty"` Price string `json:"price"` ReduceOnly bool `json:"reduceOnly"` Side string `json:"side"` Status string `json:"status"` StopPrice string `json:"stopPrice"` Symbol string `json:"symbol"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` ActivatePrice string `json:"activatePrice"` PriceRate string `json:"priceRate"` UpdateTime int64 `json:"updateTime"` WorkingType string `json:"workingType"` }
type ContractTransferHistory ¶
type DepositAddress ¶
type DepositHistory ¶
type FutureBalance ¶
type FutureBalance struct { AccountAlias string `json:"accountAlias"` Asset string `json:"asset"` Balance string `json:"balance"` CrossWalletBalance string `json:"crossWalletBalance"` CrossUnPnl string `json:"crossUnPnl"` AvailableBalance string `json:"availableBalance"` MaxWithdrawAmount string `json:"maxWithdrawAmount"` }
type FutureLeverage ¶
type OpenOrders ¶
type OpenOrders []struct { Symbol string `json:"symbol"` OrderID int `json:"orderId"` OrderListID int `json:"orderListId"` ClientOrderID string `json:"clientOrderId"` Price string `json:"price"` OrigQty string `json:"origQty"` ExecutedQty string `json:"executedQty"` CummulativeQuoteQty string `json:"cummulativeQuoteQty"` Status string `json:"status"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` Side string `json:"side"` StopPrice string `json:"stopPrice"` IcebergQty string `json:"icebergQty"` Time int64 `json:"time"` UpdateTime int64 `json:"updateTime"` IsWorking bool `json:"isWorking"` OrigQuoteOrderQty string `json:"origQuoteOrderQty"` }
private operation
type PairsData ¶
type PairsData struct { Timezone string `json:"timezone"` ServerTime int64 `json:"serverTime"` RateLimits []struct { RateLimitType string `json:"rateLimitType"` Interval string `json:"interval"` Limit int `json:"limit"` } `json:"rateLimits"` ExchangeFilters []interface{} `json:"exchangeFilters"` Symbols []struct { Symbol string `json:"symbol"` Status string `json:"status"` BaseAsset string `json:"baseAsset"` BaseAssetPrecision int `json:"baseAssetPrecision"` QuoteAsset string `json:"quoteAsset"` QuotePrecision int `json:"quotePrecision"` OrderTypes []string `json:"orderTypes"` IcebergAllowed bool `json:"icebergAllowed"` Filters []struct { FilterType string `json:"filterType"` MinPrice string `json:"minPrice,omitempty"` MaxPrice string `json:"maxPrice,omitempty"` TickSize string `json:"tickSize,omitempty"` MinQty string `json:"minQty,omitempty"` MaxQty string `json:"maxQty,omitempty"` StepSize string `json:"stepSize,omitempty"` MinNotional string `json:"minNotional,omitempty"` Limit int `json:"limit,omitempty"` MaxNumAlgoOrders int `json:"maxNumAlgoOrders,omitempty"` } `json:"filters"` } `json:"symbols"` }
type PlaceOrder ¶
type PlaceOrder struct { Symbol string `json:"symbol"` OrderID int `json:"orderId"` ClientOrderID string `json:"clientOrderId"` TransactTime int64 `json:"transactTime"` Price string `json:"price"` OrigQty string `json:"origQty"` ExecutedQty string `json:"executedQty"` Status string `json:"status"` TimeInForce string `json:"timeInForce"` Type string `json:"type"` Side string `json:"side"` StopPrice string `json:"stopPrice"` IcebergQty string `json:"icebergQty"` Time int64 `json:"time"` Code int `json:"code"` Msg string `json:"msg"` }
type SubAccountBalances ¶
type SubAccountList ¶
type SubTransfer ¶
type TickerPrice ¶
type TradeHistory ¶
type TransferHistory ¶
type WithdrawHistory ¶
type WithdrawHistory []struct { Address string `json:"address"` Amount string `json:"amount"` ApplyTime time.Time `json:"applyTime"` Coin string `json:"coin"` ID string `json:"id"` WithdrawOrderID string `json:"withdrawOrderId,omitempty"` Network string `json:"network"` TransferType int `json:"transferType"` Status int `json:"status"` TxID string `json:"txId"` }