coinbase

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           = 70
	DEFAULT_TAKER_FEE    = 0.001
	DEFAULT_MAKER_FEE    = 0.001
	DEFAULT_LOT_SIZE     = 0.00000001
	DEFAULT_PRICE_FILTER = 0.00000001 //PRICE FILTER
	DEFAULT_TXFEE        = 0.005
	DEFAULT_WITHDRAW     = true
	DEFAULT_DEPOSIT      = true
	DEFAULT_CONFIRMATION = 2
	DEFAULT_LISTED       = true
)
View Source
const (
	API_URL = "https://api.pro.coinbase.com"
)

The Base Endpoint URL

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalances

type AccountBalances []struct {
	ID        string `json:"id"`
	Currency  string `json:"currency"`
	Balance   string `json:"balance"`
	Available string `json:"available"`
	Hold      string `json:"hold"`
	ProfileID string `json:"profile_id"`
}

type Coinbase

type Coinbase struct {
	ID      int
	Name    string `bson:"name"`
	Website string `bson:"website"`

	API_KEY    string
	API_SECRET string
	Passphrase string

	Source    exchange.DataSource // / exchange API / microservicve api 1 / PSQL
	SourceURI string
}

func CreateCoinbase

func CreateCoinbase(config *exchange.Config) *Coinbase

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

func (*Coinbase) ApiKeyRequest

func (e *Coinbase) ApiKeyRequest(strMethod string, mapParams map[string]interface{}, strRequestPath 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 (*Coinbase) CanDeposit

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

func (*Coinbase) CanWithdraw

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

func (*Coinbase) CancelAllOrder

func (e *Coinbase) CancelAllOrder() error

func (*Coinbase) CancelOrder

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

func (*Coinbase) DeleteCoin

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

func (*Coinbase) DeletePair

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

func (*Coinbase) DoAccountOperation

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

func (*Coinbase) GetBalance

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

func (*Coinbase) GetCoinBySymbol

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

func (*Coinbase) GetCoinConstraint

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

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

func (*Coinbase) GetCoins

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

func (*Coinbase) GetCoinsData

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

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

func (*Coinbase) GetConstraintFetchMethod

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

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

func (*Coinbase) GetFee

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

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

func (*Coinbase) GetID

func (e *Coinbase) GetID() int

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

func (*Coinbase) GetLotSize

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

func (*Coinbase) GetName

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

func (*Coinbase) GetPairBySymbol

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

func (*Coinbase) GetPairConstraint

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

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

func (*Coinbase) GetPairs

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

func (*Coinbase) GetPairsData

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

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

func (*Coinbase) GetSymbolByCoin

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

func (*Coinbase) GetSymbolByPair

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

func (*Coinbase) GetTradingWebURL

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

func (*Coinbase) GetTxFee

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

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

func (*Coinbase) HasPair

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

func (*Coinbase) InitData

func (e *Coinbase) InitData() error

func (*Coinbase) LimitBuy

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

func (*Coinbase) LimitSell

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

func (*Coinbase) ListOrders

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

func (*Coinbase) LoadPublicData

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

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

func (*Coinbase) OrderBook

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

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

func (*Coinbase) SetCoinConstraint

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

func (*Coinbase) SetPairConstraint

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

func (*Coinbase) UpdateAllBalances

func (e *Coinbase) UpdateAllBalances()

func (*Coinbase) UpdateConstraint

func (e *Coinbase) UpdateConstraint()

func (*Coinbase) Withdraw

func (e *Coinbase) 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      string `json:"id"`
	Name    string `json:"name"`
	MinSize string `json:"min_size"`
	Status  string `json:"status"`
	Message string `json:"message"`
	Details struct {
		Type                  string   `json:"type"`
		Symbol                string   `json:"symbol"`
		NetworkConfirmations  int      `json:"network_confirmations"`
		SortOrder             int      `json:"sort_order"`
		CryptoAddressLink     string   `json:"crypto_address_link"`
		CryptoTransactionLink string   `json:"crypto_transaction_link"`
		PushPaymentMethods    []string `json:"push_payment_methods"`
		ProcessingTimeSeconds int      `json:"processing_time_seconds"`
		MinWithdrawalAmount   float64  `json:"min_withdrawal_amount"`
	} `json:"details"`
	MaxPrecision  string   `json:"max_precision"`
	ConvertibleTo []string `json:"convertible_to,omitempty"`
}

type OrderBook

type OrderBook struct {
	Sequence int64      `json:"sequence"`
	Bids     [][]string `json:"bids"`
	Asks     [][]string `json:"asks"`
}

type PairsData

type PairsData []struct {
	ID             string `json:"id"`
	BaseCurrency   string `json:"base_currency"`
	QuoteCurrency  string `json:"quote_currency"`
	BaseMinSize    string `json:"base_min_size"`
	BaseMaxSize    string `json:"base_max_size"`
	QuoteIncrement string `json:"quote_increment"`
	BaseIncrement  string `json:"base_increment"`
	DisplayName    string `json:"display_name"`
	MinMarketFunds string `json:"min_market_funds"`
	MaxMarketFunds string `json:"max_market_funds"`
	MarginEnabled  bool   `json:"margin_enabled"`
	PostOnly       bool   `json:"post_only"`
	LimitOnly      bool   `json:"limit_only"`
	CancelOnly     bool   `json:"cancel_only"`
	Status         string `json:"status"`
	StatusMessage  string `json:"status_message"`
}

type PlaceOrder

type PlaceOrder struct {
	ID             string    `json:"id"`
	Price          string    `json:"price"`
	Size           string    `json:"size"`
	ProductID      string    `json:"product_id"`
	Side           string    `json:"side"`
	Stp            string    `json:"stp"`
	Funds          string    `json:"funds"`
	SpecifiedFunds string    `json:"specified_funds"`
	Type           string    `json:"type"`
	TimeInForce    string    `json:"time_in_force"`
	PostOnly       bool      `json:"post_only"`
	CreatedAt      time.Time `json:"created_at"`
	DoneAt         time.Time `json:"done_at"`
	DoneReason     string    `json:"done_reason"`
	FillFees       string    `json:"fill_fees"`
	FilledSize     string    `json:"filled_size"`
	ExecutedValue  string    `json:"executed_value"`
	Status         string    `json:"status"`
	Settled        bool      `json:"settled"`
	Message        string    `json:"message"`
}

type TradeHistory

type TradeHistory []struct {
	Time    time.Time `json:"time"`
	TradeID int       `json:"trade_id"`
	Price   string    `json:"price"`
	Size    string    `json:"size"`
	Side    string    `json:"side"`
}

type WithdrawResponse

type WithdrawResponse struct {
	ID       string    `json:"id"`
	Amount   string    `json:"amount"`
	Currency string    `json:"currency"`
	PayoutAt time.Time `json:"payout_at"`
}

Jump to

Keyboard shortcuts

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