blocktrade

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: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 56
	DEFAULT_TAKER_FEE    = 0.0015
	DEFAULT_MAKER_FEE    = 0.0015
	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://trade.blocktrade.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 Blocktrade

type Blocktrade 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 CreateBlocktrade

func CreateBlocktrade(config *exchange.Config) *Blocktrade

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

func (*Blocktrade) ApiKeyGet

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

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

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

func (*Blocktrade) CanWithdraw

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

func (*Blocktrade) CancelAllOrder

func (e *Blocktrade) CancelAllOrder() error

func (*Blocktrade) CancelOrder

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

func (*Blocktrade) DeleteCoin

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

func (*Blocktrade) DeletePair

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

func (*Blocktrade) DoAccountOperation

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

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

func (*Blocktrade) GetBalance

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

func (*Blocktrade) GetCoinBySymbol

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

func (*Blocktrade) GetCoinConstraint

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

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

func (*Blocktrade) GetCoins

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

func (*Blocktrade) GetCoinsData

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

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

func (*Blocktrade) GetConstraintFetchMethod

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

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

func (*Blocktrade) GetFee

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

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

func (*Blocktrade) GetID

func (e *Blocktrade) GetID() int

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

func (*Blocktrade) GetLotSize

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

func (*Blocktrade) GetName

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

func (*Blocktrade) GetPairBySymbol

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

func (*Blocktrade) GetPairConstraint

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

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

func (*Blocktrade) GetPairs

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

func (*Blocktrade) GetPairsData

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

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

func (*Blocktrade) GetSymbolByCoin

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

func (*Blocktrade) GetSymbolByPair

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

func (*Blocktrade) GetTradingWebURL

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

func (*Blocktrade) GetTxFee

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

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

func (*Blocktrade) HasPair

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

func (*Blocktrade) InitData

func (e *Blocktrade) InitData() error

func (*Blocktrade) LimitBuy

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

func (*Blocktrade) LimitSell

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

func (*Blocktrade) ListOrders

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

func (*Blocktrade) LoadPublicData

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

func (*Blocktrade) OrderBook

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

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

func (*Blocktrade) SetCoinConstraint

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

func (*Blocktrade) SetPairConstraint

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

func (*Blocktrade) UpdateAllBalances

func (e *Blocktrade) UpdateAllBalances()

func (*Blocktrade) UpdateConstraint

func (e *Blocktrade) UpdateConstraint()

func (*Blocktrade) Withdraw

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

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

type CoinsData

type CoinsData []struct {
	ID                      int    `json:"id"`
	FullName                string `json:"full_name"`
	IsoCode                 string `json:"iso_code"`
	IconPath                string `json:"icon_path"`
	IconPathPng             string `json:"icon_path_png"`
	Color                   string `json:"color"`
	Sign                    string `json:"sign"`
	CurrencyType            string `json:"currency_type"`
	MinimalWithdrawalAmount string `json:"minimal_withdrawal_amount"`
	MinimalOrderValue       string `json:"minimal_order_value"`
	MaximumOrderValue       string `json:"maximum_order_value"`
	LotSize                 string `json:"lot_size"`
	DecimalPrecision        int    `json:"decimal_precision"`
}

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

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Amount string `json:"amount"`
	Price  string `json:"price"`
	Value  string `json:"value"`
}

type OrderBooks

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

type PairsData

type PairsData []struct {
	ID               int    `json:"id"`
	BaseAssetId      int    `json:"base_asset_id"`
	QuoteAssetId     int    `json:"quote_asset_id"`
	DecimalPrecision int    `json:"decimal_precision"`
	LotSize          string `json:"lot_size"`
	TickSize         string `json:"tick_size"`
	Active           bool   `json:"active"`
}

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 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