coinbene

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           = 32
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://openapi-exchange.coinbene.com" //"http://api.coinbene.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	Asset         string `json:"asset"`
	Available     string `json:"available"`
	RrozenBalance string `json:"rrozenBalance"`
	TotalBalance  string `json:"totalBalance"`
}

type Coinbene

type Coinbene 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 CreateCoinbene

func CreateCoinbene(config *exchange.Config) *Coinbene

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

func (*Coinbene) ApiKeyGET

func (e *Coinbene) ApiKeyGET(strRequestPath string, mapParams map[string]string) string

func (*Coinbene) ApiKeyPost

func (e *Coinbene) ApiKeyPost(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 (*Coinbene) ApiKeyWithdraw

func (e *Coinbene) ApiKeyWithdraw(strRequestPath string, mapParams map[string]string) string

func (*Coinbene) CanDeposit

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

func (*Coinbene) CanWithdraw

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

func (*Coinbene) CancelAllOrder

func (e *Coinbene) CancelAllOrder() error

func (*Coinbene) CancelOrder

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

func (*Coinbene) DeleteCoin

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

func (*Coinbene) DeletePair

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

func (*Coinbene) DoAccountOperation

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

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

func (*Coinbene) GetBalance

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

func (*Coinbene) GetCoinBySymbol

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

func (*Coinbene) GetCoinConstraint

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

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

func (*Coinbene) GetCoins

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

func (*Coinbene) GetCoinsData

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

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

func (*Coinbene) GetConstraintFetchMethod

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

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

func (*Coinbene) GetFee

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

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

func (*Coinbene) GetID

func (e *Coinbene) GetID() int

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

func (*Coinbene) GetLotSize

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

func (*Coinbene) GetName

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

func (*Coinbene) GetPairBySymbol

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

func (*Coinbene) GetPairConstraint

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

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

func (*Coinbene) GetPairs

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

func (*Coinbene) GetPairsData

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

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

func (*Coinbene) GetSymbolByCoin

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

func (*Coinbene) GetSymbolByPair

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

func (*Coinbene) GetTradingWebURL

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

func (*Coinbene) GetTxFee

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

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

func (*Coinbene) HasPair

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

func (*Coinbene) InitData

func (e *Coinbene) InitData() error

func (*Coinbene) LimitBuy

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

func (*Coinbene) LimitSell

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

func (*Coinbene) ListOrders

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

func (*Coinbene) LoadPublicData

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

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

func (*Coinbene) OrderBook

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

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

func (*Coinbene) SetCoinConstraint

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

func (*Coinbene) SetPairConstraint

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

func (*Coinbene) UpdateAllBalances

func (e *Coinbene) UpdateAllBalances()

func (*Coinbene) UpdateConstraint

func (e *Coinbene) UpdateConstraint()

func (*Coinbene) Withdraw

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

type JsonResponse

type JsonResponse struct {
	Code    int             `json:"code"`
	Message interface{}     `json:"message"`
	Data    json.RawMessage `json:"data"`
}

type OrderBook

type OrderBook struct {
	Asks      [][]string `json:"asks"`
	Bids      [][]string `json:"bids"`
	Timestamp time.Time  `json:"timestamp"`
}

type OrderStatus

type OrderStatus struct {
	OrderID        string    `json:"orderId"`
	BaseAsset      string    `json:"baseAsset"`
	QuoteAsset     string    `json:"quoteAsset"`
	OrderDirection string    `json:"orderDirection"`
	Quantity       string    `json:"quantity"`
	Amount         string    `json:"amount"`
	FilledAmount   string    `json:"filledAmount"`
	AvgPrice       string    `json:"avgPrice"`
	OrderPrice     string    `json:"orderPrice"`
	TakerFeeRate   string    `json:"takerFeeRate"`
	MakerFeeRate   string    `json:"makerFeeRate"`
	OrderStatus    string    `json:"orderStatus"`
	OrderTime      time.Time `json:"orderTime"`
	TotalFee       string    `json:"totalFee"`
}

type PairsData

type PairsData []struct {
	Symbol           string `json:"symbol"`
	BaseAsset        string `json:"baseAsset"`
	QuoteAsset       string `json:"quoteAsset"`
	PricePrecision   string `json:"pricePrecision"`
	AmountPrecision  string `json:"amountPrecision"`
	TakerFeeRate     string `json:"takerFeeRate"`
	MakerFeeRate     string `json:"makerFeeRate"`
	MinAmount        string `json:"minAmount"`
	PriceFluctuation string `json:"priceFluctuation"`
	Site             string `json:"site"`
}

type PlaceOrder

type PlaceOrder struct {
	OrderID  string `json:"orderId"`
	ClientID string `json:"clientId"`
}

type Trade

type Trade struct {
	Symbol    string    `json:"symbol"`
	Price     string    `json:"price"`
	Volume    string    `json:"volume"`
	Direction string    `json:"direction"`
	TradeTime time.Time `json:"tradeTime"`
}

type TradeHistory

type TradeHistory [][]Trade

type Withdraw

type Withdraw struct {
	Code int `json:"Code"`
	Data struct {
		ID      string `json:"Id"`
		Amount  string `json:"Amount"`
		Asset   string `json:"Asset"`
		Address string `json:"Address"`
		Tag     string `json:"Tag"`
		Chain   string `json:"Chain"`
	} `json:"Data"`
}

Jump to

Keyboard shortcuts

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