stex

package
Version: v0.0.0-...-65438fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API_URL  string = "https://app.stex.com/api2"
	API3_URL string = "https://api3.stex.com"
)
View Source
const (
	DEFAULT_ID           = 4
	DEFAULT_TAKER_FEE    = 0.002
	DEFAULT_MAKER_FEE    = 0.002
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_CONFIRMATION = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	Email        string            `json:"email"`
	Username     string            `json:"username"`
	Hash         string            `json:"hash"`
	IntercomHash string            `json:"intercom_hash"`
	Funds        map[string]string `json:"funds"`
	OpenOrders   int               `json:"open_orders"`
	ServerTime   int               `json:"server_time"`
}

type CancelOrder

type CancelOrder struct {
	PutIntoProcessingQueue    []*PlaceOrder `json:"put_into_processing_queue"`
	NotPutIntoProcessingQueue []interface{} `json:"not_put_into_processing_queue"`
	Message                   string        `json:"message"`
}

type CoinsData

type CoinsData []struct {
	ID                        int         `json:"id"`
	Code                      string      `json:"code"`
	Name                      string      `json:"name"`
	Active                    bool        `json:"active"`
	Delisted                  bool        `json:"delisted"`
	Precision                 int         `json:"precision"`
	MinimumTxConfirmations    int         `json:"minimum_tx_confirmations"`
	MinimumWithdrawalAmount   string      `json:"minimum_withdrawal_amount"`
	MinimumDepositAmount      string      `json:"minimum_deposit_amount"`
	DepositFeeCurrencyID      int         `json:"deposit_fee_currency_id"`
	DepositFeeCurrencyCode    string      `json:"deposit_fee_currency_code"`
	DepositFeeConst           string      `json:"deposit_fee_const"`
	DepositFeePercent         string      `json:"deposit_fee_percent"`
	WithdrawalFeeCurrencyID   int         `json:"withdrawal_fee_currency_id"`
	WithdrawalFeeCurrencyCode string      `json:"withdrawal_fee_currency_code"`
	WithdrawalFeeConst        string      `json:"withdrawal_fee_const"`
	WithdrawalFeePercent      string      `json:"withdrawal_fee_percent"`
	BlockExplorerURL          string      `json:"block_explorer_url"`
	ProtocolSpecificSettings  interface{} `json:"protocol_specific_settings"`
}

type EmptyAccount

type EmptyAccount struct {
	Success int `json:"success"`
	Data    struct {
		Email        string        `json:"email"`
		Username     string        `json:"username"`
		Hash         string        `json:"hash"`
		IntercomHash string        `json:"intercom_hash"`
		Funds        []interface{} `json:"funds"`
		OpenOrders   int           `json:"open_orders"`
		ServerTime   int           `json:"server_time"`
	} `json:"data"`
}

type JsonResponse

type JsonResponse struct {
	Success int             `json:"success"`
	Data    json.RawMessage `json:"data"`
	Error   string          `json:"error"`
	Notice  string          `json:"notice"`
	Message string          `json:"message"`
}

type JsonResponseV3

type JsonResponseV3 struct {
	Success bool            `json:"success"`
	Data    json.RawMessage `json:"data"`
	Message string          `json:"message"`
	Err     interface{}     `json:"errors"`
}

type OpenOrders

type OpenOrders []struct {
	ID               int     `json:"id"`
	CurrencyPairID   int     `json:"currency_pair_id"`
	CurrencyPairName string  `json:"currency_pair_name"`
	Price            string  `json:"price"`
	TriggerPrice     float64 `json:"trigger_price"`
	InitialAmount    string  `json:"initial_amount"`
	ProcessedAmount  string  `json:"processed_amount"`
	Type             string  `json:"type"`
	OriginalType     string  `json:"original_type"`
	Created          string  `json:"created"`
	Timestamp        string  `json:"timestamp"`
	Status           string  `json:"status"`
}

type OrderBook

type OrderBook struct {
	Ask []struct {
		CurrencyPairID   int     `json:"currency_pair_id"`
		Amount           string  `json:"amount"`
		Price            string  `json:"price"`
		Amount2          string  `json:"amount2"`
		Count            int     `json:"count"`
		CumulativeAmount float64 `json:"cumulative_amount"`
	} `json:"ask"`
	Bid []struct {
		CurrencyPairID   int     `json:"currency_pair_id"`
		Amount           string  `json:"amount"`
		Price            string  `json:"price"`
		Amount2          string  `json:"amount2"`
		Count            int     `json:"count"`
		CumulativeAmount float64 `json:"cumulative_amount"`
	} `json:"bid"`
}

type PairsData

type PairsData []struct {
	ID                int    `json:"id"`
	CurrencyID        int    `json:"currency_id"`
	CurrencyCode      string `json:"currency_code"`
	CurrencyName      string `json:"currency_name"`
	MarketCurrencyID  int    `json:"market_currency_id"`
	MarketCode        string `json:"market_code"`
	MarketName        string `json:"market_name"`
	MinOrderAmount    string `json:"min_order_amount"`
	MinBuyPrice       string `json:"min_buy_price"`
	MinSellPrice      string `json:"min_sell_price"`
	BuyFeePercent     string `json:"buy_fee_percent"`
	SellFeePercent    string `json:"sell_fee_percent"`
	Active            bool   `json:"active"`
	Delisted          bool   `json:"delisted"`
	PairMessage       string `json:"pair_message"`
	CurrencyPrecision int    `json:"currency_precision"`
	MarketPrecision   int    `json:"market_precision"`
	Symbol            string `json:"symbol"`
	GroupName         string `json:"group_name"`
	GroupID           int    `json:"group_id"`
}

type PlaceOrder

type PlaceOrder struct {
	ID              int         `json:"id"`
	CurrencyPairID  int         `json:"currency_pair_id"`
	Price           string      `json:"price"`
	TriggerPrice    float64     `json:"trigger_price"`
	InitialAmount   string      `json:"initial_amount"`
	ProcessedAmount string      `json:"processed_amount"`
	Type            string      `json:"type"`
	OriginalType    string      `json:"original_type"`
	Created         string      `json:"created"`
	Timestamp       interface{} `json:"timestamp"`
	Status          string      `json:"status"`
}

type Stex

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

	API_KEY    string
	API_SECRET string
	ExpireTS   int64

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

func CreateStex

func CreateStex(config *exchange.Config) *Stex

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

func (*Stex) ApiKeyGet

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

func (e *Stex) ApiKeyRequest(method string, mapParams map[string]interface{}, strRequestPath string) string

func (*Stex) CanDeposit

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

func (*Stex) CanWithdraw

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

func (*Stex) CancelAllOrder

func (e *Stex) CancelAllOrder() error

func (*Stex) CancelOrder

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

func (*Stex) DeleteCoin

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

func (*Stex) DeletePair

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

func (*Stex) DoAccountOperation

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

func (*Stex) GetBalance

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

func (*Stex) GetCoinBySymbol

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

func (*Stex) GetCoinConstraint

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

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

func (*Stex) GetCoins

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

func (*Stex) GetCoinsData

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

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

func (*Stex) GetConstraintFetchMethod

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

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

func (*Stex) GetFee

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

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

func (*Stex) GetID

func (e *Stex) GetID() int

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

func (*Stex) GetIDByPair

func (e *Stex) GetIDByPair(pair *pair.Pair) string

func (*Stex) GetLotSize

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

func (*Stex) GetName

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

func (*Stex) GetPairByID

func (e *Stex) GetPairByID(exID string) *pair.Pair

func (*Stex) GetPairBySymbol

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

func (*Stex) GetPairConstraint

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

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

func (*Stex) GetPairs

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

func (*Stex) GetPairsData

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

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

func (*Stex) GetSymbolByCoin

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

func (*Stex) GetSymbolByPair

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

func (*Stex) GetTradingWebURL

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

func (*Stex) GetTxFee

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

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

func (*Stex) HasPair

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

func (*Stex) InitData

func (e *Stex) InitData() error

func (*Stex) LimitBuy

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

func (*Stex) LimitSell

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

func (*Stex) ListOrders

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

func (*Stex) LoadPublicData

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

func (*Stex) OrderBook

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

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

func (*Stex) SetCoinConstraint

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

func (*Stex) SetPairConstraint

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

func (*Stex) UpdateAllBalances

func (e *Stex) UpdateAllBalances()

func (*Stex) UpdateConstraint

func (e *Stex) UpdateConstraint()

func (*Stex) Withdraw

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

type TradeHistory

type TradeHistory []struct {
	ID        int    `json:"id"`
	Price     string `json:"price"`
	Amount    string `json:"amount"`
	Type      string `json:"type"`
	Timestamp string `json:"timestamp"`
}

type WalletDetails

type WalletDetails []struct {
	ID              int    `json:"id"`
	CurrencyID      int    `json:"currency_id"`
	Delisted        bool   `json:"delisted"`
	Disabled        bool   `json:"disabled"`
	DisableDeposits bool   `json:"disable_deposits"`
	CurrencyCode    string `json:"currency_code"`
	Balance         string `json:"balance"`
	FrozenBalance   string `json:"frozen_balance"`
	BonusBalance    string `json:"bonus_balance"`
}

type WebOrderBook

type WebOrderBook []struct {
	CurrencyPairID   int     `json:"currency_pair_id"`
	Amount           string  `json:"amount"`
	Price            string  `json:"price"`
	Amount2          string  `json:"amount2"`
	Count            int     `json:"count"`
	CumulativeAmount float64 `json:"cumulative_amount"`
}

type WithdrawResult

type WithdrawResult struct {
	ID                int         `json:"id"`
	Amount            string      `json:"amount"`
	CurrencyID        int         `json:"currency_id"`
	CurrencyCode      string      `json:"currency_code"`
	Fee               string      `json:"fee"`
	FeeCurrencyID     int         `json:"fee_currency_id"`
	FeeCurrencyCode   string      `json:"fee_currency_code"`
	Status            string      `json:"status"`
	CreatedAt         string      `json:"created_at"`
	CreatedTs         string      `json:"created_ts"`
	UpdatedAt         string      `json:"updated_at"`
	UpdatedTs         string      `json:"updated_ts"`
	Txid              interface{} `json:"txid"`
	WithdrawalAddress struct {
		Address                        string `json:"address"`
		AddressName                    string `json:"address_name"`
		AdditionalAddressParameter     string `json:"additional_address_parameter"`
		AdditionalAddressParameterName string `json:"additional_address_parameter_name"`
	} `json:"withdrawal_address"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL