digifinex

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           = 48
	DEFAULT_TAKER_FEE    = 0.0025
	DEFAULT_MAKER_FEE    = 0.0025
	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.digifinex.com/v2"
)

Variables

This section is empty.

Functions

func CreateSign

func CreateSign(mapParams map[string]string, e *Digifinex) string

func GetTimeDifference

func GetTimeDifference() int64

Types

type AccountBalances

type AccountBalances struct {
	Code   int                `json:"code"`
	Date   int                `json:"date"`
	Free   map[string]float64 `json:"free"`
	Frozen map[string]float64 `json:"frozen"`
}

type CancelOrder

type CancelOrder struct {
	Success []interface{}   `json:"success"`
	Fail    [][]interface{} `json:"fail"`
}

type Digifinex

type Digifinex 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 CreateDigifinex

func CreateDigifinex(config *exchange.Config) *Digifinex

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

func (*Digifinex) ApiKeyGET

func (e *Digifinex) ApiKeyGET(strRequestPath string, mapParams map[string]string) string

************** 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 (*Digifinex) ApiKeyPost

func (e *Digifinex) ApiKeyPost(mapParams map[string]string, strRequestPath string) string

func (*Digifinex) CanDeposit

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

func (*Digifinex) CanWithdraw

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

func (*Digifinex) CancelAllOrder

func (e *Digifinex) CancelAllOrder() error

func (*Digifinex) CancelOrder

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

func (*Digifinex) DeleteCoin

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

func (*Digifinex) DeletePair

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

func (*Digifinex) DoAccountOperation

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

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

func (*Digifinex) GetBalance

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

func (*Digifinex) GetCoinBySymbol

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

func (*Digifinex) GetCoinConstraint

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

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

func (*Digifinex) GetCoins

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

func (*Digifinex) GetCoinsData

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

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

func (*Digifinex) GetConstraintFetchMethod

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

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

func (*Digifinex) GetFee

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

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

func (*Digifinex) GetID

func (e *Digifinex) GetID() int

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

func (*Digifinex) GetLotSize

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

func (*Digifinex) GetName

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

func (*Digifinex) GetPairBySymbol

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

func (*Digifinex) GetPairConstraint

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

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

func (*Digifinex) GetPairs

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

func (*Digifinex) GetPairsData

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

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

func (*Digifinex) GetSymbolByCoin

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

func (*Digifinex) GetSymbolByPair

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

func (*Digifinex) GetTradingWebURL

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

func (*Digifinex) GetTxFee

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

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

func (*Digifinex) HasPair

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

func (*Digifinex) InitData

func (e *Digifinex) InitData() error

func (*Digifinex) LimitBuy

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

func (*Digifinex) LimitSell

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

func (*Digifinex) ListOrders

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

func (*Digifinex) LoadPublicData

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

func (*Digifinex) OrderBook

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

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

func (*Digifinex) SetCoinConstraint

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

func (*Digifinex) SetPairConstraint

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

func (*Digifinex) UpdateAllBalances

func (e *Digifinex) UpdateAllBalances()

func (*Digifinex) UpdateConstraint

func (e *Digifinex) UpdateConstraint()

func (*Digifinex) Withdraw

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

type JsonResponse

type JsonResponse struct {
	Data json.RawMessage `json:"data"`
	Date int             `json:"date"`
	Code int             `json:"code"`
}

type OrderBook

type OrderBook struct {
	Bids [][]float64 `json:"bids"`
	Asks [][]float64 `json:"asks"`
	Date int         `json:"date"`
	Code int         `json:"code"`
}

type OrderStatus

type OrderStatus []struct {
	OrderID        string  `json:"order_id"`
	CreatedDate    int     `json:"created_date"`
	FinishedDate   int     `json:"finished_date"`
	Price          float64 `json:"price"`
	Amount         float64 `json:"amount"`
	ExecutedAmount float64 `json:"executed_amount"`
	CashAmount     int     `json:"cash_amount"`
	AvgPrice       float64 `json:"avg_price"`
	Type           string  `json:"type"`
	Status         int     `json:"status"`
}

type PairsData

type PairsData []struct {
	VolumePrecision int     `json:"volume_precision"`
	PricePrecision  int     `json:"price_precision"`
	Market          string  `json:"market"`
	MinAmount       float64 `json:"min_amount"`
	MinVolume       float64 `json:"min_volume"`
}

type PlaceOrder

type PlaceOrder struct {
	Code    int    `json:"code"`
	OrderID string `json:"order_id"`
}

Jump to

Keyboard shortcuts

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