Documentation
¶
Index ¶
- Constants
- func Map2UrlQuery(mapParams map[string]interface{}) string
- func Map2UrlQueryUrl(mapParams map[string]interface{}) string
- type AccountBalances
- type Dcoin
- func (e *Dcoin) ApiKeyGet(strRequestPath string, mapParams map[string]interface{}) string
- func (e *Dcoin) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]interface{}) string
- func (e *Dcoin) CanDeposit(coin *coin.Coin) bool
- func (e *Dcoin) CanWithdraw(coin *coin.Coin) bool
- func (e *Dcoin) CancelAllOrder() error
- func (e *Dcoin) CancelOrder(order *exchange.Order) error
- func (e *Dcoin) DeleteCoin(coin *coin.Coin)
- func (e *Dcoin) DeletePair(pair *pair.Pair)
- func (e *Dcoin) DoAccountOperation(operation *exchange.AccountOperation) error
- func (e *Dcoin) GetBalance(coin *coin.Coin) float64
- func (e *Dcoin) GetCoinBySymbol(symbol string) *coin.Coin
- func (e *Dcoin) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
- func (e *Dcoin) GetCoins() []*coin.Coin
- func (e *Dcoin) GetCoinsData() error
- func (e *Dcoin) GetConfirmation(coin *coin.Coin) int
- func (e *Dcoin) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
- func (e *Dcoin) GetFee(pair *pair.Pair) float64
- func (e *Dcoin) GetID() int
- func (e *Dcoin) GetLotSize(pair *pair.Pair) float64
- func (e *Dcoin) GetName() exchange.ExchangeName
- func (e *Dcoin) GetPairBySymbol(symbol string) *pair.Pair
- func (e *Dcoin) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
- func (e *Dcoin) GetPairs() []*pair.Pair
- func (e *Dcoin) GetPairsData() error
- func (e *Dcoin) GetPriceFilter(pair *pair.Pair) float64
- func (e *Dcoin) GetSymbolByCoin(coin *coin.Coin) string
- func (e *Dcoin) GetSymbolByPair(pair *pair.Pair) string
- func (e *Dcoin) GetTradingWebURL(pair *pair.Pair) string
- func (e *Dcoin) GetTxFee(coin *coin.Coin) float64
- func (e *Dcoin) HasPair(pair *pair.Pair) bool
- func (e *Dcoin) InitData() error
- func (e *Dcoin) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Dcoin) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)
- func (e *Dcoin) ListOrders() ([]*exchange.Order, error)
- func (e *Dcoin) LoadPublicData(operation *exchange.PublicOperation) error
- func (e *Dcoin) OrderBook(pair *pair.Pair) (*exchange.Maker, error)
- func (e *Dcoin) OrderStatus(order *exchange.Order) error
- func (e *Dcoin) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
- func (e *Dcoin) SetPairConstraint(pairConstraint *exchange.PairConstraint)
- func (e *Dcoin) UpdateAllBalances()
- func (e *Dcoin) UpdateConstraint()
- func (e *Dcoin) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool
- type JsonResponse
- type OrderBook
- type OrderStatus
- type PairsData
- type PlaceOrder
Constants ¶
const ( DEFAULT_ID = 39 DEFAULT_TAKER_FEE = 0.002 DEFAULT_MAKER_FEE = 0.002 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 DEFAULT_LISTED = true )
const (
API_URL = "https://openapi.dcoin.com/open/api"
)
The Base Endpoint URL
Variables ¶
This section is empty.
Functions ¶
func Map2UrlQuery ¶
func Map2UrlQueryUrl ¶
Types ¶
type AccountBalances ¶
type AccountBalances struct { CoinList []struct { Coin string `json:"coin"` Normal float64 `json:"normal"` Locked float64 `json:"locked"` } `json:"coin_list"` }
********* Private API Structure*********
type Dcoin ¶
type Dcoin 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 CreateDcoin ¶
*************************************************
func (*Dcoin) ApiKeyGet ¶
************** 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 (*Dcoin) ApiKeyRequest ¶
func (e *Dcoin) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]interface{}) 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 (*Dcoin) CancelAllOrder ¶
func (*Dcoin) DeleteCoin ¶
func (*Dcoin) DeletePair ¶
func (*Dcoin) DoAccountOperation ¶
func (e *Dcoin) DoAccountOperation(operation *exchange.AccountOperation) error
************** Private API **************
func (*Dcoin) GetCoinConstraint ¶
func (e *Dcoin) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint
************** Coins on the Exchanges **************
func (*Dcoin) 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(strRequestPath)
func (*Dcoin) GetConstraintFetchMethod ¶
func (e *Dcoin) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod
*************** Exchange Constraint ***************
func (*Dcoin) GetName ¶
func (e *Dcoin) GetName() exchange.ExchangeName
func (*Dcoin) GetPairConstraint ¶
func (e *Dcoin) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint
************** Pairs on the Exchanges **************
func (*Dcoin) 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 (*Dcoin) LoadPublicData ¶
func (e *Dcoin) LoadPublicData(operation *exchange.PublicOperation) error
func (*Dcoin) 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 (*Dcoin) SetCoinConstraint ¶
func (e *Dcoin) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)
func (*Dcoin) SetPairConstraint ¶
func (e *Dcoin) SetPairConstraint(pairConstraint *exchange.PairConstraint)
func (*Dcoin) UpdateAllBalances ¶
func (e *Dcoin) UpdateAllBalances()
func (*Dcoin) UpdateConstraint ¶
func (e *Dcoin) UpdateConstraint()
type JsonResponse ¶
type JsonResponse struct { Code int `json:"code"` Msg string `json:"msg"` Data json.RawMessage `json:"data"` }
type OrderStatus ¶
type OrderStatus struct { OrderInfo struct { ID int `json:"id"` Side string `json:"side"` Symbol string `json:"symbol"` Type int `json:"type"` Price float64 `json:"price"` Volume float64 `json:"volume"` Status int `json:"status"` DealVolume float64 `json:"deal_volume"` TotalPrice float64 `json:"total_price"` Fee int `json:"fee"` AgePrice float64 `json:"average_price"` Ts int64 `json:"ts"` } `json:"order_info"` TradeList []struct { ID int `json:"id"` Price float64 `json:"price"` Volume float64 `json:"volume"` Direction string `json:"direction"` Ts int64 `json:"ts"` } `json:"trade_list"` }
type PairsData ¶
type PairsData []struct { Symbol string `json:"symbol"` CountCoin string `json:"count_coin"` AmountPrecision int `json:"amount_precision"` BaseCoin string `json:"base_coin"` PricePrecision int `json:"price_precision"` }
********* Public API Structure*********
type PlaceOrder ¶
type PlaceOrder struct {
OrderID int `json:"order_id"`
}