cointiger

package
Version: v0.0.0-...-65438fe Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 40
	DEFAULT_TAKER_FEE    = 0.0015
	DEFAULT_MAKER_FEE    = 0.0008
	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://api.cointiger.com/exchange/trading"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Normal string `json:"normal"`
	Lock   string `json:"lock"`
	Coin   string `json:"coin"`
}

********* Private API Structure*********

type CancelOrder

type CancelOrder struct {
	Success []int `json:"success"`
	Failed  []struct {
		ErrMsg  string `json:"err-msg"`
		OrderID string `json:"order-id"`
		ErrCode string `json:"err-code"`
	} `json:"failed"`
}

type Cointiger

type Cointiger 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 CreateCointiger

func CreateCointiger(config *exchange.Config) *Cointiger

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

func (*Cointiger) ApiKeyGet

func (e *Cointiger) ApiKeyGet(strRequestPath string, mapParams map[string]interface{}) string

sign err sometimes due to timestamp lag

func (*Cointiger) ApiKeyRequest

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

sign err sometimes due to timestamp lag

func (*Cointiger) CanDeposit

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

func (*Cointiger) CanWithdraw

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

func (*Cointiger) CancelAllOrder

func (e *Cointiger) CancelAllOrder() error

func (*Cointiger) CancelOrder

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

func (*Cointiger) DeleteCoin

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

func (*Cointiger) DeletePair

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

func (*Cointiger) DoAccountOperation

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

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

func (*Cointiger) GetBalance

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

func (*Cointiger) GetCoinBySymbol

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

func (*Cointiger) GetCoinConstraint

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

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

func (*Cointiger) GetCoins

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

func (*Cointiger) GetCoinsData

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

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

func (*Cointiger) GetConstraintFetchMethod

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

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

func (*Cointiger) GetFee

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

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

func (*Cointiger) GetID

func (e *Cointiger) GetID() int

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

func (*Cointiger) GetLotSize

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

func (*Cointiger) GetName

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

func (*Cointiger) GetPairBySymbol

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

func (*Cointiger) GetPairConstraint

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

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

func (*Cointiger) GetPairs

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

func (*Cointiger) GetPairsData

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

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

func (*Cointiger) GetSymbolByCoin

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

func (*Cointiger) GetSymbolByPair

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

func (*Cointiger) GetTradingWebURL

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

func (*Cointiger) GetTxFee

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

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

func (*Cointiger) HasPair

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

func (*Cointiger) InitData

func (e *Cointiger) InitData() error

func (*Cointiger) LimitBuy

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

btcusdt tradepair - price filter minimum integer(交易对价格精度最小为个位数)

func (*Cointiger) LimitSell

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

btcusdt tradepair - price filter minimum integer(交易对价格精度最小为个位数)

func (*Cointiger) ListOrders

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

func (*Cointiger) LoadPublicData

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

func (*Cointiger) OrderBook

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

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

func (*Cointiger) SetCoinConstraint

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

func (*Cointiger) SetPairConstraint

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

func (*Cointiger) UpdateAllBalances

func (e *Cointiger) UpdateAllBalances()

func (*Cointiger) UpdateConstraint

func (e *Cointiger) UpdateConstraint()

func (*Cointiger) Withdraw

func (e *Cointiger) 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 string          `json:"code"`
	Msg  string          `json:"msg"`
	Data json.RawMessage `json:"data"`
}

type OrderBook

type OrderBook struct {
	Symbol    string `json:"symbol"`
	DepthData struct {
		Tick struct {
			Buys [][]interface{} `json:"buys"`
			Asks [][]interface{} `json:"asks"`
		} `json:"tick"`
		Ts int64 `json:"ts"`
	} `json:"depth_data"`
}

type OrderStatus

type OrderStatus struct {
	Symbol     string `json:"symbol"`
	Fee        string `json:"fee"`
	AvgPrice   string `json:"avg_price"`
	Source     int    `json:"source"`
	Type       string `json:"type"`
	Mtime      int64  `json:"mtime"`
	Volume     string `json:"volume"`
	UserID     int    `json:"user_id"`
	Price      string `json:"price"`
	Ctime      int64  `json:"ctime"`
	DealVolume string `json:"deal_volume"`
	ID         int    `json:"id"`
	DealMoney  string `json:"deal_money"`
	Status     int    `json:"status"`
}

type PairsData

type PairsData map[string]PairsDetails

********* Public API Structure*********

type PairsDetails

type PairsDetails []struct {
	BaseCurrency    string  `json:"baseCurrency"`
	QuoteCurrency   string  `json:"quoteCurrency"`
	PricePrecision  int     `json:"pricePrecision"`
	AmountPrecision int     `json:"amountPrecision"`
	AmountMin       float64 `json:"amountMin"`
	WithdrawFeeMin  float64 `json:"withdrawFeeMin"`
	WithdrawFeeMax  float64 `json:"withdrawFeeMax"`
	WithdrawOneMin  float64 `json:"withdrawOneMin"`
	WithdrawOneMax  float64 `json:"withdrawOneMax"`
	DepthSelect     struct {
		Step0 string `json:"step0"`
		Step1 string `json:"step1"`
		Step2 string `json:"step2"`
	} `json:"depthSelect"`
}

type PlaceOrder

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL