bitrue

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

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 25
	DEFAULT_TAKER_FEE    = 0.00098
	DEFAULT_MAKER_FEE    = 0.00098
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://www.bitrue.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	MakerCommission  int  `json:"makerCommission"`
	TakerCommission  int  `json:"takerCommission"`
	BuyerCommission  int  `json:"buyerCommission"`
	SellerCommission int  `json:"sellerCommission"`
	CanTrade         bool `json:"canTrade"`
	CanWithdraw      bool `json:"canWithdraw"`
	CanDeposit       bool `json:"canDeposit"`
	UpdateTime       int  `json:"updateTime"`
	Balances         []struct {
		Asset  string `json:"asset"`
		Free   string `json:"free"`
		Locked string `json:"locked"`
	} `json:"balances"`
}

type Bitrue

type Bitrue 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 CreateBitrue

func CreateBitrue(config *exchange.Config) *Bitrue

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

func (*Bitrue) ApiKeyGET

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

func (*Bitrue) ApiKeyRequest

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

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

func (*Bitrue) CanWithdraw

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

func (*Bitrue) CancelAllOrder

func (e *Bitrue) CancelAllOrder() error

func (*Bitrue) CancelOrder

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

func (*Bitrue) DeleteCoin

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

func (*Bitrue) DeletePair

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

func (*Bitrue) DoAccountOperation

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

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

func (*Bitrue) GetBalance

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

func (*Bitrue) GetCoinBySymbol

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

func (*Bitrue) GetCoinConstraint

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

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

func (*Bitrue) GetCoins

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

func (*Bitrue) GetCoinsData

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

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

func (*Bitrue) GetConstraintFetchMethod

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

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

func (*Bitrue) GetFee

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

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

func (*Bitrue) GetID

func (e *Bitrue) GetID() int

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

func (*Bitrue) GetLotSize

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

func (*Bitrue) GetName

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

func (*Bitrue) GetPairBySymbol

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

func (*Bitrue) GetPairConstraint

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

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

func (*Bitrue) GetPairs

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

func (*Bitrue) GetPairsData

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

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

func (*Bitrue) GetSymbolByCoin

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

func (*Bitrue) GetSymbolByPair

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

func (*Bitrue) GetTradingWebURL

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

func (*Bitrue) GetTxFee

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

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

func (*Bitrue) HasPair

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

func (*Bitrue) InitData

func (e *Bitrue) InitData() error

func (*Bitrue) LimitBuy

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

func (*Bitrue) LimitSell

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

func (*Bitrue) ListOrders

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

func (*Bitrue) LoadPublicData

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

func (*Bitrue) OrderBook

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

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

func (*Bitrue) SetCoinConstraint

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

func (*Bitrue) SetPairConstraint

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

func (*Bitrue) UpdateAllBalances

func (e *Bitrue) UpdateAllBalances()

func (*Bitrue) UpdateConstraint

func (e *Bitrue) UpdateConstraint()

func (*Bitrue) Withdraw

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

type JsonResponse

type JsonResponse struct {
	Code    int    `json:"code"` //success: 200
	Message string `json:"msg"`
}

type OrderBook

type OrderBook struct {
	LastUpdateID int64           `json:"lastUpdateId"`
	Bids         [][]interface{} `json:"bids"`
	Asks         [][]interface{} `json:"asks"`
}

type OrderStatus

type OrderStatus struct {
	Symbol              string `json:"symbol"`
	OrderID             string `json:"orderId"`
	ClientOrderID       string `json:"clientOrderId"`
	Price               string `json:"price"`
	OrigQty             string `json:"origQty"`
	ExecutedQty         string `json:"executedQty"`
	CummulativeQuoteQty string `json:"cummulativeQuoteQty"`
	Status              string `json:"status"`
	TimeInForce         string `json:"timeInForce"`
	Type                string `json:"type"`
	Side                string `json:"side"`
	StopPrice           string `json:"stopPrice"`
	IcebergQty          string `json:"icebergQty"`
	Time                int64  `json:"time"`
	UpdateTime          int64  `json:"updateTime"`
	IsWorking           bool   `json:"isWorking"`
}

type PairsData

type PairsData struct {
	Timezone   string `json:"timezone"`
	ServerTime int64  `json:"serverTime"`
	RateLimits []struct {
		RateLimitType string `json:"rateLimitType"`
		Interval      string `json:"interval"`
		Limit         int    `json:"limit"`
	} `json:"rateLimits"`
	ExchangeFilters []interface{} `json:"exchangeFilters"`
	Symbols         []struct {
		Symbol             string   `json:"symbol"`
		Status             string   `json:"status"`
		BaseAsset          string   `json:"baseAsset"`
		BaseAssetPrecision int      `json:"baseAssetPrecision"`
		QuoteAsset         string   `json:"quoteAsset"`
		QuotePrecision     int      `json:"quotePrecision"`
		OrderTypes         []string `json:"orderTypes"`
		IcebergAllowed     bool     `json:"icebergAllowed"`
		Filters            []struct {
			FilterType  string `json:"filterType"`
			MinPrice    string `json:"minPrice,omitempty"`
			MaxPrice    string `json:"maxPrice,omitempty"`
			PriceScale  int    `json:"priceScale,omitempty"`
			MinQty      string `json:"minQty,omitempty"`
			MaxQty      string `json:"maxQty,omitempty"`
			VolumeScale int    `json:"volumeScale,omitempty"`
		} `json:"filters"`
	} `json:"symbols"`
}

type PlaceOrder

type PlaceOrder struct {
	Symbol        string `json:"symbol"`
	OrderID       int    `json:"orderId"`
	ClientOrderID string `json:"clientOrderId"`
	TransactTime  int64  `json:"transactTime"`
}

Jump to

Keyboard shortcuts

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