zebitex

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

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 53
	DEFAULT_TAKER_FEE    = 0.0025
	DEFAULT_MAKER_FEE    = 0.0025
	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://zebitex.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances map[string]Balance

type Balance

type Balance struct {
	IsFiat               bool        `json:"isFiat"`
	Code                 string      `json:"code"`
	Title                string      `json:"title"`
	PaymentAddress       string      `json:"paymentAddress"`
	Balance              string      `json:"balance"`
	LockedBalance        string      `json:"lockedBalance"`
	PaymentAddressQrCode string      `json:"paymentAddressQrCode"`
	BankAccounts         interface{} `json:"bankAccounts"`
	IsDisabled           bool        `json:"isDisabled"`
}

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

type CoinsData

type CoinsData map[string]Tick

type FundSource

type FundSource struct {
	Id          int64       `json:"id"`
	Iban        interface{} `json:"iban"`
	Label       string      `json:"label"`
	Address     string      `json:"address"`
	Currency    string      `json:"currency"`
	AccountName string      `json:"accountName"`
	Confirmed   bool        `json:"confirmed"`
}

type FundSources

type FundSources []FundSource

type JsonResponse

type JsonResponse struct {
	Success bool            `json:"success"`
	Message string          `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type OrderBook

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

type OrderDetail

type OrderDetail struct {
	Id        int64  `json:"id"`
	Side      string `json:"side"`
	State     string `json:"state"`
	OrdType   string `json:"ordType"`
	Currency  string `json:"currency"`
	Price     string `json:"price"`
	Filled    string `json:"filled"`
	Amount    string `json:"amount"`
	Avg       string `json:"avg"`
	Total     string `json:"total"`
	UpdatedAt string `json:"updatedAt"`
	Pair      string `json:"pair"`
	BaseUnit  string `json:"baseUnit"`
	QuoteUnit string `json:"quoteUnit"`
}

type OrdersPage

type OrdersPage struct {
	Per        int64         `json:"per"`
	Items      []OrderDetail `json:"items"`
	NextCursor interface{}   `json:"nextCursor"`
}

type PairsData

type PairsData map[string]Tick

type PlaceOrder

type PlaceOrder struct {
	Id          int64  `json:"id"`
	Bid         string `json:"bid"`
	Ask         string `json:"ask"`
	Price       string `json:"price"`
	Volume      string `json:"volume"`
	ExecutedQty string `json:"executedQty"`
	OrdType     string `json:"ord_type"`
}

type Tick

type Tick struct {
	Name       string      `json:"name"`
	BaseUnit   string      `json:"base_unit"`
	QuoteUnit  string      `json:"quote_unit"`
	AskFee     float64     `json:"ask_fee"`
	BidFee     float64     `json:"bid_fee"`
	Low        string      `json:"low"`
	High       string      `json:"high"`
	Last       string      `json:"last"`
	VisualLow  string      `json:"visualLow"`
	VisualHigh string      `json:"visualHigh"`
	VisualLast string      `json:"visualLast"`
	At         int         `json:"at"`
	Open       string      `json:"open"`
	Volume     interface{} `json:"volume"` //接口返回有时是浮点,有时是字符串
	Market     string      `json:"market"`
	// Buy          float64     `json:"buy"`
	IsUpTend bool `json:"isUpTend"`
	// Sell         float64     `json:"sell"`
	Percent      string `json:"percent"`
	Change       string `json:"change"`
	VisualOpen   string `json:"visualOpen"`
	VisualVolume string `json:"visualVolume"`
	VisualBuy    string `json:"visualBuy"`
	VisualSell   string `json:"visualSell"`
}

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

type TradeHistory

type TradeHistory []struct {
	Tid               int    `json:"tid"`
	Type              string `json:"type"`
	Date              string `json:"date"`
	Price             string `json:"price"`
	Amount            string `json:"amount"`
	VisualPrice       string `json:"visualPrice"`
	VisualAmount      string `json:"visualAmount"`
	VisualQuoteAmount string `json:"visualQuoteAmount"`
}

type WithdrawResponse

type WithdrawResponse struct {
	Error string `json:"error"`
}

type Zebitex

type Zebitex 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 CreateZebitex

func CreateZebitex(config *exchange.Config) *Zebitex

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

func (*Zebitex) ApiKeyGet

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

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

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 (*Zebitex) CanDeposit

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

func (*Zebitex) CanWithdraw

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

func (*Zebitex) CancelAllOrder

func (e *Zebitex) CancelAllOrder() error

func (*Zebitex) CancelOrder

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

func (*Zebitex) CreateFundSource

func (e *Zebitex) CreateFundSource(currency, label, addr string) (bool, FundSource)

don't use this for withdraw

CreateFundSource(currency, label, addr string)

func (*Zebitex) DeleteCoin

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

func (*Zebitex) DeletePair

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

func (*Zebitex) DoAccountOperation

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

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

func (*Zebitex) GetBalance

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

func (*Zebitex) GetCoinBySymbol

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

func (*Zebitex) GetCoinConstraint

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

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

func (*Zebitex) GetCoins

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

func (*Zebitex) GetCoinsData

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

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

func (*Zebitex) GetConstraintFetchMethod

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

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

func (*Zebitex) GetFee

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

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

func (*Zebitex) GetID

func (e *Zebitex) GetID() int

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

func (*Zebitex) GetLotSize

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

func (*Zebitex) GetName

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

func (*Zebitex) GetPairBySymbol

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

func (*Zebitex) GetPairConstraint

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

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

func (*Zebitex) GetPairs

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

func (*Zebitex) GetPairsData

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

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

func (*Zebitex) GetSymbolByCoin

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

func (*Zebitex) GetSymbolByPair

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

func (*Zebitex) GetTradingWebURL

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

func (*Zebitex) GetTxFee

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

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

func (*Zebitex) HasPair

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

func (*Zebitex) InitData

func (e *Zebitex) InitData() error

func (*Zebitex) LimitBuy

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

func (*Zebitex) LimitSell

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

need to test parameter values

func (*Zebitex) ListOrders

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

func (*Zebitex) LoadPublicData

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

func (*Zebitex) OrderBook

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

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

Update delay after order cancelled

func (*Zebitex) SetCoinConstraint

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

func (*Zebitex) SetPairConstraint

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

func (*Zebitex) UpdateAllBalances

func (e *Zebitex) UpdateAllBalances()

func (*Zebitex) UpdateConstraint

func (e *Zebitex) UpdateConstraint()

func (*Zebitex) Withdraw

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

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

Jump to

Keyboard shortcuts

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