switcheo

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           = 55
	DEFAULT_TAKER_FEE    = 0.0020
	DEFAULT_MAKER_FEE    = 0
	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://api.switcheo.network"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Asset     string  `json:"asset"`
	Total     float64 `json:"total"`
	Available float64 `json:"available"`
	Locked    float64 `json:"locked"`
}

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

type CoinsData

type CoinsData map[string]Token

type JsonResponse

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

type ListData

type ListData map[string]ListItem

type ListItem

type ListItem struct {
	Start  int  `json:"start"`
	End    int  `json:"end"`
	Paused bool `json:"paused"`
}

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

type OrderBook

type OrderBook struct {
	Price    string `json:"price"`
	Quantity string `json:"quantity"`
}

type OrderBooks

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

type Pair

type Pair struct {
	Name             string `json:"name"`
	Precision        int    `json:"precision"`
	BaseAssetName    string `json:"baseAssetName"`
	BaseAssetSymbol  string `json:"baseAssetSymbol"`
	BaseContract     string `json:"baseContract"`
	QuoteAssetName   string `json:"quoteAssetName"`
	QuoteAssetSymbol string `json:"quoteAssetSymbol"`
	QuoteContract    string `json:"quoteContract"`
}

type PairsData

type PairsData []Pair

type PlaceOrder

type PlaceOrder struct {
	Symbol       string `json:"symbol"`
	OrderID      string `json:"orderId"`
	Side         string `json:"side"`
	Type         string `json:"type"`
	Price        string `json:"price"`
	AveragePrice string `json:"executedQty"`
	OrigQty      string `json:"origQty"`
	ExecutedQty  string `json:"executedQty"`
	Status       string `json:"status"`
	TimeInForce  string `json:"timeInForce"`
}

type Switcheo

type Switcheo 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 CreateSwitcheo

func CreateSwitcheo(config *exchange.Config) *Switcheo

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

func (*Switcheo) ApiKeyGet

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

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

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

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

func (*Switcheo) CanWithdraw

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

func (*Switcheo) CancelAllOrder

func (e *Switcheo) CancelAllOrder() error

func (*Switcheo) CancelOrder

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

func (*Switcheo) DeleteCoin

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

func (*Switcheo) DeletePair

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

func (*Switcheo) DoAccountOperation

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

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

func (*Switcheo) GetBalance

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

func (*Switcheo) GetCoinBySymbol

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

func (*Switcheo) GetCoinConstraint

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

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

func (*Switcheo) GetCoins

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

func (*Switcheo) GetCoinsData

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

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

func (*Switcheo) GetConstraintFetchMethod

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

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

func (*Switcheo) GetFee

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

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

func (*Switcheo) GetID

func (e *Switcheo) GetID() int

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

func (*Switcheo) GetLotSize

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

func (*Switcheo) GetName

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

func (*Switcheo) GetPairBySymbol

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

func (*Switcheo) GetPairConstraint

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

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

func (*Switcheo) GetPairs

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

func (*Switcheo) GetPairsData

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

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

func (*Switcheo) GetSymbolByCoin

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

func (*Switcheo) GetSymbolByPair

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

func (*Switcheo) GetTradingWebURL

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

func (*Switcheo) GetTxFee

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

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

func (*Switcheo) HasPair

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

func (*Switcheo) InitData

func (e *Switcheo) InitData() error

func (*Switcheo) LimitBuy

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

func (*Switcheo) LimitSell

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

func (*Switcheo) ListOrders

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

func (*Switcheo) LoadPublicData

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

func (*Switcheo) OrderBook

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

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

func (*Switcheo) SetCoinConstraint

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

func (*Switcheo) SetPairConstraint

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

func (*Switcheo) UpdateAllBalances

func (e *Switcheo) UpdateAllBalances()

func (*Switcheo) UpdateConstraint

func (e *Switcheo) UpdateConstraint()

func (*Switcheo) Withdraw

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

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

type Token

type Token struct {
	Symbol           string      `json:"symbol"`
	Name             string      `json:"name"`
	Type             string      `json:"type"`
	Hash             string      `json:"hash"`
	Decimals         int         `json:"decimals"`
	TransferDecimals int         `json:"transfer_decimals"`
	Precision        int         `json:"precision"`
	MinimumQuantity  string      `json:"minimum_quantity"`
	TradingActive    bool        `json:"trading_active"`
	IsStablecoin     bool        `json:"is_stablecoin"`
	StablecoinType   interface{} `json:"stablecoin_type"`
	Active           bool        `json:"active"`
	ListingInfo      ListData    `json:"listing_info"`
}

type WithdrawResponse

type WithdrawResponse struct {
	Msg     string `json:"msg"`
	Success bool   `json:"success"`
	ID      string `json:"id"`
}

Jump to

Keyboard shortcuts

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