Documentation
¶
Index ¶
- type Account
- type AccountHolds
- type AccountLedgerResponse
- type AccountOverview
- type AccountResponse
- type CoinbaseAccounts
- type CoinbasePro
- func (c *CoinbasePro) AuthenticateWebsocket() error
- func (c *CoinbasePro) CancelAllExistingOrders(currencyPair string) ([]string, error)
- func (c *CoinbasePro) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
- func (c *CoinbasePro) CancelExistingOrder(orderID string) error
- func (c *CoinbasePro) CancelOrder(order *exchange.OrderCancellation) error
- func (c *CoinbasePro) ClosePosition(repayOnly bool) (AccountOverview, error)
- func (c *CoinbasePro) DepositViaCoinbase(amount float64, currency, accountID string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) DepositViaPaymentMethod(amount float64, currency, paymentID string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) GenerateDefaultSubscriptions()
- func (c *CoinbasePro) GetAccount(accountID string) (AccountResponse, error)
- func (c *CoinbasePro) GetAccountHistory(accountID string) ([]AccountLedgerResponse, error)
- func (c *CoinbasePro) GetAccountInfo() (exchange.AccountInfo, error)
- func (c *CoinbasePro) GetAccounts() ([]AccountResponse, error)
- func (c *CoinbasePro) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (c *CoinbasePro) GetCoinbaseAccounts() ([]CoinbaseAccounts, error)
- func (c *CoinbasePro) GetCurrencies() ([]Currency, error)
- func (c *CoinbasePro) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
- func (c *CoinbasePro) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
- func (c *CoinbasePro) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (c *CoinbasePro) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (c *CoinbasePro) GetFills(orderID, currencyPair string) ([]FillResponse, error)
- func (c *CoinbasePro) GetFundingHistory() ([]exchange.FundHistory, error)
- func (c *CoinbasePro) GetFundingRecords(status string) ([]Funding, error)
- func (c *CoinbasePro) GetHistoricRates(currencyPair string, start, end, granularity int64) ([]History, error)
- func (c *CoinbasePro) GetHolds(accountID string) ([]AccountHolds, error)
- func (c *CoinbasePro) GetOrder(orderID string) (GeneralizedOrderResponse, error)
- func (c *CoinbasePro) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (c *CoinbasePro) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
- func (c *CoinbasePro) GetOrderbook(symbol string, level int) (interface{}, error)
- func (c *CoinbasePro) GetOrderbookEx(p currency.Pair, assetType string) (orderbook.Base, error)
- func (c *CoinbasePro) GetOrders(status []string, currencyPair string) ([]GeneralizedOrderResponse, error)
- func (c *CoinbasePro) GetPayMethods() ([]PaymentMethod, error)
- func (c *CoinbasePro) GetPosition() (AccountOverview, error)
- func (c *CoinbasePro) GetProducts() ([]Product, error)
- func (c *CoinbasePro) GetReport(reportType, startDate, endDate, currencyPair, accountID, format, email string) (Report, error)
- func (c *CoinbasePro) GetReportStatus(reportID string) (Report, error)
- func (c *CoinbasePro) GetServerTime() (ServerTime, error)
- func (c *CoinbasePro) GetStats(currencyPair string) (Stats, error)
- func (c *CoinbasePro) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
- func (c *CoinbasePro) GetTicker(currencyPair string) (Ticker, error)
- func (c *CoinbasePro) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)
- func (c *CoinbasePro) GetTrades(currencyPair string) ([]Trade, error)
- func (c *CoinbasePro) GetTrailingVolume() ([]Volume, error)
- func (c *CoinbasePro) GetWebsocket() (*wshandler.Websocket, error)
- func (c *CoinbasePro) MarginTransfer(amount float64, transferType, profileID, currency string) (MarginTransfer, error)
- func (c *CoinbasePro) ModifyOrder(action *exchange.ModifyOrder) (string, error)
- func (c *CoinbasePro) PlaceLimitOrder(clientRef string, price, amount float64, ...) (string, error)
- func (c *CoinbasePro) PlaceMarginOrder(clientRef string, size, funds float64, side, productID, stp string) (string, error)
- func (c *CoinbasePro) PlaceMarketOrder(clientRef string, size, funds float64, side, productID, stp string) (string, error)
- func (c *CoinbasePro) ProcessSnapshot(snapshot *WebsocketOrderbookSnapshot) error
- func (c *CoinbasePro) ProcessUpdate(update WebsocketL2Update) error
- func (c *CoinbasePro) Run()
- func (c *CoinbasePro) SendAuthenticatedHTTPRequest(method, path string, params map[string]interface{}, result interface{}) (err error)
- func (c *CoinbasePro) SendHTTPRequest(path string, result interface{}) error
- func (c *CoinbasePro) SetDefaults()
- func (c *CoinbasePro) Setup(exch *config.ExchangeConfig)
- func (c *CoinbasePro) Start(wg *sync.WaitGroup)
- func (c *CoinbasePro) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, ...) (exchange.SubmitOrderResponse, error)
- func (c *CoinbasePro) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (c *CoinbasePro) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (c *CoinbasePro) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (c *CoinbasePro) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (c *CoinbasePro) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)
- func (c *CoinbasePro) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)
- func (c *CoinbasePro) WithdrawCrypto(amount float64, currency, cryptoAddress string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (c *CoinbasePro) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (c *CoinbasePro) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (c *CoinbasePro) WithdrawViaPaymentMethod(amount float64, currency, paymentID string) (DepositWithdrawalInfo, error)
- func (c *CoinbasePro) WsConnect() error
- func (c *CoinbasePro) WsHandleData()
- 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 ServerTime
- type Stats
- type Ticker
- type Trade
- type Volume
- type WebsocketActivate
- type WebsocketChange
- type WebsocketDone
- type WebsocketHeartBeat
- type WebsocketL2Update
- type WebsocketMatch
- type WebsocketOpen
- type WebsocketOrderbookSnapshot
- type WebsocketReceived
- 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 string `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 string `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 string `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 ¶
type CoinbasePro struct { exchange.Base WebsocketConn *wshandler.WebsocketConnection }
CoinbasePro is the overarching type across the coinbasepro package
func (*CoinbasePro) AuthenticateWebsocket ¶
func (c *CoinbasePro) AuthenticateWebsocket() error
AuthenticateWebsocket sends an authentication message to the websocket
func (*CoinbasePro) CancelAllExistingOrders ¶
func (c *CoinbasePro) CancelAllExistingOrders(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(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*CoinbasePro) CancelExistingOrder ¶
func (c *CoinbasePro) CancelExistingOrder(orderID string) error
CancelExistingOrder cancels order by orderID
func (*CoinbasePro) CancelOrder ¶
func (c *CoinbasePro) CancelOrder(order *exchange.OrderCancellation) error
CancelOrder cancels an order by its corresponding ID number
func (*CoinbasePro) ClosePosition ¶
func (c *CoinbasePro) ClosePosition(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(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(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) GenerateDefaultSubscriptions ¶
func (c *CoinbasePro) GenerateDefaultSubscriptions()
GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()
func (*CoinbasePro) GetAccount ¶
func (c *CoinbasePro) GetAccount(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(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) GetAccountInfo ¶
func (c *CoinbasePro) GetAccountInfo() (exchange.AccountInfo, error)
GetAccountInfo retrieves balances for all enabled currencies for the coinbasepro exchange
func (*CoinbasePro) GetAccounts ¶
func (c *CoinbasePro) GetAccounts() ([]AccountResponse, error)
GetAccounts returns a list of trading accounts associated with the APIKEYS
func (*CoinbasePro) GetActiveOrders ¶
func (c *CoinbasePro) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetActiveOrders retrieves any orders that are active/open
func (*CoinbasePro) GetCoinbaseAccounts ¶
func (c *CoinbasePro) GetCoinbaseAccounts() ([]CoinbaseAccounts, error)
GetCoinbaseAccounts returns a list of coinbase accounts
func (*CoinbasePro) GetCurrencies ¶
func (c *CoinbasePro) GetCurrencies() ([]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) GetDepositAddress ¶
func (c *CoinbasePro) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
GetDepositAddress returns a deposit address for a specified currency
func (*CoinbasePro) GetExchangeHistory ¶
func (c *CoinbasePro) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*CoinbasePro) GetFee ¶
func (c *CoinbasePro) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*CoinbasePro) GetFeeByType ¶
func (c *CoinbasePro) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*CoinbasePro) GetFills ¶
func (c *CoinbasePro) GetFills(orderID, currencyPair string) ([]FillResponse, error)
GetFills returns a list of recent fills
func (*CoinbasePro) GetFundingHistory ¶
func (c *CoinbasePro) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*CoinbasePro) GetFundingRecords ¶
func (c *CoinbasePro) GetFundingRecords(status string) ([]Funding, error)
GetFundingRecords every order placed with a margin profile that draws funding will create a funding record.
status - "outstanding", "settled", or "rejected"
func (*CoinbasePro) GetHistoricRates ¶
func (c *CoinbasePro) GetHistoricRates(currencyPair string, start, end, granularity int64) ([]History, error)
GetHistoricRates returns historic rates for a product. Rates are returned in grouped buckets based on requested granularity.
func (*CoinbasePro) GetHolds ¶
func (c *CoinbasePro) GetHolds(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(orderID string) (GeneralizedOrderResponse, error)
GetOrder returns a single order by order id.
func (*CoinbasePro) GetOrderHistory ¶
func (c *CoinbasePro) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*CoinbasePro) GetOrderInfo ¶
func (c *CoinbasePro) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
GetOrderInfo returns information on a current open order
func (*CoinbasePro) GetOrderbook ¶
func (c *CoinbasePro) GetOrderbook(symbol string, level int) (interface{}, error)
GetOrderbook returns orderbook by currency pair and level
func (*CoinbasePro) GetOrderbookEx ¶
GetOrderbookEx returns orderbook base on the currency pair
func (*CoinbasePro) GetOrders ¶
func (c *CoinbasePro) GetOrders(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() ([]PaymentMethod, error)
GetPayMethods returns a full list of payment methods
func (*CoinbasePro) GetPosition ¶
func (c *CoinbasePro) GetPosition() (AccountOverview, error)
GetPosition returns an overview of account profile.
func (*CoinbasePro) GetProducts ¶
func (c *CoinbasePro) GetProducts() ([]Product, error)
GetProducts returns supported currency pairs on the exchange with specific information about the pair
func (*CoinbasePro) GetReport ¶
func (c *CoinbasePro) GetReport(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 ¶
func (c *CoinbasePro) GetReportStatus(reportID string) (Report, error)
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() (ServerTime, error)
GetServerTime returns the API server time
func (*CoinbasePro) GetStats ¶
func (c *CoinbasePro) GetStats(currencyPair string) (Stats, error)
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) GetSubscriptions ¶
func (c *CoinbasePro) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
GetSubscriptions returns a copied list of subscriptions
func (*CoinbasePro) GetTicker ¶
func (c *CoinbasePro) GetTicker(currencyPair string) (Ticker, error)
GetTicker returns ticker by currency pair currencyPair - example "BTC-USD"
func (*CoinbasePro) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*CoinbasePro) GetTrades ¶
func (c *CoinbasePro) GetTrades(currencyPair string) ([]Trade, error)
GetTrades listd the latest trades for a product currencyPair - example "BTC-USD"
func (*CoinbasePro) GetTrailingVolume ¶
func (c *CoinbasePro) GetTrailingVolume() ([]Volume, error)
GetTrailingVolume this request will return your 30-day trailing volume for all products.
func (*CoinbasePro) GetWebsocket ¶
func (c *CoinbasePro) GetWebsocket() (*wshandler.Websocket, error)
GetWebsocket returns a pointer to the exchange websocket
func (*CoinbasePro) MarginTransfer ¶
func (c *CoinbasePro) MarginTransfer(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(action *exchange.ModifyOrder) (string, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*CoinbasePro) PlaceLimitOrder ¶
func (c *CoinbasePro) PlaceLimitOrder(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(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(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(method, path string, params map[string]interface{}, result interface{}) (err error)
SendAuthenticatedHTTPRequest sends an authenticated HTTP reque
func (*CoinbasePro) SendHTTPRequest ¶
func (c *CoinbasePro) SendHTTPRequest(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.ExchangeConfig)
Setup initialises the exchange parameters with the current configuration
func (*CoinbasePro) Start ¶
func (c *CoinbasePro) Start(wg *sync.WaitGroup)
Start starts the coinbasepro go routine
func (*CoinbasePro) SubmitOrder ¶
func (c *CoinbasePro) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, _ string) (exchange.SubmitOrderResponse, error)
SubmitOrder submits a new order
func (*CoinbasePro) Subscribe ¶
func (c *CoinbasePro) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*CoinbasePro) SubscribeToWebsocketChannels ¶
func (c *CoinbasePro) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing
func (*CoinbasePro) Unsubscribe ¶
func (c *CoinbasePro) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*CoinbasePro) UnsubscribeToWebsocketChannels ¶
func (c *CoinbasePro) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing
func (*CoinbasePro) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*CoinbasePro) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*CoinbasePro) WithdrawCrypto ¶
func (c *CoinbasePro) WithdrawCrypto(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(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*CoinbasePro) WithdrawFiatFunds ¶
func (c *CoinbasePro) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*CoinbasePro) WithdrawFiatFundsToInternationalBank ¶
func (c *CoinbasePro) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
func (*CoinbasePro) WithdrawViaPaymentMethod ¶
func (c *CoinbasePro) WithdrawViaPaymentMethod(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
func (*CoinbasePro) WsHandleData ¶
func (c *CoinbasePro) WsHandleData()
WsHandleData handles read data from websocket connection
type DepositWithdrawalInfo ¶
type DepositWithdrawalInfo struct { ID string `json:"id"` Amount float64 `json:"amount,string"` Currency string `json:"currency"` PayoutAt string `json:"payout_at"` }
DepositWithdrawalInfo holds returned deposit information
type FillResponse ¶
type FillResponse struct { TradeID int `json:"trade_id"` ProductID string `json:"product_id"` Price float64 `json:"price,string"` Size float64 `json:"size,string"` OrderID string `json:"order_id"` CreatedAt string `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 string `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 string `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 string `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 string `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 Report ¶
type Report struct { ID string `json:"id"` Type string `json:"type"` Status string `json:"status"` CreatedAt string `json:"created_at"` CompletedAt string `json:"completed_at"` ExpiresAt string `json:"expires_at"` FileURL string `json:"file_url"` Params struct { StartDate string `json:"start_date"` EndDate string `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"` }
Stats holds last 24 hr data for coinbasepro
type Ticker ¶
type Ticker struct { TradeID int64 `json:"trade_id"` Price float64 `json:"price,string"` Size float64 `json:"size,string"` Time string `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 string `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 WebsocketActivate ¶
type WebsocketActivate struct { Type string `json:"type"` ProductID string `json:"product_id"` Timestamp string `json:"timestamp"` UserID string `json:"user_id"` ProfileID string `json:"profile_id"` OrderID string `json:"order_id"` StopType string `json:"stop_type"` Side string `json:"side"` StopPrice float64 `json:"stop_price,string"` Size float64 `json:"size,string"` Funds float64 `json:"funds,string"` TakerFeeRate float64 `json:"taker_fee_rate,string"` Private bool `json:"private"` }
WebsocketActivate an activate message is sent when a stop order is placed
type WebsocketChange ¶
type WebsocketChange struct { Type string `json:"type"` Time string `json:"time"` Sequence int `json:"sequence"` OrderID string `json:"order_id"` NewSize float64 `json:"new_size,string"` OldSize float64 `json:"old_size,string"` Price float64 `json:"price,string"` Side string `json:"side"` }
WebsocketChange holds change information
type WebsocketDone ¶
type WebsocketDone struct { Type string `json:"type"` Side string `json:"side"` OrderID string `json:"order_id"` Reason string `json:"reason"` ProductID string `json:"product_id"` Price float64 `json:"price,string"` RemainingSize float64 `json:"remaining_size,string"` Sequence int64 `json:"sequence"` Time string `json:"time"` }
WebsocketDone holds finished order 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 WebsocketMatch ¶
type WebsocketMatch struct { Type string `json:"type"` TradeID int `json:"trade_id"` MakerOrderID string `json:"maker_order_id"` TakerOrderID string `json:"taker_order_id"` Side string `json:"side"` Size float64 `json:"size,string"` Price float64 `json:"price,string"` ProductID string `json:"product_id"` Sequence int64 `json:"sequence"` Time string `json:"time"` }
WebsocketMatch holds match information
type WebsocketOpen ¶
type WebsocketOpen struct { Type string `json:"type"` Side string `json:"side"` Price float64 `json:"price,string"` OrderID string `json:"order_id"` RemainingSize float64 `json:"remaining_size,string"` ProductID string `json:"product_id"` Sequence int64 `json:"sequence"` Time string `json:"time"` }
WebsocketOpen collates open orders
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 WebsocketReceived ¶
type WebsocketReceived struct { Type string `json:"type"` OrderID string `json:"order_id"` OrderType string `json:"order_type"` Size float64 `json:"size,string"` Price float64 `json:"price,omitempty,string"` Funds float64 `json:"funds,omitempty,string"` Side string `json:"side"` ClientOID string `json:"client_oid"` ProductID string `json:"product_id"` Sequence int64 `json:"sequence"` Time string `json:"time"` }
WebsocketReceived holds websocket received values
type WebsocketSubscribe ¶
type WebsocketSubscribe struct { Type string `json:"type"` ProductID string `json:"product_id,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 string `json:"product_id"` Price float64 `json:"price,string"` Open24H float64 `json:"open_24h,string"` Volume24H float64 `json:"volumen_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,string"` TradeID int64 `json:"trade_id"` LastSize float64 `json:"last_size,string"` }
WebsocketTicker defines ticker websocket response
type WsChannels ¶
WsChannels defines outgoing channels for subscription purposes