coineal

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           = 30
	DEFAULT_TAKER_FEE    = 0.0015
	DEFAULT_MAKER_FEE    = 0.0015
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://exchange-open-api.coineal.com"
)

Variables

This section is empty.

Functions

func CreatePayload

func CreatePayload(mapParams map[string]string) string

Types

type AccountBalances

type AccountBalances struct {
	TotalAsset string `json:"total_asset"`
	CoinList   []struct {
		Normal      string  `json:"normal"`
		BtcValuatin float64 `json:"btcValuatin"`
		Locked      string  `json:"locked"`
		Coin        string  `json:"coin"`
	} `json:"coin_list"`
}

type Coineal

type Coineal 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 CreateCoineal

func CreateCoineal(config *exchange.Config) *Coineal

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

func (*Coineal) ApiKeyGET

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

func (*Coineal) ApiKeyRequest

func (e *Coineal) ApiKeyRequest(requestMethod string, mapParams map[string]string, strRequestPath 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 (*Coineal) CanDeposit

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

func (*Coineal) CanWithdraw

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

func (*Coineal) CancelAllOrder

func (e *Coineal) CancelAllOrder() error

func (*Coineal) CancelOrder

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

func (*Coineal) DeleteCoin

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

func (*Coineal) DeletePair

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

func (*Coineal) DoAccountOperation

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

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

func (*Coineal) GetBalance

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

func (*Coineal) GetCoinBySymbol

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

func (*Coineal) GetCoinConstraint

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

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

func (*Coineal) GetCoins

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

func (*Coineal) GetCoinsData

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

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

func (*Coineal) GetConstraintFetchMethod

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

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

func (*Coineal) GetFee

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

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

func (*Coineal) GetID

func (e *Coineal) GetID() int

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

func (*Coineal) GetLotSize

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

func (*Coineal) GetName

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

func (*Coineal) GetPairBySymbol

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

func (*Coineal) GetPairConstraint

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

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

func (*Coineal) GetPairs

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

func (*Coineal) GetPairsData

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

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

func (*Coineal) GetSymbolByCoin

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

func (*Coineal) GetSymbolByPair

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

func (*Coineal) GetTradingWebURL

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

func (*Coineal) GetTxFee

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

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

func (*Coineal) HasPair

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

func (*Coineal) InitData

func (e *Coineal) InitData() error

func (*Coineal) LimitBuy

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

func (*Coineal) LimitSell

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

func (*Coineal) ListOrders

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

func (*Coineal) LoadPublicData

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

func (*Coineal) OrderBook

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

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

func (*Coineal) PostReq

func (e *Coineal) PostReq(resource string, mapParams map[string]string) string

func (*Coineal) SetCoinConstraint

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

func (*Coineal) SetPairConstraint

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

func (*Coineal) UpdateAllBalances

func (e *Coineal) UpdateAllBalances()

func (*Coineal) UpdateConstraint

func (e *Coineal) UpdateConstraint()

func (*Coineal) Withdraw

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

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Tick struct {
		Asks [][]interface{} `json:"asks"`
		Bids [][]interface{} `json:"bids"`
		Time interface{}     `json:"time"`
	} `json:"tick"`
}

type OrderStatus

type OrderStatus struct {
	TradeList []interface{} `json:"trade_list"`
	OrderInfo struct {
		Side         string        `json:"side"`
		TotalPrice   string        `json:"total_price"`
		CreatedAt    int64         `json:"created_at"`
		AvgPrice     string        `json:"avg_price"`
		CountCoin    string        `json:"countCoin"`
		Source       int           `json:"source"`
		Type         int           `json:"type"`
		SideMsg      string        `json:"side_msg"`
		Volume       string        `json:"volume"`
		Price        string        `json:"price"`
		SourceMsg    string        `json:"source_msg"`
		StatusMsg    string        `json:"status_msg"`
		DealVolume   string        `json:"deal_volume"`
		ID           int           `json:"id"`
		RemainVolume string        `json:"remain_volume"`
		BaseCoin     string        `json:"baseCoin"`
		TradeList    []interface{} `json:"tradeList"`
		Status       int           `json:"status"`
	} `json:"order_info"`
}

type PairsData

type PairsData []struct {
	Symbol          string `json:"symbol"`
	CountCoin       string `json:"count_coin"`
	AmountPrecision int    `json:"amount_precision"`
	BaseCoin        string `json:"base_coin"`
	PricePrecision  int    `json:"price_precision"`
}

type PlaceOrder

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

Jump to

Keyboard shortcuts

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