idex

package
v0.0.0-...-5439e55 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 20
	DEFAULT_TAKER_FEE    = 0.002
	DEFAULT_MAKER_FEE    = 0.001
	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

	CONTRACT_ADDRESS = "0x2a0c0dbecc7e4d658f48e01e3fa353f44050c208"
	EXPIRES          = 100000
)
View Source
const (
	API_URL string = "https://api.idex.market"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Result struct {
		TotalBtc   string `json:"total_btc"`
		TotalCny   string `json:"total_cny"`
		TotalUsd   string `json:"total_usd"`
		AssetsList []struct {
			CoinSymbol string `json:"coin_symbol"`
			Balance    string `json:"balance"`
			Freeze     string `json:"freeze"`
			BTCValue   string `json:"BTCValue"`
			CNYValue   string `json:"CNYValue"`
			USDValue   string `json:"USDValue"`
		} `json:"assets_list"`
	} `json:"result"`
	Cmd string `json:"cmd"`
}

type CancelOrder

type CancelOrder []struct {
	Result string `json:"result"`
	Cmd    string `json:"cmd"`
}

type CoinDetails

type CoinDetails struct {
	Name     string `json:"name"`
	Decimals int    `json:"decimals"`
	Address  string `json:"address"`
	Slug     string `json:"slug"`
}

type CoinsData

type CoinsData map[string]CoinDetails

type Error

type Error struct {
	Code string `json:"code"`
	Msg  string `json:"msg"`
}

type Idex

type Idex 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 CreateIdex

func CreateIdex(config *exchange.Config) *Idex

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

func (*Idex) ApiKeyPOST

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

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

func (*Idex) CanWithdraw

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

func (*Idex) CancelAllOrder

func (e *Idex) CancelAllOrder() error

func (*Idex) CancelOrder

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

func (*Idex) DeleteCoin

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

func (*Idex) DeletePair

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

func (*Idex) DoAccountOperation

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

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

func (*Idex) GetBalance

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

func (*Idex) GetCoinBySymbol

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

func (*Idex) GetCoinConstraint

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

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

func (*Idex) GetCoins

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

func (*Idex) GetCoinsData

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

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

func (*Idex) GetConstraintFetchMethod

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

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

func (*Idex) GetFee

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

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

func (*Idex) GetID

func (e *Idex) GetID() int

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

func (*Idex) GetLotSize

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

func (*Idex) GetName

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

func (*Idex) GetPairBySymbol

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

func (*Idex) GetPairConstraint

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

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

func (*Idex) GetPairs

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

func (*Idex) GetPairsData

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

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

func (*Idex) GetSymbolByCoin

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

func (*Idex) GetSymbolByPair

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

func (*Idex) GetTradingWebURL

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

func (*Idex) GetTxFee

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

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

func (*Idex) HasPair

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

func (*Idex) InitData

func (e *Idex) InitData() error

func (*Idex) LimitBuy

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

func (*Idex) LimitSell

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

func (*Idex) ListOrders

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

func (*Idex) LoadPublicData

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

func (*Idex) OrderBook

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

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

func (*Idex) SetCoinConstraint

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

func (*Idex) SetPairConstraint

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

func (*Idex) UpdateAllBalances

func (e *Idex) UpdateAllBalances()

func (*Idex) UpdateConstraint

func (e *Idex) UpdateConstraint()

func (*Idex) Withdraw

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

type JsonResponse

type JsonResponse struct {
	Error  Error           `json:"error"`
	Result json.RawMessage `json:"result"`
	Cmd    string          `json:"cmd"`
	Ver    string          `json:"ver"`
}

type OrderBook

type OrderBook struct {
	Asks []struct {
		Price     string `json:"price"`
		Amount    string `json:"amount"`
		Total     string `json:"total"`
		OrderHash string `json:"orderHash"`
		Params    struct {
			TokenBuy      string `json:"tokenBuy"`
			BuySymbol     string `json:"buySymbol"`
			BuyPrecision  int    `json:"buyPrecision"`
			AmountBuy     string `json:"amountBuy"`
			TokenSell     string `json:"tokenSell"`
			SellSymbol    string `json:"sellSymbol"`
			SellPrecision int    `json:"sellPrecision"`
			AmountSell    string `json:"amountSell"`
			Expires       int    `json:"expires"`
			Nonce         int64  `json:"nonce"`
			User          string `json:"user"`
		} `json:"params"`
	} `json:"asks"`
	Bids []struct {
		Price     string `json:"price"`
		Amount    string `json:"amount"`
		Total     string `json:"total"`
		OrderHash string `json:"orderHash"`
		Params    struct {
			TokenBuy      string `json:"tokenBuy"`
			BuySymbol     string `json:"buySymbol"`
			BuyPrecision  int    `json:"buyPrecision"`
			AmountBuy     string `json:"amountBuy"`
			TokenSell     string `json:"tokenSell"`
			SellSymbol    string `json:"sellSymbol"`
			SellPrecision int    `json:"sellPrecision"`
			AmountSell    string `json:"amountSell"`
			Expires       int    `json:"expires"`
			Nonce         int    `json:"nonce"`
			User          string `json:"user"`
		} `json:"params"`
	} `json:"bids"`
}

type OrderStatus

type OrderStatus []struct {
	Result struct {
		ID             int    `json:"id"`
		CreatedAt      int64  `json:"createdAt"`
		AccountType    int    `json:"account_type"`
		Pair           string `json:"pair"`
		CoinSymbol     string `json:"coin_symbol"`
		CurrencySymbol string `json:"currency_symbol"`
		OrderSide      int    `json:"order_side"`
		OrderType      int    `json:"order_type"`
		Price          string `json:"price"`
		DealPrice      string `json:"deal_price"`
		Amount         string `json:"amount"`
		Money          string `json:"money"`
		DealAmount     string `json:"deal_amount"`
		DealPercent    string `json:"deal_percent"`
		DealMoney      string `json:"deal_money"`
		Status         int    `json:"status"`
		Unexecuted     string `json:"unexecuted"`
		OrderFrom      int    `json:"order_from"`
	} `json:"result"`
	Cmd string `json:"cmd"`
}

type PairsData

type PairsData map[string]interface{}

type PlaceOrder

type PlaceOrder struct {
	Timestamp   int    `json:"timestamp"`
	Market      string `json:"market"`
	OrderNumber int    `json:"orderNumber"`
	OrderHash   string `json:"orderHash"`
	Price       string `json:"price"`
	Amount      string `json:"amount"`
	Total       string `json:"total"`
	Type        string `json:"type"`
	Params      struct {
		TokenBuy      string `json:"tokenBuy"`
		BuyPrecision  int    `json:"buyPrecision"`
		AmountBuy     string `json:"amountBuy"`
		TokenSell     string `json:"tokenSell"`
		SellPrecision int    `json:"sellPrecision"`
		AmountSell    string `json:"amountSell"`
		Expires       int    `json:"expires"`
		Nonce         string `json:"nonce"`
		User          string `json:"user"`
	} `json:"params"`
}

Jump to

Keyboard shortcuts

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