Documentation ¶
Index ¶
- Variables
- func GetRateLimit() request.RateLimitDefinitions
- type Account
- type AccountHolds
- type AccountLedgerResponse
- type AccountOverview
- type AccountResponse
- type CoinbaseAccounts
- type CoinbasePro
- func (c *CoinbasePro) CancelAllExistingOrders(ctx context.Context, currencyPair string) ([]string, error)
- func (c *CoinbasePro) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
- func (c *CoinbasePro) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)
- func (c *CoinbasePro) CancelExistingOrder(ctx context.Context, orderID string) error
- func (c *CoinbasePro) CancelOrder(ctx context.Context, o *order.Cancel) error
- func (c *CoinbasePro) ClosePosition(ctx context.Context, repayOnly bool) (AccountOverview, error)
- func (c *CoinbasePro) DepositViaCoinbase(ctx context.Context, amount float64, currency, accountID string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) DepositViaPaymentMethod(ctx context.Context, amount float64, currency, paymentID string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (c *CoinbasePro) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (c *CoinbasePro) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)
- func (c *CoinbasePro) FetchTradablePairs(ctx context.Context, _ asset.Item) (currency.Pairs, error)
- func (c *CoinbasePro) GetAccount(ctx context.Context, accountID string) (AccountResponse, error)
- func (c *CoinbasePro) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)
- func (c *CoinbasePro) GetAccountHistory(ctx context.Context, accountID string) ([]AccountLedgerResponse, error)
- func (c *CoinbasePro) GetAccounts(ctx context.Context) ([]AccountResponse, error)
- func (c *CoinbasePro) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
- func (c *CoinbasePro) GetCoinbaseAccounts(ctx context.Context) ([]CoinbaseAccounts, error)
- func (c *CoinbasePro) GetCurrencies(ctx context.Context) ([]Currency, error)
- func (c *CoinbasePro) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)
- func (c *CoinbasePro) GetCurrentServerTime(ctx context.Context) (ServerTime, error)
- func (c *CoinbasePro) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error)
- func (c *CoinbasePro) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (c *CoinbasePro) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
- func (c *CoinbasePro) GetFills(ctx context.Context, orderID, currencyPair string) ([]FillResponse, error)
- func (c *CoinbasePro) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)
- func (c *CoinbasePro) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, ...) (*kline.Item, error)
- func (c *CoinbasePro) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, ...) (*kline.Item, error)
- func (c *CoinbasePro) GetHistoricRates(ctx context.Context, currencyPair, start, end string, granularity int64) ([]History, error)
- func (c *CoinbasePro) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
- func (c *CoinbasePro) GetHolds(ctx context.Context, accountID string) ([]AccountHolds, error)
- func (c *CoinbasePro) GetLatestFundingRates(context.Context, *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)
- func (c *CoinbasePro) GetOrder(ctx context.Context, orderID string) (GeneralizedOrderResponse, error)
- func (c *CoinbasePro) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
- func (c *CoinbasePro) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (*order.Detail, error)
- func (c *CoinbasePro) GetOrderbook(ctx context.Context, symbol string, level int) (interface{}, error)
- func (c *CoinbasePro) GetOrders(ctx context.Context, status []string, currencyPair string) ([]GeneralizedOrderResponse, error)
- func (c *CoinbasePro) GetPayMethods(ctx context.Context) ([]PaymentMethod, error)
- func (c *CoinbasePro) GetPosition(ctx context.Context) (AccountOverview, error)
- func (c *CoinbasePro) GetProducts(ctx context.Context) ([]Product, error)
- func (c *CoinbasePro) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
- func (c *CoinbasePro) GetReport(ctx context.Context, ...) (Report, error)
- func (c *CoinbasePro) GetReportStatus(ctx context.Context, reportID string) (Report, error)
- func (c *CoinbasePro) GetServerTime(ctx context.Context, _ asset.Item) (time.Time, error)
- func (c *CoinbasePro) GetStats(ctx context.Context, currencyPair string) (Stats, error)
- func (c *CoinbasePro) GetTicker(ctx context.Context, currencyPair string) (Ticker, error)
- func (c *CoinbasePro) GetTrades(ctx context.Context, currencyPair string) ([]Trade, error)
- func (c *CoinbasePro) GetTrailingVolume(ctx context.Context) ([]Volume, error)
- func (c *CoinbasePro) GetTransfers(ctx context.Context, profileID, transferType string, limit int64, ...) ([]TransferHistory, error)
- func (c *CoinbasePro) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)
- func (c *CoinbasePro) MarginTransfer(ctx context.Context, amount float64, transferType, profileID, currency string) (MarginTransfer, error)
- func (c *CoinbasePro) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)
- func (c *CoinbasePro) PlaceLimitOrder(ctx context.Context, clientRef string, price, amount float64, side string, ...) (string, error)
- func (c *CoinbasePro) PlaceMarginOrder(ctx context.Context, clientRef string, size, funds float64, ...) (string, error)
- func (c *CoinbasePro) PlaceMarketOrder(ctx context.Context, clientRef string, size, funds float64, ...) (string, error)
- func (c *CoinbasePro) ProcessSnapshot(snapshot *WebsocketOrderbookSnapshot) error
- func (c *CoinbasePro) ProcessUpdate(update *WebsocketL2Update) error
- func (c *CoinbasePro) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, path string, ...) (err error)
- func (c *CoinbasePro) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error
- func (c *CoinbasePro) SetDefaults()
- func (c *CoinbasePro) Setup(exch *config.Exchange) error
- func (c *CoinbasePro) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)
- func (c *CoinbasePro) Subscribe(subs subscription.List) error
- func (c *CoinbasePro) Unsubscribe(subs subscription.List) error
- func (c *CoinbasePro) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
- func (c *CoinbasePro) UpdateOrderExecutionLimits(_ context.Context, _ asset.Item) error
- func (c *CoinbasePro) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
- func (c *CoinbasePro) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
- func (c *CoinbasePro) UpdateTickers(_ context.Context, _ asset.Item) error
- func (c *CoinbasePro) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
- func (c *CoinbasePro) ValidateAPICredentials(ctx context.Context, assetType asset.Item) error
- func (c *CoinbasePro) WithdrawCrypto(ctx context.Context, amount float64, currency, cryptoAddress string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (c *CoinbasePro) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (c *CoinbasePro) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
- func (c *CoinbasePro) WithdrawViaPaymentMethod(ctx context.Context, amount float64, currency, paymentID string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) WsConnect() error
- type Currency
- type DepositWithdrawalInfo
- type FillResponse
- type Funding
- type GeneralizedOrderResponse
- type History
- type LimitInfo
- type MarginTransfer
- type OrderL1L2
- type OrderL3
- type OrderbookL1L2
- type OrderbookL3
- type OrderbookResponse
- type PaymentMethod
- type Product
- type Report
- type RequestParamsTimeForceType
- type ServerTime
- type Stats
- type Ticker
- type Trade
- type TransferHistory
- type Volume
- type WebsocketHeartBeat
- type WebsocketL2Update
- type WebsocketOrderbookSnapshot
- type WebsocketSubscribe
- type WebsocketTicker
- type WsChannel
Constants ¶
This section is empty.
Variables ¶
var ( // CoinbaseRequestParamsTimeGTC GTC CoinbaseRequestParamsTimeGTC = RequestParamsTimeForceType("GTC") // CoinbaseRequestParamsTimeIOC IOC CoinbaseRequestParamsTimeIOC = RequestParamsTimeForceType("IOC") )
Functions ¶
func GetRateLimit ¶
func GetRateLimit() request.RateLimitDefinitions
GetRateLimit returns the rate limit for the exchange
Types ¶
type Account ¶
type Account struct { ID string `json:"id"` Balance float64 `json:"balance,string"` Hold float64 `json:"hold,string"` FundedAmount float64 `json:"funded_amount,string"` DefaultAmount float64 `json:"default_amount,string"` }
Account is a sub-type for account overview
type AccountHolds ¶
type AccountHolds struct { ID string `json:"id"` AccountID string `json:"account_id"` CreatedAt time.Time `json:"created_at"` UpdatedAt string `json:"updated_at"` Amount float64 `json:"amount,string"` Type string `json:"type"` Reference string `json:"ref"` }
AccountHolds contains the hold information about an account
type AccountLedgerResponse ¶
type AccountLedgerResponse struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` Amount float64 `json:"amount,string"` Balance float64 `json:"balance,string"` Type string `json:"type"` Details interface{} `json:"details"` }
AccountLedgerResponse holds account history information
type AccountOverview ¶
type AccountOverview struct { Status string `json:"status"` Funding struct { MaxFundingValue float64 `json:"max_funding_value,string"` FundingValue float64 `json:"funding_value,string"` OldestOutstanding struct { ID string `json:"id"` OrderID string `json:"order_id"` CreatedAt time.Time `json:"created_at"` Currency string `json:"currency"` AccountID string `json:"account_id"` Amount float64 `json:"amount,string"` } `json:"oldest_outstanding"` } `json:"funding"` Accounts struct { LTC Account `json:"LTC"` ETH Account `json:"ETH"` USD Account `json:"USD"` BTC Account `json:"BTC"` } `json:"accounts"` MarginCall struct { Active bool `json:"active"` Price float64 `json:"price,string"` Side string `json:"side"` Size float64 `json:"size,string"` Funds float64 `json:"funds,string"` } `json:"margin_call"` UserID string `json:"user_id"` ProfileID string `json:"profile_id"` Position struct { Type string `json:"type"` Size float64 `json:"size,string"` Complement float64 `json:"complement,string"` MaxSize float64 `json:"max_size,string"` } `json:"position"` ProductID string `json:"product_id"` }
AccountOverview holds account information returned from position
type AccountResponse ¶
type AccountResponse struct { ID string `json:"id"` Currency string `json:"currency"` Balance float64 `json:"balance,string"` Available float64 `json:"available,string"` Hold float64 `json:"hold,string"` ProfileID string `json:"profile_id"` MarginEnabled bool `json:"margin_enabled"` FundedAmount float64 `json:"funded_amount,string"` DefaultAmount float64 `json:"default_amount,string"` }
AccountResponse holds the details for the trading accounts
type CoinbaseAccounts ¶
type CoinbaseAccounts struct { ID string `json:"id"` Name string `json:"name"` Balance float64 `json:"balance,string"` Currency string `json:"currency"` Type string `json:"type"` Primary bool `json:"primary"` Active bool `json:"active"` WireDepositInformation struct { AccountNumber string `json:"account_number"` RoutingNumber string `json:"routing_number"` BankName string `json:"bank_name"` BankAddress string `json:"bank_address"` BankCountry struct { Code string `json:"code"` Name string `json:"name"` } `json:"bank_country"` AccountName string `json:"account_name"` AccountAddress string `json:"account_address"` Reference string `json:"reference"` } `json:"wire_deposit_information"` SepaDepositInformation struct { Iban string `json:"iban"` Swift string `json:"swift"` BankName string `json:"bank_name"` BankAddress string `json:"bank_address"` BankCountryName string `json:"bank_country_name"` AccountName string `json:"account_name"` AccountAddress string `json:"account_address"` Reference string `json:"reference"` } `json:"sep_deposit_information"` }
CoinbaseAccounts holds coinbase account information
type CoinbasePro ¶
CoinbasePro is the overarching type across the coinbasepro package
func (*CoinbasePro) CancelAllExistingOrders ¶
func (c *CoinbasePro) CancelAllExistingOrders(ctx context.Context, currencyPair string) ([]string, error)
CancelAllExistingOrders cancels all open orders on the exchange and returns and array of order IDs currencyPair - [optional] all orders for a currencyPair string will be canceled
func (*CoinbasePro) CancelAllOrders ¶
func (c *CoinbasePro) CancelAllOrders(ctx context.Context, _ *order.Cancel) (order.CancelAllResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*CoinbasePro) CancelBatchOrders ¶
func (c *CoinbasePro) CancelBatchOrders(_ context.Context, _ []order.Cancel) (*order.CancelBatchResponse, error)
CancelBatchOrders cancels an orders by their corresponding ID numbers
func (*CoinbasePro) CancelExistingOrder ¶
func (c *CoinbasePro) CancelExistingOrder(ctx context.Context, orderID string) error
CancelExistingOrder cancels order by orderID
func (*CoinbasePro) CancelOrder ¶
CancelOrder cancels an order by its corresponding ID number
func (*CoinbasePro) ClosePosition ¶
func (c *CoinbasePro) ClosePosition(ctx context.Context, repayOnly bool) (AccountOverview, error)
ClosePosition closes a position and allowing you to repay position as well repayOnly - allows the position to be repaid
func (*CoinbasePro) DepositViaCoinbase ¶
func (c *CoinbasePro) DepositViaCoinbase(ctx context.Context, amount float64, currency, accountID string) (DepositWithdrawalInfo, error)
DepositViaCoinbase deposits funds from a coinbase account. Move funds between a Coinbase account and coinbasepro trading account within daily limits. Moving funds between Coinbase and coinbasepro is instant and free. See the Coinbase Accounts section for retrieving your Coinbase accounts.
amount - The amount to deposit currency - The type of currency accountID - ID of the coinbase account
func (*CoinbasePro) DepositViaPaymentMethod ¶
func (c *CoinbasePro) DepositViaPaymentMethod(ctx context.Context, amount float64, currency, paymentID string) (DepositWithdrawalInfo, error)
DepositViaPaymentMethod deposits funds from a payment method. See the Payment Methods section for retrieving your payment methods.
amount - The amount to deposit currency - The type of currency paymentID - ID of the payment method
func (*CoinbasePro) FetchAccountInfo ¶
func (c *CoinbasePro) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
FetchAccountInfo retrieves balances for all enabled currencies
func (*CoinbasePro) FetchOrderbook ¶
func (c *CoinbasePro) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
FetchOrderbook returns orderbook base on the currency pair
func (*CoinbasePro) FetchTicker ¶
func (c *CoinbasePro) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)
FetchTicker returns the ticker for a currency pair
func (*CoinbasePro) FetchTradablePairs ¶
FetchTradablePairs returns a list of the exchanges tradable pairs
func (*CoinbasePro) GetAccount ¶
func (c *CoinbasePro) GetAccount(ctx context.Context, accountID string) (AccountResponse, error)
GetAccount returns information for a single account. Use this endpoint when account_id is known
func (*CoinbasePro) GetAccountFundingHistory ¶
func (c *CoinbasePro) GetAccountFundingHistory(_ context.Context) ([]exchange.FundingHistory, error)
GetAccountFundingHistory returns funding history, deposits and withdrawals
func (*CoinbasePro) GetAccountHistory ¶
func (c *CoinbasePro) GetAccountHistory(ctx context.Context, accountID string) ([]AccountLedgerResponse, error)
GetAccountHistory returns a list of account activity. Account activity either increases or decreases your account balance. Items are paginated and sorted latest first.
func (*CoinbasePro) GetAccounts ¶
func (c *CoinbasePro) GetAccounts(ctx context.Context) ([]AccountResponse, error)
GetAccounts returns a list of trading accounts associated with the APIKEYS
func (*CoinbasePro) GetActiveOrders ¶
func (c *CoinbasePro) GetActiveOrders(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
GetActiveOrders retrieves any orders that are active/open
func (*CoinbasePro) GetCoinbaseAccounts ¶
func (c *CoinbasePro) GetCoinbaseAccounts(ctx context.Context) ([]CoinbaseAccounts, error)
GetCoinbaseAccounts returns a list of coinbase accounts
func (*CoinbasePro) GetCurrencies ¶
func (c *CoinbasePro) GetCurrencies(ctx context.Context) ([]Currency, error)
GetCurrencies returns a list of supported currency on the exchange Warning: Not all currencies may be currently in use for tradinc.
func (*CoinbasePro) GetCurrencyTradeURL ¶
func (c *CoinbasePro) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currency.Pair) (string, error)
GetCurrencyTradeURL returns the URL to the exchange's trade page for the given asset and currency pair
func (*CoinbasePro) GetCurrentServerTime ¶
func (c *CoinbasePro) GetCurrentServerTime(ctx context.Context) (ServerTime, error)
GetCurrentServerTime returns the API server time
func (*CoinbasePro) GetDepositAddress ¶
func (c *CoinbasePro) GetDepositAddress(_ context.Context, _ currency.Code, _, _ string) (*deposit.Address, error)
GetDepositAddress returns a deposit address for a specified currency
func (*CoinbasePro) GetFee ¶
func (c *CoinbasePro) GetFee(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*CoinbasePro) GetFeeByType ¶
func (c *CoinbasePro) GetFeeByType(ctx context.Context, feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*CoinbasePro) GetFills ¶
func (c *CoinbasePro) GetFills(ctx context.Context, orderID, currencyPair string) ([]FillResponse, error)
GetFills returns a list of recent fills
func (*CoinbasePro) GetFuturesContractDetails ¶
func (c *CoinbasePro) GetFuturesContractDetails(context.Context, asset.Item) ([]futures.Contract, error)
GetFuturesContractDetails returns all contracts from the exchange by asset type
func (*CoinbasePro) GetHistoricCandles ¶
func (c *CoinbasePro) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)
GetHistoricCandles returns a set of candle between two time periods for a designated time period
func (*CoinbasePro) GetHistoricCandlesExtended ¶
func (c *CoinbasePro) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, interval kline.Interval, start, end time.Time) (*kline.Item, error)
GetHistoricCandlesExtended returns candles between a time period for a set time interval
func (*CoinbasePro) GetHistoricRates ¶
func (c *CoinbasePro) GetHistoricRates(ctx context.Context, currencyPair, start, end string, granularity int64) ([]History, error)
GetHistoricRates returns historic rates for a product. Rates are returned in grouped buckets based on requested granularity.
func (*CoinbasePro) GetHistoricTrades ¶
func (c *CoinbasePro) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)
GetHistoricTrades returns historic trade data within the timeframe provided
func (*CoinbasePro) GetHolds ¶
func (c *CoinbasePro) GetHolds(ctx context.Context, accountID string) ([]AccountHolds, error)
GetHolds returns the holds that are placed on an account for any active orders or pending withdraw requests. As an order is filled, the hold amount is updated. If an order is canceled, any remaining hold is removed. For a withdraw, once it is completed, the hold is removed.
func (*CoinbasePro) GetLatestFundingRates ¶
func (c *CoinbasePro) GetLatestFundingRates(context.Context, *fundingrate.LatestRateRequest) ([]fundingrate.LatestRateResponse, error)
GetLatestFundingRates returns the latest funding rates data
func (*CoinbasePro) GetOrder ¶
func (c *CoinbasePro) GetOrder(ctx context.Context, orderID string) (GeneralizedOrderResponse, error)
GetOrder returns a single order by order id.
func (*CoinbasePro) GetOrderHistory ¶
func (c *CoinbasePro) GetOrderHistory(ctx context.Context, req *order.MultiOrderRequest) (order.FilteredOrders, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*CoinbasePro) GetOrderInfo ¶
func (c *CoinbasePro) GetOrderInfo(ctx context.Context, orderID string, _ currency.Pair, _ asset.Item) (*order.Detail, error)
GetOrderInfo returns order information based on order ID
func (*CoinbasePro) GetOrderbook ¶
func (c *CoinbasePro) GetOrderbook(ctx context.Context, symbol string, level int) (interface{}, error)
GetOrderbook returns orderbook by currency pair and level
func (*CoinbasePro) GetOrders ¶
func (c *CoinbasePro) GetOrders(ctx context.Context, status []string, currencyPair string) ([]GeneralizedOrderResponse, error)
GetOrders lists current open orders. Only open or un-settled orders are returned. As soon as an order is no longer open and settled, it will no longer appear in the default request. status - can be a range of "open", "pending", "done" or "active" currencyPair - [optional] for example "BTC-USD"
func (*CoinbasePro) GetPayMethods ¶
func (c *CoinbasePro) GetPayMethods(ctx context.Context) ([]PaymentMethod, error)
GetPayMethods returns a full list of payment methods
func (*CoinbasePro) GetPosition ¶
func (c *CoinbasePro) GetPosition(ctx context.Context) (AccountOverview, error)
GetPosition returns an overview of account profile.
func (*CoinbasePro) GetProducts ¶
func (c *CoinbasePro) GetProducts(ctx context.Context) ([]Product, error)
GetProducts returns supported currency pairs on the exchange with specific information about the pair
func (*CoinbasePro) GetRecentTrades ¶
func (c *CoinbasePro) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)
GetRecentTrades returns the most recent trades for a currency and asset
func (*CoinbasePro) GetReport ¶
func (c *CoinbasePro) GetReport(ctx context.Context, reportType, startDate, endDate, currencyPair, accountID, format, email string) (Report, error)
GetReport returns batches of historic information about your account in various human and machine readable forms.
reportType - "fills" or "account" startDate - Starting date for the report (inclusive) endDate - Ending date for the report (inclusive) currencyPair - ID of the product to generate a fills report for. E.c. BTC-USD. *Required* if type is fills accountID - ID of the account to generate an account report for. *Required* if type is account format - pdf or csv (default is pdf) email - [optional] Email address to send the report to
func (*CoinbasePro) GetReportStatus ¶
GetReportStatus once a report request has been accepted for processing, the status is available by polling the report resource endpoint.
func (*CoinbasePro) GetServerTime ¶
GetServerTime returns the current exchange server time.
func (*CoinbasePro) GetStats ¶
GetStats returns a 24 hr stat for the product. Volume is in base currency units. open, high, low are in quote currency units.
func (*CoinbasePro) GetTicker ¶
GetTicker returns ticker by currency pair currencyPair - example "BTC-USD"
func (*CoinbasePro) GetTrades ¶
GetTrades listd the latest trades for a product currencyPair - example "BTC-USD"
func (*CoinbasePro) GetTrailingVolume ¶
func (c *CoinbasePro) GetTrailingVolume(ctx context.Context) ([]Volume, error)
GetTrailingVolume this request will return your 30-day trailing volume for all products.
func (*CoinbasePro) GetTransfers ¶
func (c *CoinbasePro) GetTransfers(ctx context.Context, profileID, transferType string, limit int64, start, end time.Time) ([]TransferHistory, error)
GetTransfers returns a history of withdrawal and or deposit transactions
func (*CoinbasePro) GetWithdrawalsHistory ¶
func (c *CoinbasePro) GetWithdrawalsHistory(_ context.Context, _ currency.Code, _ asset.Item) ([]exchange.WithdrawalHistory, error)
GetWithdrawalsHistory returns previous withdrawals data
func (*CoinbasePro) MarginTransfer ¶
func (c *CoinbasePro) MarginTransfer(ctx context.Context, amount float64, transferType, profileID, currency string) (MarginTransfer, error)
MarginTransfer sends funds between a standard/default profile and a margin profile. A deposit will transfer funds from the default profile into the margin profile. A withdraw will transfer funds from the margin profile to the default profile. Withdraws will fail if they would set your margin ratio below the initial margin ratio requirement.
amount - the amount to transfer between the default and margin profile transferType - either "deposit" or "withdraw" profileID - The id of the margin profile to deposit or withdraw from currency - currency to transfer, currently on "BTC" or "USD"
func (*CoinbasePro) ModifyOrder ¶
func (c *CoinbasePro) ModifyOrder(_ context.Context, _ *order.Modify) (*order.ModifyResponse, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*CoinbasePro) PlaceLimitOrder ¶
func (c *CoinbasePro) PlaceLimitOrder(ctx context.Context, clientRef string, price, amount float64, side string, timeInforce RequestParamsTimeForceType, cancelAfter, productID, stp string, postOnly bool) (string, error)
PlaceLimitOrder places a new limit order. Orders can only be placed if the account has sufficient funds. Once an order is placed, account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.
GENERAL PARAMS clientRef - [optional] Order ID selected by you to identify your order side - buy or sell productID - A valid product id stp - [optional] Self-trade prevention flag
LIMIT ORDER PARAMS price - Price per bitcoin amount - Amount of BTC to buy or sell timeInforce - [optional] GTC, GTT, IOC, or FOK (default is GTC) cancelAfter - [optional] min, hour, day * Requires time_in_force to be GTT postOnly - [optional] Post only flag Invalid when time_in_force is IOC or FOK
func (*CoinbasePro) PlaceMarginOrder ¶
func (c *CoinbasePro) PlaceMarginOrder(ctx context.Context, clientRef string, size, funds float64, side, productID, stp string) (string, error)
PlaceMarginOrder places a new market order. Orders can only be placed if the account has sufficient funds. Once an order is placed, account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.
GENERAL PARAMS clientRef - [optional] Order ID selected by you to identify your order side - buy or sell productID - A valid product id stp - [optional] Self-trade prevention flag
MARGIN ORDER PARAMS size - [optional]* Desired amount in BTC funds - [optional]* Desired amount of quote currency to use
func (*CoinbasePro) PlaceMarketOrder ¶
func (c *CoinbasePro) PlaceMarketOrder(ctx context.Context, clientRef string, size, funds float64, side, productID, stp string) (string, error)
PlaceMarketOrder places a new market order. Orders can only be placed if the account has sufficient funds. Once an order is placed, account funds will be put on hold for the duration of the order. How much and which funds are put on hold depends on the order type and parameters specified.
GENERAL PARAMS clientRef - [optional] Order ID selected by you to identify your order side - buy or sell productID - A valid product id stp - [optional] Self-trade prevention flag
MARKET ORDER PARAMS size - [optional]* Desired amount in BTC funds [optional]* Desired amount of quote currency to use * One of size or funds is required.
func (*CoinbasePro) ProcessSnapshot ¶
func (c *CoinbasePro) ProcessSnapshot(snapshot *WebsocketOrderbookSnapshot) error
ProcessSnapshot processes the initial orderbook snap shot
func (*CoinbasePro) ProcessUpdate ¶
func (c *CoinbasePro) ProcessUpdate(update *WebsocketL2Update) error
ProcessUpdate updates the orderbook local cache
func (*CoinbasePro) SendAuthenticatedHTTPRequest ¶
func (c *CoinbasePro) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, path string, params map[string]interface{}, result interface{}) (err error)
SendAuthenticatedHTTPRequest sends an authenticated HTTP request
func (*CoinbasePro) SendHTTPRequest ¶
func (c *CoinbasePro) SendHTTPRequest(ctx context.Context, ep exchange.URL, path string, result interface{}) error
SendHTTPRequest sends an unauthenticated HTTP request
func (*CoinbasePro) SetDefaults ¶
func (c *CoinbasePro) SetDefaults()
SetDefaults sets default values for the exchange
func (*CoinbasePro) Setup ¶
func (c *CoinbasePro) Setup(exch *config.Exchange) error
Setup initialises the exchange parameters with the current configuration
func (*CoinbasePro) SubmitOrder ¶
func (c *CoinbasePro) SubmitOrder(ctx context.Context, s *order.Submit) (*order.SubmitResponse, error)
SubmitOrder submits a new order
func (*CoinbasePro) Subscribe ¶
func (c *CoinbasePro) Subscribe(subs subscription.List) error
Subscribe sends a websocket message to receive data from the channel
func (*CoinbasePro) Unsubscribe ¶
func (c *CoinbasePro) Unsubscribe(subs subscription.List) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*CoinbasePro) UpdateAccountInfo ¶
func (c *CoinbasePro) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)
UpdateAccountInfo retrieves balances for all enabled currencies for the coinbasepro exchange
func (*CoinbasePro) UpdateOrderExecutionLimits ¶
UpdateOrderExecutionLimits updates order execution limits
func (*CoinbasePro) UpdateOrderbook ¶
func (c *CoinbasePro) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*CoinbasePro) UpdateTicker ¶
func (c *CoinbasePro) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)
UpdateTicker updates and returns the ticker for a currency pair
func (*CoinbasePro) UpdateTickers ¶
UpdateTickers updates the ticker for all currency pairs of a given asset type
func (*CoinbasePro) UpdateTradablePairs ¶
func (c *CoinbasePro) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config
func (*CoinbasePro) ValidateAPICredentials ¶
ValidateAPICredentials validates current credentials used for wrapper functionality
func (*CoinbasePro) WithdrawCrypto ¶
func (c *CoinbasePro) WithdrawCrypto(ctx context.Context, amount float64, currency, cryptoAddress string) (DepositWithdrawalInfo, error)
WithdrawCrypto withdraws funds to a crypto address
amount - The amount to withdraw currency - The type of currency cryptoAddress - A crypto address of the recipient
func (*CoinbasePro) WithdrawCryptocurrencyFunds ¶
func (c *CoinbasePro) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*CoinbasePro) WithdrawFiatFunds ¶
func (c *CoinbasePro) WithdrawFiatFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*CoinbasePro) WithdrawFiatFundsToInternationalBank ¶
func (c *CoinbasePro) WithdrawFiatFundsToInternationalBank(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
func (*CoinbasePro) WithdrawViaPaymentMethod ¶
func (c *CoinbasePro) WithdrawViaPaymentMethod(ctx context.Context, amount float64, currency, paymentID string) (DepositWithdrawalInfo, error)
WithdrawViaPaymentMethod withdraws funds to a payment method
amount - The amount to withdraw currency - The type of currency paymentID - ID of the payment method
func (*CoinbasePro) WsConnect ¶
func (c *CoinbasePro) WsConnect() error
WsConnect initiates a websocket connection
type DepositWithdrawalInfo ¶
type DepositWithdrawalInfo struct { ID string `json:"id"` Amount float64 `json:"amount,string"` Currency string `json:"currency"` PayoutAt time.Time `json:"payout_at"` }
DepositWithdrawalInfo holds returned deposit information
type FillResponse ¶
type FillResponse struct { TradeID int64 `json:"trade_id"` ProductID string `json:"product_id"` Price float64 `json:"price,string"` Size float64 `json:"size,string"` OrderID string `json:"order_id"` CreatedAt time.Time `json:"created_at"` Liquidity string `json:"liquidity"` Fee float64 `json:"fee,string"` Settled bool `json:"settled"` Side string `json:"side"` }
FillResponse contains fill information from the exchange
type Funding ¶
type Funding struct { ID string `json:"id"` OrderID string `json:"order_id"` ProfileID string `json:"profile_id"` Amount float64 `json:"amount,string"` Status string `json:"status"` CreatedAt time.Time `json:"created_at"` Currency string `json:"currency"` RepaidAmount float64 `json:"repaid_amount"` DefaultAmount float64 `json:"default_amount,string"` RepaidDefault bool `json:"repaid_default"` }
Funding holds funding data
type GeneralizedOrderResponse ¶
type GeneralizedOrderResponse struct { ID string `json:"id"` Price float64 `json:"price,string"` Size float64 `json:"size,string"` ProductID string `json:"product_id"` Side string `json:"side"` Stp string `json:"stp"` Type string `json:"type"` TimeInForce string `json:"time_in_force"` PostOnly bool `json:"post_only"` CreatedAt time.Time `json:"created_at"` FillFees float64 `json:"fill_fees,string"` FilledSize float64 `json:"filled_size,string"` ExecutedValue float64 `json:"executed_value,string"` Status string `json:"status"` Settled bool `json:"settled"` Funds float64 `json:"funds,string"` SpecifiedFunds float64 `json:"specified_funds,string"` DoneReason string `json:"done_reason"` DoneAt time.Time `json:"done_at"` }
GeneralizedOrderResponse is the generalized return type across order placement and information collation
type History ¶
type History struct { Time time.Time Low float64 High float64 Open float64 Close float64 Volume float64 }
History holds historic rate information
type LimitInfo ¶
type LimitInfo struct { PeriodInDays int `json:"period_in_days"` Total struct { Amount float64 `json:"amount,string"` Currency string `json:"currency"` } `json:"total"` }
LimitInfo is a sub-type for payment method
type MarginTransfer ¶
type MarginTransfer struct { CreatedAt time.Time `json:"created_at"` ID string `json:"id"` UserID string `json:"user_id"` ProfileID string `json:"profile_id"` MarginProfileID string `json:"margin_profile_id"` Type string `json:"type"` Amount float64 `json:"amount,string"` Currency string `json:"currency"` AccountID string `json:"account_id"` MarginAccountID string `json:"margin_account_id"` MarginProductID string `json:"margin_product_id"` Status string `json:"status"` Nonce int `json:"nonce"` }
MarginTransfer holds margin transfer details
type OrderbookL1L2 ¶
type OrderbookL1L2 struct { Sequence int64 `json:"sequence"` Bids []OrderL1L2 `json:"bids"` Asks []OrderL1L2 `json:"asks"` }
OrderbookL1L2 holds level 1 and 2 order book information
type OrderbookL3 ¶
type OrderbookL3 struct { Sequence int64 `json:"sequence"` Bids []OrderL3 `json:"bids"` Asks []OrderL3 `json:"asks"` }
OrderbookL3 holds level 3 order book information
type OrderbookResponse ¶
type OrderbookResponse struct { Sequence int64 `json:"sequence"` Bids [][3]interface{} `json:"bids"` Asks [][3]interface{} `json:"asks"` }
OrderbookResponse is a generalized response for order books
type PaymentMethod ¶
type PaymentMethod struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` Currency string `json:"currency"` PrimaryBuy bool `json:"primary_buy"` PrimarySell bool `json:"primary_sell"` AllowBuy bool `json:"allow_buy"` AllowSell bool `json:"allow_sell"` AllowDeposits bool `json:"allow_deposits"` AllowWithdraw bool `json:"allow_withdraw"` Limits struct { Buy []LimitInfo `json:"buy"` InstantBuy []LimitInfo `json:"instant_buy"` Sell []LimitInfo `json:"sell"` Deposit []LimitInfo `json:"deposit"` } `json:"limits"` }
PaymentMethod holds payment method information
type Product ¶
type Product struct { ID string `json:"id"` BaseCurrency string `json:"base_currency"` QuoteCurrency string `json:"quote_currency"` QuoteIncrement float64 `json:"quote_increment,string"` BaseIncrement float64 `json:"base_increment,string"` DisplayName string `json:"display_name"` MinimumMarketFunds float64 `json:"min_market_funds,string"` 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"` TradingDisabled bool `json:"trading_disabled"` ForeignExchangeStableCoin bool `json:"fx_stablecoin"` MaxSlippagePercentage float64 `json:"max_slippage_percentage,string"` AuctionMode bool `json:"auction_mode"` }
Product holds product information
type Report ¶
type Report struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status"` CreatedAt time.Time `json:"created_at"` CompletedAt time.Time `json:"completed_at"` ExpiresAt time.Time `json:"expires_at"` FileURL string `json:"file_url"` Params struct { StartDate time.Time `json:"start_date"` EndDate time.Time `json:"end_date"` } `json:"params"` }
Report holds historical information
type RequestParamsTimeForceType ¶
type RequestParamsTimeForceType string
RequestParamsTimeForceType Time in force
type ServerTime ¶
ServerTime holds current requested server time information
type Stats ¶
type Stats struct { Open float64 `json:"open,string"` High float64 `json:"high,string"` Low float64 `json:"low,string"` Volume float64 `json:"volume,string"` Last float64 `json:"last,string"` Volume30Day float64 `json:"volume_30day,string"` }
Stats holds last 24 hr data for coinbasepro
type Ticker ¶
type Ticker struct { TradeID int64 `json:"trade_id"` Ask float64 `json:"ask,string"` Bid float64 `json:"bid,string"` Price float64 `json:"price,string"` Size float64 `json:"size,string"` Volume float64 `json:"volume,string"` Time time.Time `json:"time"` }
Ticker holds basic ticker information
type Trade ¶
type Trade struct { TradeID int64 `json:"trade_id"` Price float64 `json:"price,string"` Size float64 `json:"size,string"` Time time.Time `json:"time"` Side string `json:"side"` }
Trade holds executed trade information
type TransferHistory ¶
type TransferHistory struct { ID string `json:"id"` Type string `json:"type"` CreatedAt string `json:"created_at"` CompletedAt string `json:"completed_at"` CanceledAt time.Time `json:"canceled_at"` ProcessedAt time.Time `json:"processed_at"` UserNonce int64 `json:"user_nonce"` Amount string `json:"amount"` Details struct { CoinbaseAccountID string `json:"coinbase_account_id"` CoinbaseTransactionID string `json:"coinbase_transaction_id"` CoinbasePaymentMethodID string `json:"coinbase_payment_method_id"` } `json:"details"` }
TransferHistory returns wallet transfer history
type Volume ¶
type Volume struct { ProductID string `json:"product_id"` ExchangeVolume float64 `json:"exchange_volume,string"` Volume float64 `json:"volume,string"` RecordedAt string `json:"recorded_at"` }
Volume type contains trailing volume information
type WebsocketHeartBeat ¶
type WebsocketHeartBeat struct { Type string `json:"type"` Sequence int64 `json:"sequence"` LastTradeID int64 `json:"last_trade_id"` ProductID string `json:"product_id"` Time string `json:"time"` }
WebsocketHeartBeat defines JSON response for a heart beat message
type WebsocketL2Update ¶
type WebsocketL2Update struct { Type string `json:"type"` ProductID string `json:"product_id"` Time time.Time `json:"time"` Changes [][3]string `json:"changes"` }
WebsocketL2Update defines an update on the L2 orderbooks
type WebsocketOrderbookSnapshot ¶
type WebsocketOrderbookSnapshot struct { ProductID string `json:"product_id"` Type string `json:"type"` Bids [][2]string `json:"bids"` Asks [][2]string `json:"asks"` Time time.Time `json:"time"` }
WebsocketOrderbookSnapshot defines a snapshot response
type WebsocketSubscribe ¶
type WebsocketSubscribe struct { Type string `json:"type"` ProductIDs []string `json:"product_ids,omitempty"` Channels []any `json:"channels,omitempty"` Signature string `json:"signature,omitempty"` Key string `json:"key,omitempty"` Passphrase string `json:"passphrase,omitempty"` Timestamp string `json:"timestamp,omitempty"` }
WebsocketSubscribe takes in subscription information
type WebsocketTicker ¶
type WebsocketTicker struct { Type string `json:"type"` Sequence int64 `json:"sequence"` ProductID currency.Pair `json:"product_id"` Price float64 `json:"price,string"` Open24H float64 `json:"open_24h,string"` Volume24H float64 `json:"volume_24h,string"` Low24H float64 `json:"low_24h,string"` High24H float64 `json:"high_24h,string"` Volume30D float64 `json:"volume_30d,string"` BestBid float64 `json:"best_bid,string"` BestAsk float64 `json:"best_ask,string"` Side string `json:"side"` Time time.Time `json:"time"` TradeID int64 `json:"trade_id"` LastSize float64 `json:"last_size,string"` }
WebsocketTicker defines ticker websocket response