Documentation ¶
Index ¶
- Constants
- type AccountBalances
- type BinanceDex
- func (e *BinanceDex) ApiKeyGet(strRequestPath string, mapParams map[string]string) string
- func (e *BinanceDex) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string) string
- func (e *BinanceDex) CanDeposit(coin *coin.Coin) bool
- func (e *BinanceDex) CanWithdraw(coin *coin.Coin) bool
- func (e *BinanceDex) CancelAllOrder() error
- func (e *BinanceDex) CancelOrder(order *exchange.Order) error
- func (e *BinanceDex) DeleteCoin(coin *coin.Coin)
- func (e *BinanceDex) DeletePair(pair *pair.Pair)
- func (e *BinanceDex) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *BinanceDex) GetBalance(coin *coin.Coin) float64
- func (e *BinanceDex) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *BinanceDex) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *BinanceDex) GetCoins() []*coin.Coin
- func (e *BinanceDex) GetCoinsData() error
- func (e *BinanceDex) GetConfirmation(coin *coin.Coin) int
- func (e *BinanceDex) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *BinanceDex) GetFee(pair *pair.Pair) float64
- func (e *BinanceDex) GetID() int
- func (e *BinanceDex) GetLotSize(pair *pair.Pair) float64
- func (e *BinanceDex) GetName() exchange.ExchangeName
- func (e *BinanceDex) GetPairBySymbol(symbol string) *pair.Pair
- func (e *BinanceDex) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *BinanceDex) GetPairs() []*pair.Pair
- func (e *BinanceDex) GetPairsData() error
- func (e *BinanceDex) GetPriceFilter(pair *pair.Pair) float64
- func (e *BinanceDex) GetSymbolByCoin(coin *coin.Coin) string
- func (e *BinanceDex) GetSymbolByPair(pair *pair.Pair) string
- func (e *BinanceDex) GetTradingWebURL(pair *pair.Pair) string
- func (e *BinanceDex) GetTxFee(coin *coin.Coin) float64
- func (e *BinanceDex) HasPair(pair *pair.Pair) bool
- func (e *BinanceDex) InitData() error
- func (e *BinanceDex) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *BinanceDex) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *BinanceDex) ListOrders() ([]*exchange.Order, error)
- func (e *BinanceDex) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *BinanceDex) OrderBook(p *pair.Pair) (*exchange.Maker, error)
- func (e *BinanceDex) OrderStatus(order *exchange.Order) error
- func (e *BinanceDex) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *BinanceDex) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *BinanceDex) UpdateAllBalances()
- func (e *BinanceDex) UpdateConstraint()
- func (e *BinanceDex) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type CoinsData
- type JsonResponse
- type OrderBook
- type PairsData
- type PlaceOrder
- type WithdrawResponse
Constants ¶
const ( DEFAULT_ID = 0 DEFAULT_TAKER_FEE = 0.002 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 )
const (
API_URL = "https://dex.binance.org"
)
The Base Endpoint URL
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountBalances ¶
type AccountBalances []struct { Asset string `json:"asset"` Total float64 `json:"total"` Available float64 `json:"available"` Locked float64 `json:"locked"` }
********* Private API Structure*********
type BinanceDex ¶
type BinanceDex struct { ID int Name string `bson:"name"` Website string `bson:"website"` API_KEY [32]byte API_SECRET [32]byte // secp256k1.PrivKeySecp256k1 // gored CI error here Source exchange.DataSource // / exchange API / microservicve api 1 / PSQL SourceURI string }
func CreateBinanceDex ¶
func CreateBinanceDex(config *exchange.Config) *BinanceDex
*************************************************
func (*BinanceDex) ApiKeyGet ¶
func (e *BinanceDex) ApiKeyGet(strRequestPath string, mapParams map[string]string) string
************** Signature Http Request ************** Method: API Get 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 (*BinanceDex) ApiKeyRequest ¶
func (e *BinanceDex) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]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
func (*BinanceDex) CanDeposit ¶
func (e *BinanceDex) CanDeposit(coin *coin.Coin) bool
func (*BinanceDex) CanWithdraw ¶
func (e *BinanceDex) CanWithdraw(coin *coin.Coin) bool
func (*BinanceDex) CancelAllOrder ¶
func (e *BinanceDex) CancelAllOrder() error
func (*BinanceDex) CancelOrder ¶
func (e *BinanceDex) CancelOrder(order *exchange.Order) error
func (*BinanceDex) DeleteCoin ¶
func (e *BinanceDex) DeleteCoin(coin *coin.Coin)
func (*BinanceDex) DeletePair ¶
func (e *BinanceDex) DeletePair(pair *pair.Pair)
func (*BinanceDex) DoAccountOperation ¶
func (e *BinanceDex) DoAccountOperation(operation *exchange.AccountOperation) error
************** Private API **************
func (*BinanceDex) GetBalance ¶
func (e *BinanceDex) GetBalance(coin *coin.Coin) float64
func (*BinanceDex) GetCoinBySymbol ¶
func (e *BinanceDex) GetCoinBySymbol(symbol string) *coin.Coin
func (*BinanceDex) GetCoinConstraint ¶
func (e *BinanceDex) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*BinanceDex) GetCoins ¶
func (e *BinanceDex) GetCoins() []*coin.Coin
func (*BinanceDex) GetCoinsData ¶
func (e *BinanceDex) GetCoinsData() error
************** 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(strRequestPath)
func (*BinanceDex) GetConfirmation ¶
func (e *BinanceDex) GetConfirmation(coin *coin.Coin) int
func (*BinanceDex) GetConstraintFetchMethod ¶
func (e *BinanceDex) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*BinanceDex) GetFee ¶
func (e *BinanceDex) GetFee(pair *pair.Pair) float64
*************** Pair Constraint ***************
func (*BinanceDex) GetID ¶
func (e *BinanceDex) GetID() int
*************** Exchange Information ***************
func (*BinanceDex) GetLotSize ¶
func (e *BinanceDex) GetLotSize(pair *pair.Pair) float64
func (*BinanceDex) GetName ¶
func (e *BinanceDex) GetName() exchange.ExchangeName
func (*BinanceDex) GetPairBySymbol ¶
func (e *BinanceDex) GetPairBySymbol(symbol string) *pair.Pair
func (*BinanceDex) GetPairConstraint ¶
func (e *BinanceDex) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*BinanceDex) GetPairs ¶
func (e *BinanceDex) GetPairs() []*pair.Pair
func (*BinanceDex) GetPairsData ¶
func (e *BinanceDex) GetPairsData() error
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 (*BinanceDex) GetPriceFilter ¶
func (e *BinanceDex) GetPriceFilter(pair *pair.Pair) float64
func (*BinanceDex) GetSymbolByCoin ¶
func (e *BinanceDex) GetSymbolByCoin(coin *coin.Coin) string
func (*BinanceDex) GetSymbolByPair ¶
func (e *BinanceDex) GetSymbolByPair(pair *pair.Pair) string
func (*BinanceDex) GetTradingWebURL ¶
func (e *BinanceDex) GetTradingWebURL(pair *pair.Pair) string
func (*BinanceDex) GetTxFee ¶
func (e *BinanceDex) GetTxFee(coin *coin.Coin) float64
*************** Coin Constraint ***************
func (*BinanceDex) InitData ¶
func (e *BinanceDex) InitData() error
func (*BinanceDex) ListOrders ¶
func (e *BinanceDex) ListOrders() ([]*exchange.Order, error)
func (*BinanceDex) LoadPublicData ¶
func (e *BinanceDex) LoadPublicData(operation *exchange.PublicOperation) error
func (*BinanceDex) 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.GetSymbolByPair(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 (*BinanceDex) OrderStatus ¶
func (e *BinanceDex) OrderStatus(order *exchange.Order) error
func (*BinanceDex) SetCoinConstraint ¶
func (e *BinanceDex) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*BinanceDex) SetPairConstraint ¶
func (e *BinanceDex) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*BinanceDex) UpdateAllBalances ¶
func (e *BinanceDex) UpdateAllBalances()
func (*BinanceDex) UpdateConstraint ¶
func (e *BinanceDex) UpdateConstraint()
type CoinsData ¶
type CoinsData []struct { Name string `json:"name"` Symbol string `json:"symbol"` OriginalSymbol string `json:"original_symbol"` TotalSupply string `json:"total_supply"` Owner string `json:"owner"` Mintable bool `json:"mintable"` }
********* Public API Structure*********
type JsonResponse ¶
type JsonResponse struct { Success bool `json:"success"` Message string `json:"message"` Data json.RawMessage `json:"data"` }
type PairsData ¶
type PairsData []struct { Symbol string `json:"symbol"` Status string `json:"status"` BaseAsset string `json:"baseAsset"` QuoteAsset string `json:"quoteAsset"` MakerFee float64 `json:"makerFee"` TakerFee float64 `json:"takerFee"` PriceFilter float64 `json:"priceFilter"` LotSize float64 `json:"lotSize"` }
type PlaceOrder ¶
type PlaceOrder struct { Symbol string `json:"symbol"` OrderID string `json:"orderId"` Side string `json:"side"` Type string `json:"type"` Price string `json:"price"` AveragePrice string `json:"executedQty"` OrigQty string `json:"origQty"` ExecutedQty string `json:"executedQty"` Status string `json:"status"` TimeInForce string `json:"timeInForce"` }