bexs

package module
v1.6.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: MIT Imports: 13 Imported by: 0

README

BEXS GoDoc

Go client for Bexs

Installation

go get github.com/diogoagra/bexs

Usage

package main

import (
	"fmt"

	"github.com/diogoagra/bexs"
)

func main() {
	client := bexs.New("bleutrade", "api-key", "api-secret", true)
	balances, err := client.GetBalances()

	if err != nil {
		return
	}

	fmt.Println(balances)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bexs

type Bexs struct {
	Exchange  string
	APIKey    string
	APISecret string
	Debug     bool
	Lock      *sync.RWMutex
}

Bexs -

func New

func New(exchange, apikey, apisecret string, debug bool) *Bexs

New - Exchanges avaliable (bleutrade, exccripto, bitrecife, bomesp, bomespg, bullgain)

func (*Bexs) BuyAmi

func (c *Bexs) BuyAmi(market string, rate, quantity, amirate float64) (result string, err error)

BuyAmi - Send ami buy order, must have amirate > rate

func (*Bexs) BuyLimit

func (c *Bexs) BuyLimit(market string, rate, quantity float64) (result string, err error)

BuyLimit - Send a buy limit order

func (*Bexs) BuyMarket

func (c *Bexs) BuyMarket(market string, quantity float64, comments string) (result string, err error)

BuyMarket - Send a buy market order

func (*Bexs) CancelOrder

func (c *Bexs) CancelOrder(orderID string) (result string, err error)

CancelOrder -

func (*Bexs) CancelOrders

func (c *Bexs) CancelOrders(ordersID []int) (result interface{}, err error)

CancelOrders -

func (*Bexs) Config

func (c *Bexs) Config() (result ConfigStruct, err error)

Config -

func (*Bexs) DirectTransfer

func (c *Bexs) DirectTransfer(asset, to string, quantity float64, exchange int, comments string) (result bool, err error)

DirectTransfer -

func (*Bexs) GetAssets

func (c *Bexs) GetAssets() (result []GetAssetsStruct, err error)

GetAssets -

func (*Bexs) GetBalance

func (c *Bexs) GetBalance(asset string) (result GetBalanceStruct, err error)

GetBalance -

func (*Bexs) GetBalances

func (c *Bexs) GetBalances() (result []GetBalanceStruct, err error)

GetBalances -

func (*Bexs) GetCandles

func (c *Bexs) GetCandles(market, period string) (result []GetCandlesStruct, err error)

GetCandles -

func (*Bexs) GetDepositAddress

func (c *Bexs) GetDepositAddress(asset string) (result GetDepositAddressStruct, err error)

GetDepositAddress -

func (*Bexs) GetDepositHistory

func (c *Bexs) GetDepositHistory() (result []GetHistoryStruct, err error)

GetDepositHistory -

func (*Bexs) GetMarketHistory

func (c *Bexs) GetMarketHistory(market string, count int) (result []GetMarketHistoryStruct, err error)

GetMarketHistory -

func (*Bexs) GetMarketSummary

func (c *Bexs) GetMarketSummary(market string) (result GetMarketSummarieStruct, err error)

GetMarketSummary -

func (*Bexs) GetMarkets

func (c *Bexs) GetMarkets() (result []GetMarketsStruct, err error)

GetMarkets -

func (*Bexs) GetOpenOrders

func (c *Bexs) GetOpenOrders(market string) (result []GetOrdersStruct, err error)

GetOpenOrders -

func (*Bexs) GetOrderBook

func (c *Bexs) GetOrderBook(market, kind string, depth int) (result OrderBookStruct, err error)

GetOrderBook -

func (*Bexs) GetTicker

func (c *Bexs) GetTicker(market string) (result []GetTickerStruct, err error)

GetTicker -

func (*Bexs) GetWithdrawHistory

func (c *Bexs) GetWithdrawHistory() (result []GetHistoryStruct, err error)

GetWithdrawHistory -

func (*Bexs) OrderDetails added in v1.6.0

func (c *Bexs) OrderDetails(orderID string) (result []OrderDetails, err error)

OrderDetails -

func (*Bexs) OrderStatus

func (c *Bexs) OrderStatus(orderID string) (result GetOrdersStruct, err error)

OrderStatus -

func (*Bexs) SellAmi

func (c *Bexs) SellAmi(market string, rate, quantity, amirate float64) (result string, err error)

SellAmi - Send ami sell order, must have rate > amirate

func (*Bexs) SellLimit

func (c *Bexs) SellLimit(market string, rate, quantity float64) (result string, err error)

SellLimit - Send a sell limit order

func (*Bexs) SellMarket

func (c *Bexs) SellMarket(market string, quantity float64, comments string) (result string, err error)

SellMarket - Send a sell market order

func (*Bexs) Transactions added in v1.5.0

func (c *Bexs) Transactions() (result []TransactionStructs, err error)

Transactions -

func (*Bexs) Withdraw

func (c *Bexs) Withdraw(asset, address string, quantity float64, comments string) (result bool, err error)

Withdraw -

type Book

type Book struct {
	Quantity decimal.Decimal `json:"Quantity"`
	Rate     decimal.Decimal `json:"Rate"`
}

Book -

type ConfigStruct

type ConfigStruct struct {
	PercentDiscountOnTrade    int             `json:"PercentDiscountOnTrade"`
	PercentDiscountOnWithdraw int             `json:"PercentDiscountOnWithdraw"`
	EffectiveMakerFee         decimal.Decimal `json:"EffectiveMakerFee"`
	EffectiveTakerFee         decimal.Decimal `json:"EffectiveTakerFee"`
}

ConfigStruct -

type DefaultReturn

type DefaultReturn struct {
	Success bool        `json:"success"`
	Message string      `json:"message"`
	Result  interface{} `json:"result"`
}

DefaultReturn -

type GetAssetsStruct

type GetAssetsStruct struct {
	Asset                string          `json:"Asset"`
	AssetLong            string          `json:"AssetLong"`
	MinConfirmation      int             `json:"MinConfirmation"`
	WithdrawTxFee        decimal.Decimal `json:"WithdrawTxFee"`
	WithdrawTxFeePercent decimal.Decimal `json:"WithdrawTxFeePercent"`
	SystemProtocol       string          `json:"SystemProtocol"`
	IsActive             bool            `json:"IsActive"`
	InfoMessage          string          `json:"InfoMessage"`
	MaintenanceMode      bool            `json:"MaintenanceMode"`
	MaintenanceMessage   string          `json:"MaintenanceMessage"`
	FormatPrefix         string          `json:"FormatPrefix"`
	FormatSufix          string          `json:"FormatSufix"`
	DecimalSeparator     string          `json:"DecimalSeparator"`
	ThousandSeparator    string          `json:"ThousandSeparator"`
	DecimalPlaces        int             `json:"DecimalPlaces"`
	Currency             string          `json:"Currency"`
	CurrencyLong         string          `json:"CurrencyLong"`
	CoinType             string          `json:"CoinType"`
}

GetAssetsStruct -

type GetBalanceStruct

type GetBalanceStruct struct {
	Asset          string          `json:"Asset"`
	AssetName      string          `json:"AssetName"`
	Balance        decimal.Decimal `json:"Balance"`
	Available      decimal.Decimal `json:"Available"`
	Pending        decimal.Decimal `json:"Pending"`
	IsActive       bool            `json:"IsActive"`
	AllowDeposit   bool            `json:"AllowDeposit"`
	AllowWithdraw  bool            `json:"AllowWithdraw"`
	DepositAddress string          `json:"DepositAddress"`
	InfoMessage    string          `json:"InfoMessage"`
	BtcEquivalent  decimal.Decimal `json:"BtcEquivalent"`
	Currency       string          `json:"Currency"`
	CurrencyName   string          `json:"CurrencyName"`
	CryptoAddress  string          `json:"CryptoAddress"`
}

GetBalanceStruct -

type GetCandlesStruct

type GetCandlesStruct struct {
	TimeStamp  string          `json:"TimeStamp"`
	Open       decimal.Decimal `json:"Open"`
	High       decimal.Decimal `json:"High"`
	Low        decimal.Decimal `json:"Low"`
	Close      decimal.Decimal `json:"Close"`
	Volume     decimal.Decimal `json:"Volume"`
	BaseVolume decimal.Decimal `json:"BaseVolume"`
}

GetCandlesStruct -

type GetDepositAddressStruct

type GetDepositAddressStruct struct {
	Asset          string `json:"Asset"`
	AssetName      string `json:"AssetName"`
	DepositAddress string `json:"DepositAddress"`
	Currency       string `json:"Currency"`
	CurrencyName   string `json:"CurrencyName"`
}

GetDepositAddressStruct -

type GetHistoryStruct

type GetHistoryStruct struct {
	ID            int             `json:"ID"`
	Timestamp     string          `json:"Timestamp"`
	Asset         string          `json:"Asset"`
	Amount        decimal.Decimal `json:"Amount"`
	TransactionID string          `json:"TransactionID"`
	Status        string          `json:"Status"`
	Label         string          `json:"Label"`
	Symbol        string          `json:"Symbol"`
}

GetHistoryStruct -

type GetMarketHistoryStruct

type GetMarketHistoryStruct struct {
	TradeID    string          `json:"TradeID"`
	TimeStamp  string          `json:"TimeStamp"`
	OrderType  string          `json:"OrderType"`
	Price      decimal.Decimal `json:"Price"`
	Quantity   decimal.Decimal `json:"Quantity"`
	BaseVolume decimal.Decimal `json:"BaseVolume"`
	Total      decimal.Decimal `json:"Total"`
}

GetMarketHistoryStruct -

type GetMarketSummarieStruct

type GetMarketSummarieStruct struct {
	TimeStamp       string          `json:"TimeStamp"`
	MarketName      string          `json:"MarketName"`
	MarketAsset     string          `json:"MarketAsset"`
	BaseAsset       string          `json:"BaseAsset"`
	MarketAssetName string          `json:"MarketAssetName"`
	BaseAssetName   string          `json:"BaseAssetName"`
	PrevDay         decimal.Decimal `json:"PrevDay"`
	High            decimal.Decimal `json:"High"`
	Low             decimal.Decimal `json:"Low"`
	Last            decimal.Decimal `json:"Last"`
	Average         decimal.Decimal `json:"Average"`
	Volume          decimal.Decimal `json:"Volume"`
	BaseVolume      decimal.Decimal `json:"BaseVolume"`
	Bid             decimal.Decimal `json:"Bid"`
	Ask             decimal.Decimal `json:"Ask"`
	IsActive        bool            `json:"IsActive"`
	InfoMessage     string          `json:"InfoMessage"`
	MarketCurrency  string          `json:"MarketCurrency"`
	BaseCurrency    string          `json:"BaseCurrency"`
}

GetMarketSummarieStruct -

type GetMarketsStruct

type GetMarketsStruct struct {
	MarketName         string          `json:"MarketName"`
	MarketAsset        string          `json:"MarketAsset"`
	BaseAsset          string          `json:"BaseAsset"`
	MarketAssetLong    string          `json:"MarketAssetLong"`
	BaseAssetLong      string          `json:"BaseAssetLong"`
	IsActive           bool            `json:"IsActive"`
	MinTradeSize       decimal.Decimal `json:"MinTradeSize"`
	InfoMessage        string          `json:"InfoMessage"`
	MarketCurrency     string          `json:"MarketCurrency"`
	BaseCurrency       string          `json:"BaseCurrency"`
	MarketCurrencyLong string          `json:"MarketCurrencyLong"`
	BaseCurrencyLong   string          `json:"BaseCurrencyLong"`
}

GetMarketsStruct -

type GetOrdersStruct

type GetOrdersStruct struct {
	OrderID            int             `json:"OrderID"`
	Exchange           string          `json:"Exchange"`
	Type               string          `json:"Type"`
	Quantity           decimal.Decimal `json:"Quantity"`
	QuantityRemaining  decimal.Decimal `json:"QuantityRemaining"`
	QuantityBaseTraded decimal.Decimal `json:"QuantityBaseTraded"`
	Price              decimal.Decimal `json:"Price"`
	Status             string          `json:"Status"`
	Created            string          `json:"Created"`
	Comments           interface{}     `json:"Comments"`
}

GetOrdersStruct -

type GetTickerStruct

type GetTickerStruct struct {
	Market string          `json:"Market"`
	Bid    decimal.Decimal `json:"Bid"`
	Ask    decimal.Decimal `json:"Ask"`
	Last   decimal.Decimal `json:"Last"`
}

GetTickerStruct -

type OrderBookStruct

type OrderBookStruct struct {
	Buy  []Book `json:"buy"`
	Sell []Book `json:"sell"`
}

OrderBookStruct -

type OrderDetails added in v1.6.0

type OrderDetails struct {
	Quantity  decimal.Decimal `json:"quantity"`
	Price     decimal.Decimal `json:"price"`
	CreatedAt time.Time       `json:"createdAt"`
}

OrderDetails -

type TransactionStructs added in v1.5.0

type TransactionStructs struct {
	ID          int             `json:"ID"`
	TimeStamp   string          `json:"TimeStamp"`
	Asset       string          `json:"Asset"`
	AssetName   string          `json:"AssetName"`
	Amount      decimal.Decimal `json:"Amount"`
	Type        string          `json:"Type"`
	Description string          `json:"Description"`
	Comments    string          `json:"Comments"`
	CoinSymbol  string          `json:"CoinSymbol"`
	CoinName    string          `json:"CoinName"`
}

TransactionStructs -

Jump to

Keyboard shortcuts

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