bw

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           = 43
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	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
)
View Source
const (
	API_URL = "https://www.bw.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Asset     string  `json:"asset"`
	Total     float64 `json:"total"`
	Available float64 `json:"available"`
	Locked    float64 `json:"locked"`
}

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

type Bw

type Bw 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 CreateBw

func CreateBw(config *exchange.Config) *Bw

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

func (*Bw) ApiKeyGet

func (e *Bw) 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 (*Bw) ApiKeyRequest

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

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

func (*Bw) CanWithdraw

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

func (*Bw) CancelAllOrder

func (e *Bw) CancelAllOrder() error

func (*Bw) CancelOrder

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

func (*Bw) DeleteCoin

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

func (*Bw) DeletePair

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

func (*Bw) DoAccountOperation

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

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

func (*Bw) GetBalance

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

func (*Bw) GetCoinBySymbol

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

func (*Bw) GetCoinConstraint

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

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

func (*Bw) GetCoins

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

func (*Bw) GetCoinsData

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

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

func (*Bw) GetConstraintFetchMethod

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

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

func (*Bw) GetFee

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

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

func (*Bw) GetID

func (e *Bw) GetID() int

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

func (*Bw) GetLotSize

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

func (*Bw) GetName

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

func (*Bw) GetPairBySymbol

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

func (*Bw) GetPairConstraint

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

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

func (*Bw) GetPairs

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

func (*Bw) GetPairsData

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

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

func (*Bw) GetSymbolByCoin

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

func (*Bw) GetSymbolByPair

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

func (*Bw) GetTradingWebURL

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

func (*Bw) GetTxFee

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

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

func (*Bw) HasPair

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

func (*Bw) InitData

func (e *Bw) InitData() error

func (*Bw) LimitBuy

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

func (*Bw) LimitSell

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

func (*Bw) ListOrders

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

func (*Bw) LoadPublicData

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

func (*Bw) OrderBook

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

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

func (*Bw) SetCoinConstraint

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

func (*Bw) SetPairConstraint

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

func (*Bw) UpdateAllBalances

func (e *Bw) UpdateAllBalances()

func (*Bw) UpdateConstraint

func (e *Bw) UpdateConstraint()

func (*Bw) Withdraw

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

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

type CoinsData

type CoinsData []struct {
	CurrencyID         string      `json:"currencyId"`
	Name               string      `json:"name"`
	Alias              string      `json:"alias"`
	Logo               string      `json:"logo"`
	Description        string      `json:"description"`
	DescriptionEnglish string      `json:"descriptionEnglish"`
	DefaultDecimal     int         `json:"defaultDecimal"`
	CreateUID          interface{} `json:"createUid"`
	CreateTime         int64       `json:"createTime"`
	ModifyUID          interface{} `json:"modifyUid"`
	ModifyTime         int         `json:"modifyTime"`
	State              int         `json:"state"`
	Mark               string      `json:"mark"`
	TotalNumber        float64     `json:"totalNumber"`
	PublishNumber      float64     `json:"publishNumber"`
	MarketValue        float64     `json:"marketValue"`
	IsLegalCoin        int         `json:"isLegalCoin"`
	NeedBlockURL       int         `json:"needBlockUrl"`
	BlockChainURL      string      `json:"blockChainUrl"`
	TradeSearchURL     interface{} `json:"tradeSearchUrl"`
	TokenCoinsID       int         `json:"tokenCoinsId"`
	IsMining           string      `json:"isMining"`
	Arithmetic         interface{} `json:"arithmetic"`
	Founder            string      `json:"founder"`
	TeamAddress        interface{} `json:"teamAddress"`
	Remark             interface{} `json:"remark"`
	TokenName          string      `json:"tokenName"`
	IsMemo             int         `json:"isMemo"`
	WebsiteCurrencyID  string      `json:"websiteCurrencyId"`
	DrawFlag           int         `json:"drawFlag"`
	RechargeFlag       int         `json:"rechargeFlag"`
	DrawFee            float64     `json:"drawFee"`
	OnceDrawLimit      int         `json:"onceDrawLimit"`
	DailyDrawLimit     int         `json:"dailyDrawLimit"`
	TimesFreetrial     float64     `json:"timesFreetrial"`
	HourFreetrial      float64     `json:"hourFreetrial"`
	DayFreetrial       float64     `json:"dayFreetrial"`
	MinFee             float64     `json:"minFee"`
	InConfigTimes      int         `json:"inConfigTimes"`
	OutConfigTimes     int         `json:"outConfigTimes"`
	MinCash            float64     `json:"minCash"`
	LimitAmount        float64     `json:"limitAmount"`
	ZbExist            bool        `json:"zbExist"`
	Zone               int         `json:"zone"`
}

type JsonResponse

type JsonResponse struct {
	Datas  json.RawMessage `json:"datas"`
	ResMsg struct {
		Message string `json:"message"`
		Method  string `json:"method"`
		Code    string `json:"code"`
	}
}

type OrderBook

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

type PairsData

type PairsData []struct {
	MarketID         string `json:"marketId"`
	WebID            string `json:"webId"`
	ServerID         string `json:"serverId"`
	Name             string `json:"name"`
	LeverType        string `json:"leverType"`
	BuyerCurrencyID  string `json:"buyerCurrencyId"`
	SellerCurrencyID string `json:"sellerCurrencyId"`
	AmountDecimal    int    `json:"amountDecimal"`
	PriceDecimal     int    `json:"priceDecimal"`
	MinAmount        string `json:"minAmount"`
	State            int    `json:"state"`
	OpenTime         int64  `json:"openTime"`
	DefaultFee       string `json:"defaultFee"`
	CreateUID        string `json:"createUid"`
	CreateTime       int    `json:"createTime"`
	ModifyUID        string `json:"modifyUid"`
	ModifyTime       int64  `json:"modifyTime"`
	CombineMarketID  string `json:"combineMarketId"`
	IsCombine        int    `json:"isCombine"`
	IsMining         int    `json:"isMining"`
}

type PlaceOrder

type PlaceOrder struct {
	Symbol       string `json:"symbol"`
	OrderID      string `json:"orderId"`
	Side         string `json:"side"`
	Type         string `json:"type"`
	Price        string `json:"price"`
	AveragePrice string `json:"executedQty"`
	OrigQty      string `json:"origQty"`
	ExecutedQty  string `json:"executedQty"`
	Status       string `json:"status"`
	TimeInForce  string `json:"timeInForce"`
}

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