Documentation ¶
Index ¶
- Constants
- func ComputeSHA1(mapParamsJson string, secretKey string) string
- type AccountBalances
- type Bcex
- func (e *Bcex) ApiKeyGET(strRequestPath string, mapParams map[string]string) string
- func (e *Bcex) ApiKeyPost(strRequestPath string, mapParams map[string]interface{}) string
- func (e *Bcex) CanDeposit(coin *coin.Coin) bool
- func (e *Bcex) CanWithdraw(coin *coin.Coin) bool
- func (e *Bcex) CancelAllOrder() error
- func (e *Bcex) CancelOrder(order *exchange.Order) error
- func (e *Bcex) DeleteCoin(coin *coin.Coin)
- func (e *Bcex) DeletePair(pair *pair.Pair)
- func (e *Bcex) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *Bcex) GetBalance(coin *coin.Coin) float64
- func (e *Bcex) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *Bcex) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *Bcex) GetCoinList() []string
- func (e *Bcex) GetCoins() []*coin.Coin
- func (e *Bcex) GetCoinsData() error
- func (e *Bcex) GetConfirmation(coin *coin.Coin) int
- func (e *Bcex) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *Bcex) GetFee(pair *pair.Pair) float64
- func (e *Bcex) GetID() int
- func (e *Bcex) GetLotSize(pair *pair.Pair) float64
- func (e *Bcex) GetName() exchange.ExchangeName
- func (e *Bcex) GetPairBySymbol(symbol string) *pair.Pair
- func (e *Bcex) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *Bcex) GetPairs() []*pair.Pair
- func (e *Bcex) GetPairsData() error
- func (e *Bcex) GetPriceFilter(pair *pair.Pair) float64
- func (e *Bcex) GetSymbolByCoin(coin *coin.Coin) string
- func (e *Bcex) GetSymbolByPair(pair *pair.Pair) string
- func (e *Bcex) GetTradingWebURL(pair *pair.Pair) string
- func (e *Bcex) GetTxFee(coin *coin.Coin) float64
- func (e *Bcex) HasPair(pair *pair.Pair) bool
- func (e *Bcex) InitData() error
- func (e *Bcex) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Bcex) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Bcex) ListOrders() ([]*exchange.Order, error)
- func (e *Bcex) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *Bcex) OrderBook(pair *pair.Pair) (*exchange.Maker, error)
- func (e *Bcex) OrderStatus(order *exchange.Order) error
- func (e *Bcex) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *Bcex) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *Bcex) UpdateAllBalances()
- func (e *Bcex) UpdateConstraint()
- func (e *Bcex) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type CoinsData
- type JsonResponse
- type OrderBook
- type PairDetail
- type PairsData
- type PlaceOrder
Constants ¶
const ( DEFAULT_ID = 47 DEFAULT_TAKER_FEE = 0.002 DEFAULT_MAKER_FEE = 0.001 DEFAULT_TXFEE = 0.005 DEFAULT_WITHDRAW = true DEFAULT_DEPOSIT = true DEFAULT_CONFIRMATION = 2 DEFAULT_LISTED = true )
const (
API_URL string = "http://api.bcex.top"
)
Variables ¶
This section is empty.
Functions ¶
func ComputeSHA1 ¶
Types ¶
type AccountBalances ¶
type AccountBalances struct { Count int `json:"count"` Data []struct { // UserID interface{} `json:"user_id"` // OrgID int `json:"org_id"` Token string `json:"token"` // TokenAs string `json:"token_as"` Usable string `json:"usable"` Locked string `json:"locked"` Total string `json:"total"` } `json:"data"` }
this exchange often return different type for the same field
type Bcex ¶
type Bcex 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 CreateBcex ¶
*************************************************
func (*Bcex) 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 (*Bcex) ApiKeyPost ¶
func (*Bcex) CancelAllOrder ¶
func (*Bcex) DeleteCoin ¶
func (*Bcex) DeletePair ¶
func (*Bcex) DoAccountOperation ¶
func (e *Bcex) DoAccountOperation(operation *exchange.AccountOperation) error
************** Private API **************
func (*Bcex) GetCoinConstraint ¶
func (e *Bcex) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*Bcex) GetCoinList ¶
func (*Bcex) 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 (*Bcex) GetConstraintFetchMethod ¶
func (e *Bcex) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*Bcex) GetName ¶
func (e *Bcex) GetName() exchange.ExchangeName
func (*Bcex) GetPairConstraint ¶
func (e *Bcex) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*Bcex) 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) this require an API key
func (*Bcex) LoadPublicData ¶
func (e *Bcex) LoadPublicData(operation *exchange.PublicOperation) error
func (*Bcex) 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 (*Bcex) SetCoinConstraint ¶
func (e *Bcex) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*Bcex) SetPairConstraint ¶
func (e *Bcex) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*Bcex) UpdateAllBalances ¶
func (e *Bcex) UpdateAllBalances()
func (*Bcex) UpdateConstraint ¶
func (e *Bcex) UpdateConstraint()
type JsonResponse ¶
type JsonResponse struct { Code int `json:"code"` Message string `json:"msg"` Data json.RawMessage `json:"data"` }
type PairDetail ¶
type PairDetail struct { ID int `json:"id"` Vol interface{} `json:"vol"` Market string `json:"market"` MarketAs string `json:"market_as"` Token string `json:"token"` TokenAs string `json:"token_as"` Amount interface{} `json:"amount"` MaxPrice string `json:"max_price"` MinPrice string `json:"min_price"` OpenPrice string `json:"open_price"` IsUp string `json:"is_up"` Last string `json:"last"` PrevPrice string `json:"prev_price"` PPrecision string `json:"p_precision"` NPrecision string `json:"n_precision"` LatestPrice string `json:"latest_price"` PercentChange string `json:"percent_change"` Currency struct { CNY string `json:"CNY"` KRW string `json:"KRW"` } `json:"currency"` }
type PairsData ¶
type PairsData struct {
Main map[string][]*PairDetail `json:"main"`
}
type PlaceOrder ¶
type PlaceOrder struct { ID int `json:"id"` Status int `json:"status"` OrderNo string `json:"order_no"` Type string `json:"type"` MarketType string `json:"market_type"` AccountID int `json:"account_id"` OrgID int `json:"org_id"` UserID int `json:"user_id"` Market string `json:"market"` Token string `json:"token"` Price string `json:"price"` Amount string `json:"amount"` Volume string `json:"volume"` MatchedAmount string `json:"matched_amount"` MatchedVolume string `json:"matched_volume"` AvgPrice string `json:"avg_price"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` }