latoken

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           = 49
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://api.latoken.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	CurrencyID int     `json:"currencyId"`
	Symbol     string  `json:"symbol"`
	Name       string  `json:"name"`
	Amount     float64 `json:"amount"`
	Available  float64 `json:"available"`
	Frozen     float64 `json:"frozen"`
	Pending    float64 `json:"pending"`
}

type CoinsData

type CoinsData []struct {
	CurrencyID int     `json:"currencyId"`
	Symbol     string  `json:"symbol"`
	Name       string  `json:"name"`
	Precission int     `json:"precission"`
	Type       string  `json:"type"`
	Fee        float64 `json:"fee"`
}

type JsonResponse

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

type Latoken

type Latoken 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 CreateLatoken

func CreateLatoken(config *exchange.Config) *Latoken

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

func (*Latoken) ApiKeyGET

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

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

func (*Latoken) ApiKeyRequestV2

func (e *Latoken) ApiKeyRequestV2(strMethod, strRequestPath string, mapParams map[string]string) string

func (*Latoken) CanDeposit

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

func (*Latoken) CanWithdraw

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

func (*Latoken) CancelAllOrder

func (e *Latoken) CancelAllOrder() error

func (*Latoken) CancelOrder

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

func (*Latoken) DeleteCoin

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

func (*Latoken) DeletePair

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

func (*Latoken) DoAccountOperation

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

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

func (*Latoken) GetBalance

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

func (*Latoken) GetCoinBySymbol

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

func (*Latoken) GetCoinConstraint

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

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

func (*Latoken) GetCoins

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

func (*Latoken) GetCoinsData

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

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

func (*Latoken) GetConstraintFetchMethod

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

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

func (*Latoken) GetFee

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

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

func (*Latoken) GetID

func (e *Latoken) GetID() int

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

func (*Latoken) GetLotSize

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

func (*Latoken) GetName

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

func (*Latoken) GetPairBySymbol

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

func (*Latoken) GetPairConstraint

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

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

func (*Latoken) GetPairs

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

func (*Latoken) GetPairsData

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

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

func (*Latoken) GetSymbolByCoin

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

func (*Latoken) GetSymbolByPair

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

func (*Latoken) GetTradingWebURL

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

func (*Latoken) GetTxFee

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

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

func (*Latoken) HasPair

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

func (*Latoken) InitData

func (e *Latoken) InitData() error

func (*Latoken) LimitBuy

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

func (*Latoken) LimitSell

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

func (*Latoken) ListOrders

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

func (*Latoken) LoadPublicData

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

************** Public API **************

func (*Latoken) OrderBook

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

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

func (*Latoken) SetCoinConstraint

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

func (*Latoken) SetPairConstraint

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

func (*Latoken) UpdateAllBalances

func (e *Latoken) UpdateAllBalances()

func (*Latoken) UpdateConstraint

func (e *Latoken) UpdateConstraint()

func (*Latoken) Withdraw

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

type OrderBook

type OrderBook struct {
	PairID string  `json:"pairId"`
	Symbol string  `json:"symbol"`
	Spread float64 `json:"spread"`
	Asks   []struct {
		Price  float64 `json:"price"`
		Amount float64 `json:"amount"`
	} `json:"asks"`
	Bids []struct {
		Price  float64 `json:"price"`
		Amount float64 `json:"amount"`
	} `json:"bids"`
}

type OrderStatus

type OrderStatus struct {
	OrderID         string  `json:"orderId"`
	CliOrdID        string  `json:"cliOrdId"`
	PairID          int     `json:"pairId"`
	Symbol          string  `json:"symbol"`
	Side            string  `json:"side"`
	OrderType       string  `json:"orderType"`
	Price           float64 `json:"price"`
	Amount          float64 `json:"amount"`
	OrderStatus     string  `json:"orderStatus"`
	ExecutedAmount  float64 `json:"executedAmount"`
	ReaminingAmount float64 `json:"reaminingAmount"`
	TimeCreated     int64   `json:"timeCreated"`
	TimeFilled      int     `json:"timeFilled"`
}

type PairsData

type PairsData []struct {
	PairID          int     `json:"pairId"`
	Symbol          string  `json:"symbol"`
	BaseCurrency    string  `json:"baseCurrency"`
	QuotedCurrency  string  `json:"quotedCurrency"`
	MakerFee        float64 `json:"makerFee"`
	TakerFee        float64 `json:"takerFee"`
	PricePrecision  int     `json:"pricePrecision"`
	AmountPrecision int     `json:"amountPrecision"`
	MinQty          float64 `json:"minQty"`
}

type PlaceOrder

type PlaceOrder struct {
	OrderID   string  `json:"orderId"`
	CliOrdID  string  `json:"cliOrdId"`
	PairID    int     `json:"pairId"`
	Symbol    string  `json:"symbol"`
	Side      string  `json:"side"`
	OrderType string  `json:"orderType"`
	Price     float64 `json:"price"`
	Amount    float64 `json:"amount"`
}

type TestBuy

type TestBuy struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	OrderID string `json:"orderId"`
}

type WithdrawResponse

type WithdrawResponse struct {
	WithdrawalID string `json:"withdrawalId"`
	CodeRequired bool   `json:"codeRequired"`
	Transaction  struct {
		ID               string `json:"id"`
		Status           string `json:"status"`
		Type             string `json:"type"`
		SenderAddress    string `json:"senderAddress"`
		RecipientAddress string `json:"recipientAddress"`
		Amount           string `json:"amount"`
		Timestamp        int64  `json:"timestamp"`
		TransactionHash  string `json:"transactionHash"`
		BlockHeight      int    `json:"blockHeight"`
		Currency         string `json:"currency"`
		RejectReason     string `json:"rejectReason"`
		Memo             string `json:"memo"`
		PaymentProvider  string `json:"paymentProvider"`
		RequiresCode     bool   `json:"requiresCode"`
	} `json:"transaction"`
}

Jump to

Keyboard shortcuts

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