lbank

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: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 34
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://www.lbkex.net" //"https://api.lbkex.com"
)

Variables

This section is empty.

Functions

func ComputeMD5

func ComputeMD5(mapParams map[string]string, strSecret string) string

Signature加密

Types

type AccountBalances

type AccountBalances struct {
	Result string `json:"result"`
	Info   struct {
		Asset  map[string]string `json:"asset"`
		Freeze map[string]string `json:"freeze"`
		Free   map[string]string `json:"free"`
	} `json:"info"`
	ErrorCode int `json:"error_code"`
}

type CancelOrders

type CancelOrders struct {
	Result    string `json:"result"`
	OrderID   string `json:"order_id"`
	Success   string `json:"success"`
	Error     string `json:"error"`
	ErrorCode int    `json:"error_code"`
}

type CoinsData

type CoinsData struct {
	Result string `json:"result"`
	Data   []struct {
		AmountScale string `json:"amountScale"`
		AssetCode   string `json:"assetCode"`
		CanWithDraw bool   `json:"canWithDraw"`
		Fee         string `json:"fee"`
		Type        string `json:"type"`
		Min         string `json:"min,omitempty"`
	} `json:"data"`
	ErrorCode int   `json:"error_code"`
	Ts        int64 `json:"ts"`
}

v2

type Lbank

type Lbank 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 CreateLbank

func CreateLbank(config *exchange.Config) *Lbank

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

func (*Lbank) ApiKeyPost

func (e *Lbank) ApiKeyPost(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 (*Lbank) CanDeposit

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

func (*Lbank) CanWithdraw

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

func (*Lbank) CancelAllOrder

func (e *Lbank) CancelAllOrder() error

func (*Lbank) CancelOrder

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

func (*Lbank) DeleteCoin

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

func (*Lbank) DeletePair

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

func (*Lbank) DoAccountOperation

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

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

func (*Lbank) GetBalance

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

func (*Lbank) GetCoinBySymbol

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

func (*Lbank) GetCoinConstraint

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

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

func (*Lbank) GetCoins

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

func (*Lbank) GetCoinsData

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

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

func (*Lbank) GetConstraintFetchMethod

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

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

func (*Lbank) GetFee

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

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

func (*Lbank) GetID

func (e *Lbank) GetID() int

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

func (*Lbank) GetLotSize

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

func (*Lbank) GetName

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

func (*Lbank) GetPairBySymbol

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

func (*Lbank) GetPairConstraint

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

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

func (*Lbank) GetPairs

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

func (*Lbank) GetPairsData

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

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

func (*Lbank) GetSymbolByCoin

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

func (*Lbank) GetSymbolByPair

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

func (*Lbank) GetTradingWebURL

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

func (*Lbank) GetTxFee

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

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

func (*Lbank) HasPair

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

func (*Lbank) InitData

func (e *Lbank) InitData() error

func (*Lbank) LimitBuy

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

func (*Lbank) LimitSell

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

func (*Lbank) ListOrders

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

func (*Lbank) LoadPublicData

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

func (*Lbank) OrderBook

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

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

func (*Lbank) SetCoinConstraint

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

func (*Lbank) SetPairConstraint

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

func (*Lbank) UpdateAllBalances

func (e *Lbank) UpdateAllBalances()

func (*Lbank) UpdateConstraint

func (e *Lbank) UpdateConstraint()

func (*Lbank) Withdraw

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

type OrderBook

type OrderBook struct {
	Bids      [][]float64 `json:"bids"`
	Asks      [][]float64 `json:"asks"`
	Timestamp int64       `json:"timestamp"`
}

type OrderStatus

type OrderStatus struct {
	Result    string `json:"result"`
	ErrorCode int    `json:"error_code"`
	Orders    []struct {
		Symbol     string      `json:"symbol"`
		Amount     float64     `json:"amount"`
		CreateTime int64       `json:"create_time"`
		Price      float64     `json:"price"`
		CustomID   interface{} `json:"custom_id"`
		AvgPrice   float64     `json:"avg_price"`
		Type       string      `json:"type"`
		OrderID    string      `json:"order_id"`
		DealAmount float64     `json:"deal_amount"`
		Status     int         `json:"status"`
	} `json:"orders"`
}

type PairsData

type PairsData []struct {
	MinTranQua       string `json:"minTranQua"`
	PriceAccuracy    string `json:"priceAccuracy"`
	QuantityAccuracy string `json:"quantityAccuracy"`
	Symbol           string `json:"symbol"`
}

type PlaceOrder

type PlaceOrder struct {
	Result    string `json:"result"`
	OrderID   string `json:"order_id"`
	ErrorCode int    `json:"error_code"`
}

type Withdraw

type Withdraw struct {
	Result     string  `json:"result"`
	WithdrawID int     `json:"withdrawId"`
	Fee        float64 `json:"fee"`
}

Jump to

Keyboard shortcuts

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