bitmart

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           = 36
	DEFAULT_TAKER_FEE    = 0.002
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_TXFEE        = 0.005
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://openapi.bitmart.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

type AccountBalances

type AccountBalances []struct {
	Name      string `json:"name"`
	Available string `json:"available"`
	Frozen    string `json:"frozen"`
	ID        string `json:"id"`
}

type Bitmart

type Bitmart struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"website"`

	API_KEY    string
	API_SECRET string
	Passphrase string

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

func CreateBitmart

func CreateBitmart(config *exchange.Config) *Bitmart

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

func (*Bitmart) ApiKeyRequest

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

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

func (*Bitmart) CanWithdraw

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

func (*Bitmart) CancelAllOrder

func (e *Bitmart) CancelAllOrder() error

func (*Bitmart) CancelOrder

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

func (*Bitmart) DeleteCoin

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

func (*Bitmart) DeletePair

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

func (*Bitmart) DoAccountOperation

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

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

func (*Bitmart) GetBalance

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

func (*Bitmart) GetCoinBySymbol

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

func (*Bitmart) GetCoinConstraint

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

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

func (*Bitmart) GetCoins

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

func (*Bitmart) GetCoinsData

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

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

func (*Bitmart) GetConstraintFetchMethod

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

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

func (*Bitmart) GetFee

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

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

func (*Bitmart) GetID

func (e *Bitmart) GetID() int

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

func (*Bitmart) GetLotSize

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

func (*Bitmart) GetName

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

func (*Bitmart) GetPairBySymbol

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

func (*Bitmart) GetPairConstraint

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

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

func (*Bitmart) GetPairs

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

func (*Bitmart) GetPairsData

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

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

func (*Bitmart) GetSymbolByCoin

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

func (*Bitmart) GetSymbolByPair

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

func (*Bitmart) GetToken

func (e *Bitmart) GetToken(key string, secret string, memo string) string

func (*Bitmart) GetTradingWebURL

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

func (*Bitmart) GetTxFee

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

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

func (*Bitmart) HasPair

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

func (*Bitmart) InitData

func (e *Bitmart) InitData() error

func (*Bitmart) LimitBuy

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

func (*Bitmart) LimitSell

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

func (*Bitmart) ListOrders

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

func (*Bitmart) LoadPublicData

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

func (*Bitmart) OrderBook

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

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

func (*Bitmart) SetCoinConstraint

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

func (*Bitmart) SetPairConstraint

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

func (*Bitmart) TokenReq

func (e *Bitmart) TokenReq(resource string, mapParams map[string]string) string

func (*Bitmart) UpdateAllBalances

func (e *Bitmart) UpdateAllBalances()

func (*Bitmart) UpdateConstraint

func (e *Bitmart) UpdateConstraint()

func (*Bitmart) Withdraw

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

type CoinsData

type CoinsData []struct {
	Name            string `json:"name"`
	WithdrawEnabled bool   `json:"withdraw_enabled"`
	ID              string `json:"id"`
	DepositEnabled  bool   `json:"deposit_enabled"`
}

type OrderBook

type OrderBook struct {
	Buys []struct {
		Amount string `json:"amount"`
		Total  string `json:"total"`
		Price  string `json:"price"`
		Count  string `json:"count"`
	} `json:"buys"`
	Sells []struct {
		Amount string `json:"amount"`
		Total  string `json:"total"`
		Price  string `json:"price"`
		Count  string `json:"count"`
	} `json:"sells"`
}

type OrderStatus

type OrderStatus struct {
	EntrustID       int    `json:"entrust_id"`
	Symbol          string `json:"symbol"`
	Timestamp       int64  `json:"timestamp"`
	Side            string `json:"side"`
	Price           string `json:"price"`
	Fees            string `json:"fees"`
	OriginalAmount  string `json:"original_amount"`
	ExecutedAmount  string `json:"executed_amount"`
	RemainingAmount string `json:"remaining_amount"`
	Status          int    `json:"status"`
}

type PairsData

type PairsData []struct {
	ID                string `json:"id"`
	BaseCurrency      string `json:"base_currency"`
	QuoteCurrency     string `json:"quote_currency"`
	QuoteIncrement    string `json:"quote_increment"`
	BaseMinSize       string `json:"base_min_size"`
	BaseMaxSize       string `json:"base_max_size"`
	PriceMinPrecision int    `json:"price_min_precision"`
	PriceMaxPrecision int    `json:"price_max_precision"`
	Expiration        string `json:"expiration"`
}

type PlaceOrder

type PlaceOrder struct {
	Message   string `json:"message"`
	EntrustID int    `json:"entrust_id"`
}

Jump to

Keyboard shortcuts

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