bkex

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           = 57
	DEFAULT_TAKER_FEE    = 0.002
	DEFAULT_MAKER_FEE    = 0.001
	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 = "https://api.bkex.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	WALLET []struct {
		Available float64 `json:"available"`
		CoinType  string  `json:"coinType"`
		Frozen    float64 `json:"frozen"`
		Total     float64 `json:"total"`
	} `json:"WALLET"`
	OTC []interface{} `json:"OTC"`
}

type Bkex

type Bkex 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 CreateBkex

func CreateBkex(config *exchange.Config) *Bkex

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

func (*Bkex) ApiKeyGet

func (e *Bkex) ApiKeyGet(strRequestPath string, mapParams map[string]string) string

************** Signature Http Request ************** Method: API Get 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 (*Bkex) ApiKeyRequest

func (e *Bkex) ApiKeyRequest(strMethod, strRequestPath string, mapParams map[string]string) string

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

func (*Bkex) CanDeposit

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

func (*Bkex) CanWithdraw

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

func (*Bkex) CancelAllOrder

func (e *Bkex) CancelAllOrder() error

func (*Bkex) CancelOrder

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

func (*Bkex) DeleteCoin

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

func (*Bkex) DeletePair

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

func (*Bkex) DoAccountOperation

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

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

func (*Bkex) GetBalance

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

func (*Bkex) GetCoinBySymbol

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

func (*Bkex) GetCoinConstraint

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

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

func (*Bkex) GetCoins

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

func (*Bkex) GetCoinsData

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

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

func (*Bkex) GetConstraintFetchMethod

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

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

func (*Bkex) GetFee

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

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

func (*Bkex) GetID

func (e *Bkex) GetID() int

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

func (*Bkex) GetLotSize

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

func (*Bkex) GetName

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

func (*Bkex) GetPairBySymbol

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

func (*Bkex) GetPairConstraint

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

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

func (*Bkex) GetPairs

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

func (*Bkex) GetPairsData

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

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

func (*Bkex) GetSymbolByCoin

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

func (*Bkex) GetSymbolByPair

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

func (*Bkex) GetTradingWebURL

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

func (*Bkex) GetTxFee

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

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

func (*Bkex) HasPair

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

func (*Bkex) InitData

func (e *Bkex) InitData() error

func (*Bkex) LimitBuy

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

func (*Bkex) LimitSell

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

func (*Bkex) ListOrders

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

func (*Bkex) LoadPublicData

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

************** PUBLIC API **************

func (*Bkex) OrderBook

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

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

unfinished order, need finished order after this

func (*Bkex) SetCoinConstraint

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

func (*Bkex) SetPairConstraint

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

func (*Bkex) UpdateAllBalances

func (e *Bkex) UpdateAllBalances()

func (*Bkex) UpdateConstraint

func (e *Bkex) UpdateConstraint()

func (*Bkex) Withdraw

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

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

type Coin

type Coin struct {
	CoinType          string  `json:"coinType"`
	MaxWithdrawOneDay float64 `json:"maxWithdrawOneDay"`
	MaxWithdrawSingle float64 `json:"maxWithdrawSingle"`
	MinWithdrawSingle float64 `json:"minWithdrawSingle"`
	SupportDeposit    bool    `json:"supportDeposit"`
	SupportTrade      bool    `json:"supportTrade"`
	SupportWithdraw   bool    `json:"supportWithdraw"`
	WithdrawFee       float64 `json:"withdrawFee"`
}

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

type CoinsData

type CoinsData []Coin

type ExchangeData

type ExchangeData struct {
	CoinTypes CoinsData
	Pairs     PairsData
}

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Asks []OrderItem `json:"asks"`
	Bids []OrderItem `json:"bids"`
}

type OrderDetail

type OrderDetail struct {
	CreatedTime         int         `json:"createdTime"`
	DealAmount          float64     `json:"dealAmount"`
	DealAvgPrice        float64     `json:"dealAvgPrice"`
	Direction           string      `json:"direction"`
	FrozenAmountByOrder float64     `json:"frozenAmountByOrder"`
	Id                  string      `json:"id"`
	OrderType           string      `json:"orderType"`
	Pair                string      `json:"pair"`
	Price               float64     `json:"price"`
	Status              int         `json:"status"`
	TotalAmount         float64     `json:"totalAmount"`
	UpdateTime          interface{} `json:"updateTime"`
}

type OrderItem

type OrderItem struct {
	Amt       float64 `json:"amt"`
	Direction string  `json:"direction"`
	Pair      string  `json:"pair"`
	Price     float64 `json:"price"`
}

type OrderStatus

type OrderStatus struct {
	CreatedTime         int64       `json:"createdTime"`
	DealAmount          float64     `json:"dealAmount"`
	DealAvgPrice        float64     `json:"dealAvgPrice"`
	Direction           string      `json:"direction"`
	FrozenAmountByOrder float64     `json:"frozenAmountByOrder"`
	ID                  string      `json:"id"`
	OrderType           string      `json:"orderType"`
	Pair                string      `json:"pair"`
	Price               float64     `json:"price"`
	Status              int         `json:"status"`
	TotalAmount         float64     `json:"totalAmount"`
	UpdateTime          interface{} `json:"updateTime"`
}

type OrdersPage

type OrdersPage struct {
	Data        []OrderDetail `json:"data"`
	PageRequest interface{}   `json:"pageRequest"`
	Total       int           `json:"total"`
}

type Pair

type Pair struct {
	AmountPrecision  int    `json:"amountPrecision"`
	DefaultPrecision int    `json:"defaultPrecision"`
	Pair             string `json:"pair"`
	SupportTrade     bool   `json:"supportTrade"`
}

type PairsData

type PairsData []Pair

type TradeHistory

type TradeHistory struct {
	Code int `json:"code"`
	Data []struct {
		CreatedTime        int64   `json:"createdTime"`
		DealAmount         float64 `json:"dealAmount"`
		Pair               string  `json:"pair"`
		Price              float64 `json:"price"`
		TradeDealDirection string  `json:"tradeDealDirection"`
	} `json:"data"`
	Msg string `json:"msg"`
}

type WithdrawResponse

type WithdrawResponse struct {
	Msg     string `json:"msg"`
	Success bool   `json:"success"`
	ID      string `json:"id"`
}

Jump to

Keyboard shortcuts

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