dragonex

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: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 16
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.0005
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://openapi.dragonex.io"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Code   string `json:"code"`
	CoinID int    `json:"coin_id"`
	Frozen string `json:"frozen"`
	Volume string `json:"volume"`
}

type CoinsData

type CoinsData []struct {
	CoinID int    `json:"coin_id"`
	Code   string `json:"code"`
}

public

type Dragonex

type Dragonex struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"website"`

	API_KEY    string
	API_SECRET string
	LastDay    int
	LastHour   int
	Token      string

	Source    exchange.DataSource // / exchange API / microservicve api 1 / PSQL
	SourceURI string
}

func CreateDragonex

func CreateDragonex(config *exchange.Config) *Dragonex

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

func (*Dragonex) ApiKeyRequest

func (e *Dragonex) ApiKeyRequest(strMethod string, mapParams map[string]interface{}, strRequestPath string, getToken bool) string

func (*Dragonex) CanDeposit

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

func (*Dragonex) CanWithdraw

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

func (*Dragonex) CancelAllOrder

func (e *Dragonex) CancelAllOrder() error

func (*Dragonex) CancelOrder

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

func (*Dragonex) DeleteCoin

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

func (*Dragonex) DeletePair

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

func (*Dragonex) DoAccountOperation

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

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

func (*Dragonex) GetBalance

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

func (*Dragonex) GetCoinBySymbol

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

func (*Dragonex) GetCoinConstraint

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

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

func (*Dragonex) GetCoins

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

func (*Dragonex) GetCoinsData

func (e *Dragonex) 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(strRequestUrl)

func (*Dragonex) GetConfirmation

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

func (*Dragonex) GetConstraintFetchMethod

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

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

func (*Dragonex) GetFee

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

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

func (*Dragonex) GetID

func (e *Dragonex) GetID() int

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

func (*Dragonex) GetLotSize

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

func (*Dragonex) GetName

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

func (*Dragonex) GetPairBySymbol

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

func (*Dragonex) GetPairConstraint

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

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

func (*Dragonex) GetPairs

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

func (*Dragonex) GetPairsData

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

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

func (*Dragonex) GetSymbolByCoin

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

func (*Dragonex) GetSymbolByPair

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

func (*Dragonex) GetToken

func (e *Dragonex) GetToken()

************** 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 token limit 100 times/day, valid 24h

func (*Dragonex) GetTradingWebURL

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

func (*Dragonex) GetTxFee

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

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

func (*Dragonex) HasPair

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

func (*Dragonex) InitData

func (e *Dragonex) InitData() error

func (*Dragonex) LimitBuy

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

func (*Dragonex) LimitSell

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

func (*Dragonex) ListOrders

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

func (*Dragonex) LoadPublicData

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

func (*Dragonex) OrderBook

func (e *Dragonex) 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.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 (*Dragonex) OrderStatus

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

func (*Dragonex) SetCoinConstraint

func (e *Dragonex) SetCoinConstraint(coinConstraint *exchange.CoinConstraint)

func (*Dragonex) SetPairConstraint

func (e *Dragonex) SetPairConstraint(pairConstraint *exchange.PairConstraint)

func (*Dragonex) UpdateAllBalances

func (e *Dragonex) UpdateAllBalances()

func (*Dragonex) UpdateConstraint

func (e *Dragonex) UpdateConstraint()

func (*Dragonex) Withdraw

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

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Buys []struct {
		Price  string `json:"price"`
		Volume string `json:"volume"`
	} `json:"buys"`
	Sells []struct {
		Price  string `json:"price"`
		Volume string `json:"volume"`
	} `json:"sells"`
}

type OrderStatus

type OrderStatus struct {
	OrderID      string `json:"order_id"`
	OrderType    int    `json:"order_type"`
	Price        string `json:"price"`
	Status       int    `json:"status"`
	SymbolID     int    `json:"symbol_id"`
	Timestamp    int    `json:"timestamp"`
	TradeVolume  string `json:"trade_volume"`
	Volume       string `json:"volume"`
	ActualAmount string `json:"actual_amount"`
	ActualFee    string `json:"actual_fee"`
}

type PairsData

type PairsData struct {
	Columns []string        `json:"columns"`
	List    [][]interface{} `json:"list"`
}

type PlaceOrder

type PlaceOrder struct {
	OrderID     string `json:"order_id"`
	Price       string `json:"price"`
	Status      int    `json:"status"`
	Timestamp   int    `json:"timestamp"`
	TradeVolume string `json:"trade_volume"`
	Volume      string `json:"volume"`
}

type Token

type Token struct {
	ExpireTime int    `json:"expire_time"`
	Token      string `json:"token"`
}

private

Jump to

Keyboard shortcuts

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