bitz

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           = 14
	DEFAULT_TAKER_FEE    = 0.0012
	DEFAULT_MAKER_FEE    = 0.0008
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	// API_URL string = "https://apiv2.bit-z.pro" // lookup apiv2.bit-z.pro: no such host
	API_URL string = "https://apiv2.bitz.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Name string `json:"name"`
	Num  string `json:"num"`
	Over string `json:"over"`
	Lock string `json:"lock"`
	Btc  string `json:"btc"`
	Usd  string `json:"usd"`
	Cny  string `json:"cny"`
}

type Bitz

type Bitz struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"https://www.bit-z.com/"`

	API_KEY       string
	API_SECRET    string
	TradePassword string

	Source    exchange.DataSource // / exchange API / microservicve api 1 / PSQL
	SourceURI string
}

func CreateBitz

func CreateBitz(config *exchange.Config) *Bitz

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

func (*Bitz) ApiKeyPOST

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

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

func (*Bitz) CanWithdraw

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

func (*Bitz) CancelAllOrder

func (e *Bitz) CancelAllOrder() error

func (*Bitz) CancelOrder

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

func (*Bitz) DeleteCoin

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

func (*Bitz) DeletePair

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

func (*Bitz) DoAccountOperation

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

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

func (*Bitz) GetBalance

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

func (*Bitz) GetCoinBySymbol

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

func (*Bitz) GetCoinConstraint

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

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

func (*Bitz) GetCoins

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

func (*Bitz) GetCoinsData

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

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

func (*Bitz) GetConstraintFetchMethod

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

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

func (*Bitz) GetFee

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

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

func (*Bitz) GetID

func (e *Bitz) GetID() int

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

func (*Bitz) GetLotSize

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

func (*Bitz) GetName

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

func (*Bitz) GetPairBySymbol

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

func (*Bitz) GetPairConstraint

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

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

func (*Bitz) GetPairs

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

func (*Bitz) GetPairsData

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

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

func (*Bitz) GetSymbolByCoin

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

func (*Bitz) GetSymbolByPair

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

func (*Bitz) GetTradingWebURL

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

func (*Bitz) GetTxFee

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

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

func (*Bitz) HasPair

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

func (*Bitz) InitData

func (e *Bitz) InitData() error

func (*Bitz) LimitBuy

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

func (*Bitz) LimitSell

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

func (*Bitz) ListOrders

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

func (*Bitz) LoadPublicData

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

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

func (*Bitz) OrderBook

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

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

func (*Bitz) SetCoinConstraint

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

func (*Bitz) SetPairConstraint

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

func (*Bitz) UpdateAllBalances

func (e *Bitz) UpdateAllBalances()

func (*Bitz) UpdateConstraint

func (e *Bitz) UpdateConstraint()

func (*Bitz) Withdraw

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

type CancelOrder

type CancelOrder struct {
	UpdateAssetsData struct {
		Coin string `json:"coin"`
		Over string `json:"over"`
		Lock string `json:"lock"`
	} `json:"updateAssetsData"`
	AssetsInfo struct {
		Coin string `json:"coin"`
		Over string `json:"over"`
		Lock string `json:"lock"`
	} `json:"assetsInfo"`
}

type JsonResponse

type JsonResponse struct {
	Status    int64           `json:"status"`
	Msg       string          `json:"msg"`
	Data      json.RawMessage `json:"data"`
	Time      int             `json:"time"`
	Microtime string          `json:"microtime"`
	Source    string          `json:"source"`
}

type OrderBook

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

type OrderDetails

type OrderDetails struct {
	ID              string `json:"id"`
	UID             string `json:"uId"`
	Price           string `json:"price"`
	Number          string `json:"number"`
	Total           string `json:"total"`
	NumberOver      string `json:"numberOver"`
	NumberDeal      string `json:"numberDeal"`
	Flag            string `json:"flag"`
	Status          int    `json:"status"`
	CoinFrom        string `json:"coinFrom"`
	CoinTo          string `json:"coinTo"`
	AveragePrice    string `json:"averagePrice"`
	OrderTotalPrice string `json:"orderTotalPrice"`
	TradeType       string `json:"tradeType"`
	Created         string `json:"created"`
}

type PairsData

type PairsData struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	CoinFrom    string `json:"coinFrom"`
	CoinTo      string `json:"coinTo"`
	NumberFloat string `json:"numberFloat"`
	PriceFloat  string `json:"priceFloat"`
	Status      string `json:"status"`
	MinTrade    string `json:"minTrade"`
	MaxTrade    string `json:"maxTrade"`
	BuyFree     string `json:"buyFree"`
	SellFree    string `json:"sellFree"`
}

type PlaceOrder

type PlaceOrder struct {
	ID         int64       `json:"id"`
	UID        int         `json:"uId"`
	Price      string      `json:"price"`
	Number     string      `json:"number"`
	NumberOver string      `json:"numberOver"`
	NumberDeal interface{} `json:"numberDeal"`
	Flag       string      `json:"flag"`
	Status     int         `json:"status"`
	CoinFrom   string      `json:"coinFrom"`
	CoinTo     string      `json:"coinTo"`
}

type TradeHistory

type TradeHistory struct {
	Status int    `json:"status"`
	Msg    string `json:"msg"`
	Data   []struct {
		ID int64 `json:"id"`
		// t  string `json:"t"`
		T0 string `json:"t"`
		T  int64  `json:"T"`
		P  string `json:"p"`
		N  string `json:"n"`
		S  string `json:"s"`
	} `json:"data"`
	Time      int    `json:"time"`
	Microtime string `json:"microtime"`
	Source    string `json:"source"`
}

type UserInfo

type UserInfo struct {
	CNY       interface{}     `json:"cny"` //This may be a string
	USD       interface{}     `json:"usd"`
	BTC_TOTAL interface{}     `json:"btc_total"`
	Info      json.RawMessage `json:"info"`
}

type Withdraw

type Withdraw struct {
	ID         int    `json:"id"`
	Email      string `json:"email"`
	Coin       string `json:"coin"`
	NetworkFee string `json:"network_fee"`
	Eid        int    `json:"eid"`
}

Jump to

Keyboard shortcuts

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