coinex

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: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 3
	DEFAULT_TAKER_FEE    = 0.001
	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
)
View Source
const (
	API_URL = "https://api.coinex.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	Available string `json:"available"`
	Frozen    string `json:"frozen"`
}

type Coinex

type Coinex 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 CreateCoinex

func CreateCoinex(config *exchange.Config) *Coinex

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

func (*Coinex) ApiKeyPost

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

func (*Coinex) ApiKeyRequest

func (e *Coinex) ApiKeyRequest(strMethod string, 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 (*Coinex) CanDeposit

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

func (*Coinex) CanWithdraw

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

func (*Coinex) CancelAllOrder

func (e *Coinex) CancelAllOrder() error

func (*Coinex) CancelOrder

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

func (*Coinex) DeleteCoin

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

func (*Coinex) DeletePair

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

func (*Coinex) DoAccountOperation

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

func (*Coinex) GetBalance

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

func (*Coinex) GetCoinBySymbol

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

func (*Coinex) GetCoinConstraint

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

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

func (*Coinex) GetCoins

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

func (*Coinex) GetCoinsData

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

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

func (*Coinex) GetConstraintFetchMethod

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

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

func (*Coinex) GetFee

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

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

func (*Coinex) GetID

func (e *Coinex) GetID() int

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

func (*Coinex) GetLotSize

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

func (*Coinex) GetName

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

func (*Coinex) GetPairBySymbol

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

func (*Coinex) GetPairConstraint

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

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

func (*Coinex) GetPairs

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

func (*Coinex) GetPairsData

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

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

func (*Coinex) GetSymbolByCoin

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

func (*Coinex) GetSymbolByPair

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

func (*Coinex) GetTradingWebURL

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

func (*Coinex) GetTxFee

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

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

func (*Coinex) HasPair

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

func (*Coinex) InitData

func (e *Coinex) InitData() error

func (*Coinex) LimitBuy

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

func (*Coinex) LimitSell

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

func (*Coinex) ListOrders

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

func (*Coinex) LoadPublicData

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

func (*Coinex) OrderBook

func (e *Coinex) OrderBook(p *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 (*Coinex) OrderStatus

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

func (*Coinex) SetCoinConstraint

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

func (*Coinex) SetPairConstraint

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

func (*Coinex) UpdateAllBalances

func (e *Coinex) UpdateAllBalances()

func (*Coinex) UpdateConstraint

func (e *Coinex) UpdateConstraint()

func (*Coinex) Withdraw

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

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

type DepositHistory

type DepositHistory []struct {
	ActualAmount        string `json:"actual_amount"`
	ActualAmountDisplay string `json:"actual_amount_display"`
	AddExplorer         string `json:"add_explorer"`
	Amount              string `json:"amount"`
	AmountDisplay       string `json:"amount_display"`
	CoinAddress         string `json:"coin_address"`
	CoinAddressDisplay  string `json:"coin_address_display"`
	CoinDepositID       int    `json:"coin_deposit_id"`
	CoinType            string `json:"coin_type"`
	Confirmations       int    `json:"confirmations"`
	CreateTime          int64  `json:"create_time"`
	Explorer            string `json:"explorer"`
	Remark              string `json:"remark"`
	SmartContractName   string `json:"smart_contract_name"`
	Status              string `json:"status"`
	StatusDisplay       string `json:"status_display"`
	TransferMethod      string `json:"transfer_method"`
	TxID                string `json:"tx_id"`
	TxIDDisplay         string `json:"tx_id_display"`
}

type JsonResponse

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

type OpenOrders

type OpenOrders struct {
	Count    int `json:"count"`
	CurrPage int `json:"curr_page"`
	Data     []struct {
		Amount       string `json:"amount"`
		AssetFee     string `json:"asset_fee"`
		AvgPrice     string `json:"avg_price"`
		ClientID     string `json:"client_id"`
		CreateTime   int64  `json:"create_time"`
		DealAmount   string `json:"deal_amount"`
		DealFee      string `json:"deal_fee"`
		DealMoney    string `json:"deal_money"`
		FeeAsset     string `json:"fee_asset"`
		FeeDiscount  string `json:"fee_discount"`
		ID           int64  `json:"id"`
		Left         string `json:"left"`
		MakerFeeRate string `json:"maker_fee_rate"`
		Market       string `json:"market"`
		OrderType    string `json:"order_type"`
		Price        string `json:"price"`
		Status       string `json:"status"`
		TakerFeeRate string `json:"taker_fee_rate"`
		Type         string `json:"type"`
	} `json:"data"`
	HasNext bool `json:"has_next"`
}

type OrderBook

type OrderBook struct {
	Asks [][]string `json:"asks"`
	Bids [][]string `json:"bids"`
	Last string     `json:"last"`
	Time int64      `json:"time"`
}

type PairsData

type PairsData struct {
	Symbol         string `json:"name"`
	MinAmount      string `json:"min_amount"`
	MakerFeeRate   string `json:"maker_fee_rate"`
	TakerFeeRate   string `json:"taker_fee_rate"`
	PricingName    string `json:"pricing_name"`
	PricingDecimal int    `json:"pricing_decimal"`
	TradingName    string `json:"trading_name"`
	TradingDecimal int    `json:"trading_decimal"`
}

type PlaceOrder

type PlaceOrder struct {
	Amount       string `json:"amount"`
	AvgPrice     string `json:"avg_price"`
	CreateTime   int    `json:"create_time"`
	DealAmount   string `json:"deal_amount"`
	DealFee      string `json:"deal_fee"`
	DealMoney    string `json:"deal_money"`
	ID           int    `json:"id"`
	Left         string `json:"left"`
	MakerFeeRate string `json:"maker_fee_rate"`
	Market       string `json:"market"`
	OrderType    string `json:"order_type"`
	Price        string `json:"price"`
	Status       string `json:"status"`
	TakerFeeRate string `json:"taker_fee_rate"`
	Type         string `json:"type"`
}

type SubAccountBalances

type SubAccountBalances map[string](map[string]*AccountBalances)

type TickerDetail

type TickerDetail struct {
	Buy        string `json:"buy"`
	BuyAmount  string `json:"buy_amount"`
	Open       string `json:"open"`
	High       string `json:"high"`
	Last       string `json:"last"`
	Low        string `json:"low"`
	Sell       string `json:"sell"`
	SellAmount string `json:"sell_amount"`
	Vol        string `json:"vol"`
}

type TickerPrice

type TickerPrice struct {
	Date   int64                   `json:"date"`
	Ticker map[string]TickerDetail `json:"ticker"`
}

type TradeHistory

type TradeHistory []struct {
	ID     int    `json:"id"`
	Type   string `json:"type"`
	Price  string `json:"price"`
	Amount string `json:"amount"`
	Date   int    `json:"date"`
	DateMs int64  `json:"date_ms"`
}

type TransferHistory

type TransferHistory struct {
	CurrPage int `json:"curr_page"`
	Data     []struct {
		Time         int64  `json:"time"`
		Amount       string `json:"amount"`
		CoinType     string `json:"coin_type"`
		TransferFrom string `json:"transfer_from"`
		TransferTo   string `json:"transfer_to"`
		Status       string `json:"status"`
	} `json:"data"`
	HasNext   bool `json:"has_next"`
	PerPage   int  `json:"per_page"`
	Total     int  `json:"total"`
	TotalPage int  `json:"total_page"`
}

type Withdraw

type Withdraw struct {
	ActualAmount   string `json:"actual_amount"`
	Amount         string `json:"amount"`
	CoinAddress    string `json:"coin_address"`
	CoinType       string `json:"coin_type"`
	CoinWithdrawID int    `json:"coin_withdraw_id"`
	Confirmations  int    `json:"confirmations"`
	CreateTime     int    `json:"create_time"`
	Status         string `json:"status"`
	TxFee          string `json:"tx_fee"`
	TxID           string `json:"tx_id"`
}

type WithdrawHistory

type WithdrawHistory []struct {
	ActualAmount   string `json:"actual_amount"`
	Amount         string `json:"amount"`
	CoinAddress    string `json:"coin_address"`
	CoinType       string `json:"coin_type"`
	CoinWithdrawID int    `json:"coin_withdraw_id"`
	Confirmations  int    `json:"confirmations"`
	CreateTime     int64  `json:"create_time"`
	Status         string `json:"status"`
	TxFee          string `json:"tx_fee"`
	TxID           string `json:"tx_id"`
}

Jump to

Keyboard shortcuts

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