dcoin

package
v0.0.0-...-db5ea55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	API_URL = "https://openapi.dcoin.com/open/api"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

func Map2UrlQuery

func Map2UrlQuery(mapParams map[string]interface{}) string

func Map2UrlQueryUrl

func Map2UrlQueryUrl(mapParams map[string]interface{}) string

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 CreateDcoin(config *exchange.Config) *Dcoin

*************************************************

func (*Dcoin) ApiKeyGet

func (e *Dcoin) ApiKeyGet(strRequestPath string, mapParams map[string]interface{}) 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 (*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) CanDeposit

func (e *Dcoin) CanDeposit(coin *coin.Coin) bool

func (*Dcoin) CanWithdraw

func (e *Dcoin) CanWithdraw(coin *coin.Coin) bool

func (*Dcoin) CancelAllOrder

func (e *Dcoin) CancelAllOrder() error

func (*Dcoin) CancelOrder

func (e *Dcoin) CancelOrder(order *exchange.Order) error

func (*Dcoin) DeleteCoin

func (e *Dcoin) DeleteCoin(coin *coin.Coin)

func (*Dcoin) DeletePair

func (e *Dcoin) DeletePair(pair *pair.Pair)

func (*Dcoin) DoAccountOperation

func (e *Dcoin) DoAccountOperation(operation *exchange.AccountOperation) error

************** Private API **************

func (*Dcoin) GetBalance

func (e *Dcoin) GetBalance(coin *coin.Coin) float64

func (*Dcoin) GetCoinBySymbol

func (e *Dcoin) GetCoinBySymbol(symbol string) *coin.Coin

func (*Dcoin) GetCoinConstraint

func (e *Dcoin) GetCoinConstraint(coin *coin.Coin) *exchange.CoinConstraint

************** Coins on the Exchanges **************

func (*Dcoin) GetCoins

func (e *Dcoin) GetCoins() []*coin.Coin

func (*Dcoin) GetCoinsData

func (e *Dcoin) 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 (*Dcoin) GetConfirmation

func (e *Dcoin) GetConfirmation(coin *coin.Coin) int

func (*Dcoin) GetConstraintFetchMethod

func (e *Dcoin) GetConstraintFetchMethod(pair *pair.Pair) *exchange.ConstrainFetchMethod

*************** Exchange Constraint ***************

func (*Dcoin) GetFee

func (e *Dcoin) GetFee(pair *pair.Pair) float64

*************** Pair Constraint ***************

func (*Dcoin) GetID

func (e *Dcoin) GetID() int

*************** Exchange Information ***************

func (*Dcoin) GetLotSize

func (e *Dcoin) GetLotSize(pair *pair.Pair) float64

func (*Dcoin) GetName

func (e *Dcoin) GetName() exchange.ExchangeName

func (*Dcoin) GetPairBySymbol

func (e *Dcoin) GetPairBySymbol(symbol string) *pair.Pair

func (*Dcoin) GetPairConstraint

func (e *Dcoin) GetPairConstraint(pair *pair.Pair) *exchange.PairConstraint

************** Pairs on the Exchanges **************

func (*Dcoin) GetPairs

func (e *Dcoin) GetPairs() []*pair.Pair

func (*Dcoin) GetPairsData

func (e *Dcoin) 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 (*Dcoin) GetPriceFilter

func (e *Dcoin) GetPriceFilter(pair *pair.Pair) float64

func (*Dcoin) GetSymbolByCoin

func (e *Dcoin) GetSymbolByCoin(coin *coin.Coin) string

func (*Dcoin) GetSymbolByPair

func (e *Dcoin) GetSymbolByPair(pair *pair.Pair) string

func (*Dcoin) GetTradingWebURL

func (e *Dcoin) GetTradingWebURL(pair *pair.Pair) string

func (*Dcoin) GetTxFee

func (e *Dcoin) GetTxFee(coin *coin.Coin) float64

*************** Coin Constraint ***************

func (*Dcoin) HasPair

func (e *Dcoin) HasPair(pair *pair.Pair) bool

func (*Dcoin) InitData

func (e *Dcoin) InitData() error

func (*Dcoin) LimitBuy

func (e *Dcoin) LimitBuy(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Dcoin) LimitSell

func (e *Dcoin) LimitSell(pair *pair.Pair, quantity, rate float64) (*exchange.Order, error)

func (*Dcoin) ListOrders

func (e *Dcoin) ListOrders() ([]*exchange.Order, error)

func (*Dcoin) LoadPublicData

func (e *Dcoin) LoadPublicData(operation *exchange.PublicOperation) error

func (*Dcoin) OrderBook

func (e *Dcoin) OrderBook(pair *pair.Pair) (*exchange.Maker, error)

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) OrderStatus

func (e *Dcoin) OrderStatus(order *exchange.Order) error

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()

func (*Dcoin) Withdraw

func (e *Dcoin) Withdraw(coin *coin.Coin, quantity float64, addr, tag string) bool

Withdraw(coin *coin.Coin, quantity float64, addr, tag string)

type JsonResponse

type JsonResponse struct {
	Code int             `json:"code"`
	Msg  string          `json:"msg"`
	Data json.RawMessage `json:"data"`
}

type OrderBook

type OrderBook struct {
	Asks [][]float64 `json:"asks"`
	Bids [][]float64 `json:"bids"`
}

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"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL