Documentation ¶
Index ¶
- 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(ctx context.Context, o []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 asset.Item) ([]string, error)
- func (c *CoinbasePro) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
- func (c *CoinbasePro) GetAccount(ctx context.Context, accountID string) (AccountResponse, 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.GetOrdersRequest) ([]order.Detail, error)
- func (c *CoinbasePro) GetCoinbaseAccounts(ctx context.Context) ([]CoinbaseAccounts, error)
- func (c *CoinbasePro) GetCurrencies(ctx context.Context) ([]Currency, error)
- func (c *CoinbasePro) GetDefaultConfig() (*config.Exchange, 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) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error)
- func (c *CoinbasePro) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, ...) (kline.Item, error)
- func (c *CoinbasePro) GetHistoricCandlesExtended(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, ...) (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) GetOrder(ctx context.Context, orderID string) (GeneralizedOrderResponse, error)
- func (c *CoinbasePro) GetOrderHistory(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)
- func (c *CoinbasePro) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType 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) (ServerTime, 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) GetWithdrawalsHistory(_ context.Context, _ currency.Code) (resp []exchange.WithdrawalHistory, err error)
- func (c *CoinbasePro) MarginTransfer(ctx context.Context, amount float64, transferType, profileID, currency string) (MarginTransfer, error)
- func (c *CoinbasePro) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)
- func (c *CoinbasePro) PlaceLimitOrder(ctx context.Context, clientRef string, price, amount float64, ...) (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) Run()
- 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) Start(wg *sync.WaitGroup) error
- func (c *CoinbasePro) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)
- func (c *CoinbasePro) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error
- func (c *CoinbasePro) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error
- func (c *CoinbasePro) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, 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(ctx context.Context, a asset.Item) error
- func (c *CoinbasePro) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error
- func (c *CoinbasePro) ValidateCredentials(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 RateLimit
- type Report
- type ServerTime
- type Stats
- type Ticker
- type Trade
- type Volume
- type WebsocketHeartBeat
- type WebsocketL2Update
- type WebsocketOrderbookSnapshot
- type WebsocketSubscribe
- type WebsocketTicker
- type WsChannels
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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(ctx context.Context, o []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) GenerateDefaultSubscriptions ¶
func (c *CoinbasePro) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
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) 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.GetOrdersRequest) ([]order.Detail, 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) GetDefaultConfig ¶
func (c *CoinbasePro) GetDefaultConfig() (*config.Exchange, error)
GetDefaultConfig returns a default exchange config
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) GetFundingHistory ¶
func (c *CoinbasePro) GetFundingHistory(_ context.Context) ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*CoinbasePro) GetHistoricCandles ¶
func (c *CoinbasePro) GetHistoricCandles(ctx context.Context, p currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (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, p currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (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) 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.GetOrdersRequest) ([]order.Detail, 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, pair currency.Pair, assetType 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 ¶
func (c *CoinbasePro) GetServerTime(ctx context.Context) (ServerTime, error)
GetServerTime returns the API 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) GetWithdrawalsHistory ¶
func (c *CoinbasePro) GetWithdrawalsHistory(_ context.Context, _ currency.Code) (resp []exchange.WithdrawalHistory, err 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 ¶
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, timeInforce, 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) Start ¶
func (c *CoinbasePro) Start(wg *sync.WaitGroup) error
Start starts the coinbasepro go routine
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(channelsToSubscribe []stream.ChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*CoinbasePro) Unsubscribe ¶
func (c *CoinbasePro) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) 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) 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) ValidateCredentials ¶
ValidateCredentials 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 int64 `json:"time"` Low float64 `json:"low"` High float64 `json:"high"` Open float64 `json:"open"` Close float64 `json:"close"` Volume float64 `json:"volume"` }
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 [][]interface{} `json:"bids"` Asks [][]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"` BaseMinSize float64 `json:"base_min_size,string"` BaseMaxSize interface{} `json:"base_max_size"` QuoteIncrement float64 `json:"quote_increment,string"` DisplayName string `json:"string"` }
Product holds product information
type RateLimit ¶
RateLimit implements the request.Limiter interface
func SetRateLimit ¶
func SetRateLimit() *RateLimit
SetRateLimit returns the rate limit for the exchange
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 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 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 string `json:"time"` Changes [][]interface{} `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 [][]interface{} `json:"bids"` Asks [][]interface{} `json:"asks"` }
WebsocketOrderbookSnapshot defines a snapshot response
type WebsocketSubscribe ¶
type WebsocketSubscribe struct { Type string `json:"type"` ProductIDs []string `json:"product_ids,omitempty"` Channels []WsChannels `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
type WsChannels ¶
type WsChannels struct { Name string `json:"name"` ProductIDs []string `json:"product_ids,omitempty"` }
WsChannels defines outgoing channels for subscription purposes