bitbay

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

Documentation

Index

Constants

View Source
const (
	DEFAULT_ID           = 41
	DEFAULT_TAKER_FEE    = 0.0043
	DEFAULT_MAKER_FEE    = 0.003
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL string = "https://api.bitbay.net/rest"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances struct {
	Status   string `json:"status"`
	Balances []struct {
		ID             string  `json:"id"`
		UserID         string  `json:"userId"`
		AvailableFunds float64 `json:"availableFunds"`
		TotalFunds     float64 `json:"totalFunds"`
		LockedFunds    int     `json:"lockedFunds"`
		Currency       string  `json:"currency"`
		Type           string  `json:"type"`
		Name           string  `json:"name"`
		BalanceEngine  string  `json:"balanceEngine"`
	} `json:"balances"`
	Errors interface{} `json:"errors"`
}

type Bitbay

type Bitbay 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 CreateBitbay

func CreateBitbay(config *exchange.Config) *Bitbay

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

func (*Bitbay) ApiKeyGET

func (e *Bitbay) ApiKeyGET(strRequestPath string, mapParams map[string]interface{}) 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 ------------------ TODO

func (*Bitbay) CanDeposit

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

func (*Bitbay) CanWithdraw

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

func (*Bitbay) CancelAllOrder

func (e *Bitbay) CancelAllOrder() error

func (*Bitbay) CancelOrder

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

func (*Bitbay) DeleteCoin

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

func (*Bitbay) DeletePair

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

func (*Bitbay) DoAccountOperation

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

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

func (*Bitbay) GetBalance

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

func (*Bitbay) GetCoinBySymbol

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

func (*Bitbay) GetCoinConstraint

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

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

func (*Bitbay) GetCoins

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

func (*Bitbay) GetCoinsData

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

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

func (*Bitbay) GetConstraintFetchMethod

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

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

func (*Bitbay) GetFee

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

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

func (*Bitbay) GetID

func (e *Bitbay) GetID() int

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

func (*Bitbay) GetLotSize

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

func (*Bitbay) GetName

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

func (*Bitbay) GetPairBySymbol

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

func (*Bitbay) GetPairConstraint

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

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

func (*Bitbay) GetPairs

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

func (*Bitbay) GetPairsData

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

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

func (*Bitbay) GetSymbolByCoin

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

func (*Bitbay) GetSymbolByPair

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

func (*Bitbay) GetTradingWebURL

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

func (*Bitbay) GetTxFee

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

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

func (*Bitbay) HasPair

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

func (*Bitbay) InitData

func (e *Bitbay) InitData() error

func (*Bitbay) LimitBuy

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

func (*Bitbay) LimitSell

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

func (*Bitbay) ListOrders

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

func (*Bitbay) LoadPublicData

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

func (*Bitbay) OrderBook

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

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

func (*Bitbay) SetCoinConstraint

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

func (*Bitbay) SetPairConstraint

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

func (*Bitbay) UpdateAllBalances

func (e *Bitbay) UpdateAllBalances()

func (*Bitbay) UpdateConstraint

func (e *Bitbay) UpdateConstraint()

func (*Bitbay) Withdraw

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

type CancelOrder

type CancelOrder struct {
	Status string        `json:"status"`
	Errors []interface{} `json:"errors"`
}

type JsonResponse

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

type OrderBook

type OrderBook struct {
	Status string `json:"status"`
	Sell   []struct {
		Ra string `json:"ra"`
		Ca string `json:"ca"`
		Sa string `json:"sa"`
		Pa string `json:"pa"`
		Co int    `json:"co"`
	} `json:"sell"`
	Buy []struct {
		Ra string `json:"ra"`
		Ca string `json:"ca"`
		Sa string `json:"sa"`
		Pa string `json:"pa"`
		Co int    `json:"co"`
	} `json:"buy"`
	Timestamp string `json:"timestamp"`
}

type OrderStatus

type OrderStatus struct {
	Status string `json:"status"`
	Items  []struct {
		Market          string `json:"market"`
		OfferType       string `json:"offerType"`
		ID              string `json:"id"`
		CurrentAmount   string `json:"currentAmount"`
		LockedAmount    string `json:"lockedAmount"`
		Rate            string `json:"rate"`
		StartAmount     string `json:"startAmount"`
		Time            string `json:"time"`
		PostOnly        bool   `json:"postOnly"`
		Mode            string `json:"mode"`
		ReceivedAmount  string `json:"receivedAmount"`
		FirstBalanceID  string `json:"firstBalanceId"`
		SecondBalanceID string `json:"secondBalanceId"`
	} `json:"items"`
}

type PairInfo

type PairInfo struct {
	Market struct {
		Code  string `json:"code"`
		First struct {
			Currency string `json:"currency"`
			MinOffer string `json:"minOffer"`
			Scale    int    `json:"scale"`
		} `json:"first"`
		Second struct {
			Currency string `json:"currency"`
			MinOffer string `json:"minOffer"`
			Scale    int    `json:"scale"`
		} `json:"second"`
	} `json:"market"`
	Time         string `json:"time"`
	HighestBid   string `json:"highestBid"`
	LowestAsk    string `json:"lowestAsk"`
	Rate         string `json:"rate"`
	PreviousRate string `json:"previousRate"`
}

type PairsData

type PairsData struct {
	Status string               `json:"status"`
	Pairs  map[string]*PairInfo `json:"items"`
}

type PlaceOrder

type PlaceOrder struct {
	Status       string `json:"status"`
	Completed    bool   `json:"completed"`
	OfferID      string `json:"offerId"`
	Transactions []struct {
		Amount string `json:"amount"`
		Rate   string `json:"rate"`
	} `json:"transactions"`
}

Jump to

Keyboard shortcuts

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