coindeal

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           = 59
	DEFAULT_TAKER_FEE    = 0.002
	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 = "https://apigateway.coindeal.com"
)

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 Coindeal

type Coindeal 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 CreateCoindeal

func CreateCoindeal(config *exchange.Config) *Coindeal

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

func (*Coindeal) ApiKeyGet

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

func (e *Coindeal) 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 (*Coindeal) CanDeposit

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

func (*Coindeal) CanWithdraw

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

func (*Coindeal) CancelAllOrder

func (e *Coindeal) CancelAllOrder() error

func (*Coindeal) CancelOrder

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

func (*Coindeal) DeleteCoin

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

func (*Coindeal) DeletePair

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

func (*Coindeal) DoAccountOperation

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

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

func (*Coindeal) GetBalance

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

func (*Coindeal) GetCoinBySymbol

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

func (*Coindeal) GetCoinConstraint

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

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

func (*Coindeal) GetCoins

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

func (*Coindeal) GetCoinsData

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

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

func (*Coindeal) GetConstraintFetchMethod

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

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

func (*Coindeal) GetFee

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

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

func (*Coindeal) GetID

func (e *Coindeal) GetID() int

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

func (*Coindeal) GetLotSize

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

func (*Coindeal) GetName

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

func (*Coindeal) GetPairBySymbol

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

func (*Coindeal) GetPairConstraint

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

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

func (*Coindeal) GetPairs

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

func (*Coindeal) GetPairsData

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

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

func (*Coindeal) GetSymbolByCoin

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

func (*Coindeal) GetSymbolByPair

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

func (*Coindeal) GetTradingWebURL

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

func (*Coindeal) GetTxFee

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

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

func (*Coindeal) HasPair

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

func (*Coindeal) InitData

func (e *Coindeal) InitData() error

func (*Coindeal) LimitBuy

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

func (*Coindeal) LimitSell

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

func (*Coindeal) ListOrders

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

func (*Coindeal) LoadPublicData

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

func (*Coindeal) OrderBook

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

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

func (*Coindeal) SetCoinConstraint

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

func (*Coindeal) SetPairConstraint

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

func (*Coindeal) UpdateAllBalances

func (e *Coindeal) UpdateAllBalances()

func (*Coindeal) UpdateConstraint

func (e *Coindeal) UpdateConstraint()

func (*Coindeal) Withdraw

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

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

type CoinsData

type CoinsData map[string]Tick

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Asks []OrderInfo `json:"ask"`
	Bids []OrderInfo `json:"bid"`
}

type OrderInfo

type OrderInfo struct {
	Price  string `json:"price"`
	Amount string `json:"amount"`
}

type PairsData

type PairsData map[string]Tick

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 Tick

type Tick struct {
	ID            int    `json:"id"`
	Last          string `json:"last"`
	LowestAsk     string `json:"lowestAsk"`
	HighestBid    string `json:"highestBid"`
	PercentChange string `json:"percentChange"`
	BaseVolume    string `json:"baseVolume"`
	QuoteVolume   string `json:"quoteVolume"`
	IsFrozen      string `json:"isFrozen"`
	High24hr      string `json:"high24hr"`
	Low24hr       string `json:"low24hr"`
	CurrencyName  string `json:"currencyName"`
	WalletStatus  string `json:"walletStatus"`
}

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

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