homiex

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           = 69
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	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 string = "https://api.homiex.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	CanTrade    bool `json:"canTrade"`
	CanWithdraw bool `json:"canWithdraw"`
	CanDeposit  bool `json:"canDeposit"`
	UpdateTime  int  `json:"updateTime"`
	Balances    []struct {
		Asset   string `json:"asset"`
		Total   string `json:"total"`
		Free    string `json:"free"`
		Locked  string `json:"locked"`
		AssetID string `json:"assetId"`
	} `json:"balances"`
}

type CancelOrder

type CancelOrder struct {
	Symbol        string `json:"symbol"`
	ClientOrderID string `json:"clientOrderId"`
	OrderID       string `json:"orderId"`
	Status        string `json:"status"`
}

type Homiex

type Homiex 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 CreateHomiex

func CreateHomiex(config *exchange.Config) *Homiex

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

func (*Homiex) ApiKeyGET

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

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

func (*Homiex) CanDeposit

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

func (*Homiex) CanWithdraw

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

func (*Homiex) CancelAllOrder

func (e *Homiex) CancelAllOrder() error

func (*Homiex) CancelOrder

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

func (*Homiex) DeleteCoin

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

func (*Homiex) DeletePair

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

func (*Homiex) DoAccountOperation

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

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

func (*Homiex) GetBalance

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

func (*Homiex) GetCoinBySymbol

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

func (*Homiex) GetCoinConstraint

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

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

func (*Homiex) GetCoins

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

func (*Homiex) GetCoinsData

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

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

func (*Homiex) GetConstraintFetchMethod

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

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

func (*Homiex) GetFee

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

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

func (*Homiex) GetID

func (e *Homiex) GetID() int

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

func (*Homiex) GetLotSize

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

func (*Homiex) GetName

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

func (*Homiex) GetPairBySymbol

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

func (*Homiex) GetPairConstraint

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

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

func (*Homiex) GetPairs

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

func (*Homiex) GetPairsData

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

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

func (*Homiex) GetSymbolByCoin

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

func (*Homiex) GetSymbolByPair

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

func (*Homiex) GetTradingWebURL

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

func (*Homiex) GetTxFee

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

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

func (*Homiex) HasPair

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

func (*Homiex) InitData

func (e *Homiex) InitData() error

func (*Homiex) LimitBuy

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

func (*Homiex) LimitSell

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

func (*Homiex) ListOrders

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

func (*Homiex) LoadPublicData

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

func (*Homiex) OrderBook

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

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

func (*Homiex) SetCoinConstraint

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

func (*Homiex) SetPairConstraint

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

func (*Homiex) UpdateAllBalances

func (e *Homiex) UpdateAllBalances()

func (*Homiex) UpdateConstraint

func (e *Homiex) UpdateConstraint()

func (*Homiex) Withdraw

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

x

type JsonResponse

type JsonResponse struct {
	// error section
	Code int    `json:"code"`
	Msg  string `json:"msg"`

	Success bool            `json:"success"`
	Message string          `json:"message"`
	Result  json.RawMessage `json:"result"`
}

type OrderBook

type OrderBook struct {
	Time int64      `json:"time"`
	Bids [][]string `json:"bids"`
	Asks [][]string `json:"asks"`
}

type OrderStatus

type OrderStatus struct {
	Symbol              string `json:"symbol"`
	OrderID             string `json:"orderId"`
	ClientOrderID       string `json:"clientOrderId"`
	Price               string `json:"price"`
	OrigQty             string `json:"origQty"`
	ExecutedQty         string `json:"executedQty"`
	CummulativeQuoteQty string `json:"cummulativeQuoteQty"`
	Status              string `json:"status"`
	TimeInForce         string `json:"timeInForce"`
	Type                string `json:"type"`
	Side                string `json:"side"`
	StopPrice           string `json:"stopPrice"`
	IcebergQty          string `json:"icebergQty"`
	Time                string `json:"time"`
	UpdateTime          string `json:"updateTime"`
	IsWorking           bool   `json:"isWorking"`
}

type PairsData

type PairsData struct {
	Timezone      string        `json:"timezone"`
	ServerTime    string        `json:"serverTime"`
	BrokerFilters []interface{} `json:"brokerFilters"`
	Symbols       []struct {
		Filters []struct {
			MinPrice    string `json:"minPrice,omitempty"`
			MaxPrice    string `json:"maxPrice,omitempty"`
			TickSize    string `json:"tickSize,omitempty"`
			FilterType  string `json:"filterType"`
			MinQty      string `json:"minQty,omitempty"`
			MaxQty      string `json:"maxQty,omitempty"`
			StepSize    string `json:"stepSize,omitempty"`
			MinNotional string `json:"minNotional,omitempty"`
		} `json:"filters"`
		ExchangeID         string `json:"exchangeId"`
		Symbol             string `json:"symbol"`
		SymbolName         string `json:"symbolName"`
		Status             string `json:"status"`
		BaseAsset          string `json:"baseAsset"`
		BaseAssetPrecision string `json:"baseAssetPrecision"`
		QuoteAsset         string `json:"quoteAsset"`
		QuotePrecision     string `json:"quotePrecision"`
		IcebergAllowed     bool   `json:"icebergAllowed"`
	} `json:"symbols"`
}

type PlaceOrder

type PlaceOrder struct {
	OrderID       string `json:"orderId"`
	ClientOrderID string `json:"clientOrderId"`
}

type TradeHistory

type TradeHistory []struct {
	Price        string `json:"price"`
	Time         int64  `json:"time"`
	Qty          string `json:"qty"`
	IsBuyerMaker bool   `json:"isBuyerMaker"`
}

type Withdraw

type Withdraw struct {
	Ret int `json:"ret"`
}

Jump to

Keyboard shortcuts

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