hitbtc

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

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID     = 15
	DEFAULT_LISTED = true
)
View Source
const (
	API_URL string = "https://api.hitbtc.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Currency  string `json:"currency"`
	Available string `json:"available"`
	Reserved  string `json:"reserved"`
}

type CoinsData

type CoinsData []struct {
	ID                 string `json:"id"`
	FullName           string `json:"fullName"`
	Crypto             bool   `json:"crypto"`
	PayinEnabled       bool   `json:"payinEnabled"`
	PayinPaymentID     bool   `json:"payinPaymentId"`
	PayinConfirmations int    `json:"payinConfirmations"`
	PayoutEnabled      bool   `json:"payoutEnabled"`
	PayoutIsPaymentID  bool   `json:"payoutIsPaymentId"`
	TransferEnabled    bool   `json:"transferEnabled"`
	Delisted           bool   `json:"delisted"`
	PayoutFee          string `json:"payoutFee"`
}

type ErrResponse

type ErrResponse struct {
	Error struct {
		Code        int    `json:"code"`
		Message     string `json:"message"`
		Description string `json:"description"`
	} `json:"error"`
}

type Hitbtc

type Hitbtc 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 CreateHitbtc

func CreateHitbtc(config *exchange.Config) *Hitbtc

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

func (*Hitbtc) ApiKeyRequest

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

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

func (*Hitbtc) CanWithdraw

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

func (*Hitbtc) CancelAllOrder

func (e *Hitbtc) CancelAllOrder() error

func (*Hitbtc) CancelOrder

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

func (*Hitbtc) DeleteCoin

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

func (*Hitbtc) DeletePair

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

func (*Hitbtc) DoAccountOperation

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

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

func (*Hitbtc) GetBalance

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

func (*Hitbtc) GetCoinBySymbol

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

func (*Hitbtc) GetCoinConstraint

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

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

func (*Hitbtc) GetCoins

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

func (*Hitbtc) GetCoinsData

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

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

func (*Hitbtc) GetConstraintFetchMethod

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

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

func (*Hitbtc) GetFee

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

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

func (*Hitbtc) GetID

func (e *Hitbtc) GetID() int

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

func (*Hitbtc) GetLotSize

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

func (*Hitbtc) GetName

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

func (*Hitbtc) GetPairBySymbol

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

func (*Hitbtc) GetPairConstraint

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

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

func (*Hitbtc) GetPairs

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

func (*Hitbtc) GetPairsData

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

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

func (*Hitbtc) GetSymbolByCoin

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

func (*Hitbtc) GetSymbolByPair

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

func (*Hitbtc) GetTradingWebURL

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

func (*Hitbtc) GetTxFee

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

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

func (*Hitbtc) HasPair

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

func (*Hitbtc) InitData

func (e *Hitbtc) InitData() error

func (*Hitbtc) LimitBuy

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

func (*Hitbtc) LimitSell

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

func (*Hitbtc) ListOrders

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

func (*Hitbtc) LoadPublicData

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

func (*Hitbtc) OrderBook

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

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

func (*Hitbtc) SetCoinConstraint

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

func (*Hitbtc) SetPairConstraint

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

func (*Hitbtc) UpdateAllBalances

func (e *Hitbtc) UpdateAllBalances()

func (*Hitbtc) UpdateConstraint

func (e *Hitbtc) UpdateConstraint()

func (*Hitbtc) Withdraw

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

type OrderBook

type OrderBook struct {
	Ask []struct {
		Price string `json:"price"`
		Size  string `json:"size"`
	} `json:"ask"`
	Bid []struct {
		Price string `json:"price"`
		Size  string `json:"size"`
	} `json:"bid"`
}

type PairsData

type PairsData []struct {
	ID                   string `json:"id"`
	BaseCurrency         string `json:"baseCurrency"`
	QuoteCurrency        string `json:"quoteCurrency"`
	QuantityIncrement    string `json:"quantityIncrement"`
	TickSize             string `json:"tickSize"`
	TakeLiquidityRate    string `json:"takeLiquidityRate"`
	ProvideLiquidityRate string `json:"provideLiquidityRate"`
	FeeCurrency          string `json:"feeCurrency"`
}

type PlaceOrder

type PlaceOrder struct {
	ID            int64     `json:"id"`
	ClientOrderID string    `json:"clientOrderId"`
	Symbol        string    `json:"symbol"`
	Side          string    `json:"side"`
	Status        string    `json:"status"`
	Type          string    `json:"type"`
	TimeInForce   string    `json:"timeInForce"`
	Quantity      string    `json:"quantity"`
	Price         string    `json:"price"`
	CumQuantity   string    `json:"cumQuantity"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
	PostOnly      bool      `json:"postOnly"`
}

type TradeHistory

type TradeHistory []struct {
	ID            int       `json:"id"`
	ClientOrderID string    `json:"clientOrderId"`
	OrderID       int       `json:"orderId"`
	Symbol        string    `json:"symbol"`
	Side          string    `json:"side"`
	Quantity      string    `json:"quantity"`
	Price         string    `json:"price"`
	Fee           string    `json:"fee"`
	Timestamp     time.Time `json:"timestamp"`
}

type Withdraw

type Withdraw struct {
	ID string `json:"id"`
}

Jump to

Keyboard shortcuts

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