liquid

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: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 21
	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.liquid.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Currency string `json:"currency"`
	Balance  string `json:"balance"`
}

type CancelOrder

type CancelOrder struct {
	ID     int    `json:"id"`
	Status string `json:"status"`
}

type CoinsData

type CoinsData []struct {
	CurrencyType         string      `json:"currency_type"`
	Currency             string      `json:"currency"`
	Symbol               string      `json:"symbol"`
	AssetsPrecision      int         `json:"assets_precision"`
	QuotingPrecision     int         `json:"quoting_precision"`
	MinimumWithdrawal    float64     `json:"minimum_withdrawal"`
	WithdrawalFee        float64     `json:"withdrawal_fee"`
	MinimumFee           interface{} `json:"minimum_fee"`
	MinimumOrderQuantity interface{} `json:"minimum_order_quantity"`
	DisplayPrecision     int         `json:"display_precision"`
	Depositable          bool        `json:"depositable"`
	Withdrawable         bool        `json:"withdrawable"`
	DiscountFee          float64     `json:"discount_fee"`
	CreditCardFundable   bool        `json:"credit_card_fundable,omitempty"`
	Lendable             bool        `json:"lendable"`
	PositionFundable     bool        `json:"position_fundable"`
}

type Liquid

type Liquid 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 CreateLiquid

func CreateLiquid(config *exchange.Config) *Liquid

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

func (*Liquid) ApiKeyRequest

func (e *Liquid) ApiKeyRequest(strMethod string, mapParams map[string]interface{}, 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 (*Liquid) CanDeposit

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

func (*Liquid) CanWithdraw

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

func (*Liquid) CancelAllOrder

func (e *Liquid) CancelAllOrder() error

func (*Liquid) CancelOrder

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

func (*Liquid) DeleteCoin

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

func (*Liquid) DeletePair

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

func (*Liquid) DoAccountOperation

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

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

func (*Liquid) GetBalance

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

func (*Liquid) GetCoinBySymbol

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

func (*Liquid) GetCoinConstraint

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

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

func (*Liquid) GetCoins

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

func (*Liquid) GetCoinsData

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

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

func (*Liquid) GetConstraintFetchMethod

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

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

func (*Liquid) GetFee

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

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

func (*Liquid) GetID

func (e *Liquid) GetID() int

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

func (*Liquid) GetLotSize

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

func (*Liquid) GetName

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

func (*Liquid) GetPairBySymbol

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

func (*Liquid) GetPairConstraint

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

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

func (*Liquid) GetPairs

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

func (*Liquid) GetPairsData

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

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

func (*Liquid) GetSymbolByCoin

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

func (*Liquid) GetSymbolByPair

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

func (*Liquid) GetTradingWebURL

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

func (*Liquid) GetTxFee

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

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

func (*Liquid) HasPair

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

func (*Liquid) InitData

func (e *Liquid) InitData() error

func (*Liquid) LimitBuy

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

func (*Liquid) LimitSell

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

func (*Liquid) ListOrders

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

func (*Liquid) LoadPublicData

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

************** PUBLIC API **************

func (*Liquid) OrderBook

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

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

func (*Liquid) SetCoinConstraint

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

func (*Liquid) SetPairConstraint

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

func (*Liquid) UpdateAllBalances

func (e *Liquid) UpdateAllBalances()

func (*Liquid) UpdateConstraint

func (e *Liquid) UpdateConstraint()

func (*Liquid) Withdraw

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

type OrderBook

type OrderBook struct {
	BuyPriceLevels  [][]string `json:"buy_price_levels"`
	SellPriceLevels [][]string `json:"sell_price_levels"`
}

type OrderStatus

type OrderStatus struct {
	ID                   int         `json:"id"`
	OrderType            string      `json:"order_type"`
	Quantity             string      `json:"quantity"`
	DiscQuantity         string      `json:"disc_quantity"`
	IcebergTotalQuantity string      `json:"iceberg_total_quantity"`
	Side                 string      `json:"side"`
	FilledQuantity       string      `json:"filled_quantity"`
	Price                float64     `json:"price"`
	CreatedAt            int         `json:"created_at"`
	UpdatedAt            int         `json:"updated_at"`
	Status               string      `json:"status"`
	LeverageLevel        int         `json:"leverage_level"`
	SourceExchange       string      `json:"source_exchange"`
	ProductID            int         `json:"product_id"`
	ProductCode          string      `json:"product_code"`
	FundingCurrency      string      `json:"funding_currency"`
	CryptoAccountID      interface{} `json:"crypto_account_id"`
	CurrencyPairCode     string      `json:"currency_pair_code"`
	AveragePrice         float64     `json:"average_price"`
	Target               string      `json:"target"`
	OrderFee             string      `json:"order_fee"`
	SourceAction         string      `json:"source_action"`
	UnwoundTradeID       interface{} `json:"unwound_trade_id"`
	TradeID              interface{} `json:"trade_id"`
}

type PairsData

type PairsData []struct {
	ID                  string      `json:"id"`
	ProductType         string      `json:"product_type"`
	Code                string      `json:"code"`
	Name                string      `json:"name"`
	MarketAsk           float64     `json:"market_ask"`
	MarketBid           float64     `json:"market_bid"`
	Indicator           int         `json:"indicator"`
	Currency            string      `json:"currency"`
	CurrencyPairCode    string      `json:"currency_pair_code"`
	Symbol              string      `json:"symbol"`
	BtcMinimumWithdraw  interface{} `json:"btc_minimum_withdraw"`
	FiatMinimumWithdraw interface{} `json:"fiat_minimum_withdraw"`
	PusherChannel       string      `json:"pusher_channel"`
	TakerFee            string      `json:"taker_fee"`
	MakerFee            string      `json:"maker_fee"`
	LowMarketBid        string      `json:"low_market_bid"`
	HighMarketAsk       string      `json:"high_market_ask"`
	Volume24H           string      `json:"volume_24h"`
	LastPrice24H        interface{} `json:"last_price_24h"`
	LastTradedPrice     interface{} `json:"last_traded_price"`
	LastTradedQuantity  interface{} `json:"last_traded_quantity"`
	QuotedCurrency      string      `json:"quoted_currency"`
	BaseCurrency        string      `json:"base_currency"`
	Disabled            bool        `json:"disabled"`
	MarginEnabled       bool        `json:"margin_enabled"`
	CfdEnabled          bool        `json:"cfd_enabled"`
	LastEventTimestamp  interface{} `json:"last_event_timestamp"`
}

type PlaceOrder

type PlaceOrder struct {
	ID                   int         `json:"id"`
	OrderType            string      `json:"order_type"`
	Quantity             string      `json:"quantity"`
	DiscQuantity         string      `json:"disc_quantity"`
	IcebergTotalQuantity string      `json:"iceberg_total_quantity"`
	Side                 string      `json:"side"`
	FilledQuantity       string      `json:"filled_quantity"`
	Price                float64     `json:"price"`
	CreatedAt            int         `json:"created_at"`
	UpdatedAt            int         `json:"updated_at"`
	Status               string      `json:"status"`
	LeverageLevel        int         `json:"leverage_level"`
	SourceExchange       string      `json:"source_exchange"`
	ProductID            int         `json:"product_id"`
	ProductCode          string      `json:"product_code"`
	FundingCurrency      string      `json:"funding_currency"`
	CryptoAccountID      interface{} `json:"crypto_account_id"`
	CurrencyPairCode     string      `json:"currency_pair_code"`
	AveragePrice         float64     `json:"average_price"`
	Target               string      `json:"target"`
	OrderFee             float64     `json:"order_fee"`
	SourceAction         string      `json:"source_action"`
	UnwoundTradeID       interface{} `json:"unwound_trade_id"`
	TradeID              interface{} `json:"trade_id"`
}

type TradeHistory

type TradeHistory struct {
	CurrentPage int `json:"current_page"`
	TotalPages  int `json:"total_pages"`
	Models      []struct {
		ID        int     `json:"id"`
		Quantity  float64 `json:"quantity"`
		Price     float64 `json:"price"`
		TakerSide string  `json:"taker_side"`
		CreatedAt int64   `json:"created_at"`
	} `json:"models"`
}

type Withdraw

type Withdraw struct {
	ID            int         `json:"id"`
	Address       string      `json:"address"`
	Amount        string      `json:"amount"`
	State         string      `json:"state"`
	Currency      string      `json:"currency"`
	WithdrawalFee string      `json:"withdrawal_fee"`
	CreatedAt     int         `json:"created_at"`
	UpdatedAt     int         `json:"updated_at"`
	PaymentID     interface{} `json:"payment_id"`
}

Jump to

Keyboard shortcuts

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