Documentation ¶
Index ¶
- type Balances
- type Bitstamp
- func (b *Bitstamp) AuthenticateWebsocket() error
- func (b *Bitstamp) CalculateTradingFee(base, quote currency.Code, purchasePrice, amount float64, balances *Balances) float64
- func (b *Bitstamp) CancelAllExistingOrders() (bool, error)
- func (b *Bitstamp) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
- func (b *Bitstamp) CancelExistingOrder(orderID int64) (bool, error)
- func (b *Bitstamp) CancelOrder(order *exchange.OrderCancellation) error
- func (b *Bitstamp) CryptoWithdrawal(amount float64, address, symbol, destTag string, instant bool) (CryptoWithdrawalResponse, error)
- func (b *Bitstamp) GetAccountInfo() (exchange.AccountInfo, error)
- func (b *Bitstamp) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (b *Bitstamp) GetBalance() (*Balances, error)
- func (b *Bitstamp) GetCryptoDepositAddress(crypto currency.Code) (string, error)
- func (b *Bitstamp) GetDepositAddress(cryptocurrency currency.Code, _ string) (string, error)
- func (b *Bitstamp) GetEURUSDConversionRate() (EURUSDConversionRate, error)
- func (b *Bitstamp) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
- func (b *Bitstamp) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *Bitstamp) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *Bitstamp) GetFundingHistory() ([]exchange.FundHistory, error)
- func (b *Bitstamp) GetOpenOrders(currencyPair string) ([]Order, error)
- func (b *Bitstamp) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (b *Bitstamp) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
- func (b *Bitstamp) GetOrderStatus(orderID int64) (OrderStatus, error)
- func (b *Bitstamp) GetOrderbook(currency string) (Orderbook, error)
- func (b *Bitstamp) GetOrderbookEx(p currency.Pair, assetType string) (orderbook.Base, error)
- func (b *Bitstamp) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
- func (b *Bitstamp) GetTicker(currency string, hourly bool) (Ticker, error)
- func (b *Bitstamp) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)
- func (b *Bitstamp) GetTradingPairs() ([]TradingPair, error)
- func (b *Bitstamp) GetTransactions(currencyPair string, values url.Values) ([]Transactions, error)
- func (b *Bitstamp) GetUnconfirmedBitcoinDeposits() ([]UnconfirmedBTCTransactions, error)
- func (b *Bitstamp) GetUserTransactions(currencyPair string) ([]UserTransactions, error)
- func (b *Bitstamp) GetWebsocket() (*wshandler.Websocket, error)
- func (b *Bitstamp) GetWithdrawalRequests(timedelta int64) ([]WithdrawalRequests, error)
- func (b *Bitstamp) ModifyOrder(action *exchange.ModifyOrder) (string, error)
- func (b *Bitstamp) OpenBankWithdrawal(amount float64, ...) (FIATWithdrawalResponse, error)
- func (b *Bitstamp) OpenInternationalBankWithdrawal(amount float64, ...) (FIATWithdrawalResponse, error)
- func (b *Bitstamp) PlaceOrder(currencyPair string, price, amount float64, buy, market bool) (Order, error)
- func (b *Bitstamp) Run()
- func (b *Bitstamp) SendAuthenticatedHTTPRequest(path string, v2 bool, values url.Values, result interface{}) error
- func (b *Bitstamp) SendHTTPRequest(path string, result interface{}) error
- func (b *Bitstamp) SetDefaults()
- func (b *Bitstamp) Setup(exch *config.ExchangeConfig)
- func (b *Bitstamp) Start(wg *sync.WaitGroup)
- func (b *Bitstamp) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, ...) (exchange.SubmitOrderResponse, error)
- func (b *Bitstamp) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (b *Bitstamp) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (b *Bitstamp) TransferAccountBalance(amount float64, currency, subAccount string, toMain bool) error
- func (b *Bitstamp) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
- func (b *Bitstamp) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (b *Bitstamp) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)
- func (b *Bitstamp) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)
- func (b *Bitstamp) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *Bitstamp) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *Bitstamp) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *Bitstamp) WsConnect() error
- func (b *Bitstamp) WsHandleData()
- type CaptureError
- type CryptoWithdrawalResponse
- type EURUSDConversionRate
- type FIATWithdrawalResponse
- type Order
- type OrderStatus
- type Orderbook
- type OrderbookBase
- type Ticker
- type TradingPair
- type Transactions
- type UnconfirmedBTCTransactions
- type UserTransactions
- type WithdrawalRequests
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balances ¶
type Balances struct { USDBalance float64 `json:"usd_balance,string"` BTCBalance float64 `json:"btc_balance,string"` EURBalance float64 `json:"eur_balance,string"` XRPBalance float64 `json:"xrp_balance,string"` USDReserved float64 `json:"usd_reserved,string"` BTCReserved float64 `json:"btc_reserved,string"` EURReserved float64 `json:"eur_reserved,string"` XRPReserved float64 `json:"xrp_reserved,string"` USDAvailable float64 `json:"usd_available,string"` BTCAvailable float64 `json:"btc_available,string"` EURAvailable float64 `json:"eur_available,string"` XRPAvailable float64 `json:"xrp_available,string"` BTCUSDFee float64 `json:"btcusd_fee,string"` BTCEURFee float64 `json:"btceur_fee,string"` EURUSDFee float64 `json:"eurusd_fee,string"` XRPUSDFee float64 `json:"xrpusd_fee,string"` XRPEURFee float64 `json:"xrpeur_fee,string"` XRPBTCFee float64 `json:"xrpbtc_fee,string"` Fee float64 `json:"fee,string"` }
Balances holds full balance information with the supplied APIKEYS
type Bitstamp ¶
type Bitstamp struct { exchange.Base WebsocketConn *wshandler.WebsocketConnection }
Bitstamp is the overarching type across the bitstamp package
func (*Bitstamp) AuthenticateWebsocket ¶
AuthenticateWebsocket sends an authentication message to the websocket
func (*Bitstamp) CalculateTradingFee ¶
func (b *Bitstamp) CalculateTradingFee(base, quote currency.Code, purchasePrice, amount float64, balances *Balances) float64
CalculateTradingFee returns fee on a currency pair
func (*Bitstamp) CancelAllExistingOrders ¶
CancelAllExistingOrders cancels all open orders on the exchange
func (*Bitstamp) CancelAllOrders ¶
func (b *Bitstamp) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*Bitstamp) CancelExistingOrder ¶
CancelExistingOrder cancels order by ID
func (*Bitstamp) CancelOrder ¶
func (b *Bitstamp) CancelOrder(order *exchange.OrderCancellation) error
CancelOrder cancels an order by its corresponding ID number
func (*Bitstamp) CryptoWithdrawal ¶
func (b *Bitstamp) CryptoWithdrawal(amount float64, address, symbol, destTag string, instant bool) (CryptoWithdrawalResponse, error)
CryptoWithdrawal withdraws a cryptocurrency into a supplied wallet, returns ID amount - The amount you want withdrawn address - The wallet address of the cryptocurrency symbol - the type of crypto ie "ltc", "btc", "eth" destTag - only for XRP default to "" instant - only for bitcoins
func (*Bitstamp) GetAccountInfo ¶
func (b *Bitstamp) GetAccountInfo() (exchange.AccountInfo, error)
GetAccountInfo retrieves balances for all enabled currencies for the Bitstamp exchange
func (*Bitstamp) GetActiveOrders ¶
func (b *Bitstamp) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetActiveOrders retrieves any orders that are active/open
func (*Bitstamp) GetBalance ¶
GetBalance returns full balance of currency held on the exchange
func (*Bitstamp) GetCryptoDepositAddress ¶
GetCryptoDepositAddress returns a depositing address by crypto crypto - example "btc", "ltc", "eth", "xrp" or "bch"
func (*Bitstamp) GetDepositAddress ¶
GetDepositAddress returns a deposit address for a specified currency
func (*Bitstamp) GetEURUSDConversionRate ¶
func (b *Bitstamp) GetEURUSDConversionRate() (EURUSDConversionRate, error)
GetEURUSDConversionRate returns the conversion rate between Euro and USD
func (*Bitstamp) GetExchangeHistory ¶
func (b *Bitstamp) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*Bitstamp) GetFee ¶
func (b *Bitstamp) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*Bitstamp) GetFeeByType ¶
func (b *Bitstamp) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*Bitstamp) GetFundingHistory ¶
func (b *Bitstamp) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*Bitstamp) GetOpenOrders ¶
GetOpenOrders returns all open orders on the exchange
func (*Bitstamp) GetOrderHistory ¶
func (b *Bitstamp) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*Bitstamp) GetOrderInfo ¶
func (b *Bitstamp) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
GetOrderInfo returns information on a current open order
func (*Bitstamp) GetOrderStatus ¶
func (b *Bitstamp) GetOrderStatus(orderID int64) (OrderStatus, error)
GetOrderStatus returns an the status of an order by its ID
func (*Bitstamp) GetOrderbook ¶
GetOrderbook Returns a JSON dictionary with "bids" and "asks". Each is a list of open orders and each order is represented as a list holding the price and the amount.
func (*Bitstamp) GetOrderbookEx ¶
GetOrderbookEx returns the orderbook for a currency pair
func (*Bitstamp) GetSubscriptions ¶
func (b *Bitstamp) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
GetSubscriptions returns a copied list of subscriptions
func (*Bitstamp) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*Bitstamp) GetTradingPairs ¶
func (b *Bitstamp) GetTradingPairs() ([]TradingPair, error)
GetTradingPairs returns a list of trading pairs which Bitstamp currently supports
func (*Bitstamp) GetTransactions ¶
GetTransactions returns transaction information value paramater ["time"] = "minute", "hour", "day" will collate your response into time intervals. Implementation of value in test code.
func (*Bitstamp) GetUnconfirmedBitcoinDeposits ¶
func (b *Bitstamp) GetUnconfirmedBitcoinDeposits() ([]UnconfirmedBTCTransactions, error)
GetUnconfirmedBitcoinDeposits returns unconfirmed transactions
func (*Bitstamp) GetUserTransactions ¶
func (b *Bitstamp) GetUserTransactions(currencyPair string) ([]UserTransactions, error)
GetUserTransactions returns an array of transactions
func (*Bitstamp) GetWebsocket ¶
GetWebsocket returns a pointer to the exchange websocket
func (*Bitstamp) GetWithdrawalRequests ¶
func (b *Bitstamp) GetWithdrawalRequests(timedelta int64) ([]WithdrawalRequests, error)
GetWithdrawalRequests returns withdrawal requests for the account timedelta - positive integer with max value 50000000 which returns requests from number of seconds ago to now.
func (*Bitstamp) ModifyOrder ¶
func (b *Bitstamp) ModifyOrder(action *exchange.ModifyOrder) (string, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*Bitstamp) OpenBankWithdrawal ¶
func (b *Bitstamp) OpenBankWithdrawal(amount float64, currency, name, iban, bic, address, postalCode, city, country, comment, withdrawalType string) (FIATWithdrawalResponse, error)
OpenBankWithdrawal Opens a bank withdrawal request (SEPA or international)
func (*Bitstamp) OpenInternationalBankWithdrawal ¶
func (b *Bitstamp) OpenInternationalBankWithdrawal(amount float64, currency, name, iban, bic, address, postalCode, city, country, bankName, bankAddress, bankPostCode, bankCity, bankCountry, internationalCurrency, comment, withdrawalType string) (FIATWithdrawalResponse, error)
OpenInternationalBankWithdrawal Opens a bank withdrawal request (international)
func (*Bitstamp) PlaceOrder ¶
func (b *Bitstamp) PlaceOrder(currencyPair string, price, amount float64, buy, market bool) (Order, error)
PlaceOrder places an order on the exchange.
func (*Bitstamp) SendAuthenticatedHTTPRequest ¶
func (b *Bitstamp) SendAuthenticatedHTTPRequest(path string, v2 bool, values url.Values, result interface{}) error
SendAuthenticatedHTTPRequest sends an authenticated request
func (*Bitstamp) SendHTTPRequest ¶
SendHTTPRequest sends an unauthenticated HTTP request
func (*Bitstamp) SetDefaults ¶
func (b *Bitstamp) SetDefaults()
SetDefaults sets default for Bitstamp
func (*Bitstamp) Setup ¶
func (b *Bitstamp) Setup(exch *config.ExchangeConfig)
Setup sets configuration values to bitstamp
func (*Bitstamp) SubmitOrder ¶
func (b *Bitstamp) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, _ string) (exchange.SubmitOrderResponse, error)
SubmitOrder submits a new order
func (*Bitstamp) Subscribe ¶
func (b *Bitstamp) Subscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Subscribe sends a websocket message to receive data from the channel
func (*Bitstamp) SubscribeToWebsocketChannels ¶
func (b *Bitstamp) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing
func (*Bitstamp) TransferAccountBalance ¶
func (b *Bitstamp) TransferAccountBalance(amount float64, currency, subAccount string, toMain bool) error
TransferAccountBalance transfers funds from either a main or sub account amount - to transfers currency - which currency to transfer subaccount - name of account toMain - bool either to or from account
func (*Bitstamp) Unsubscribe ¶
func (b *Bitstamp) Unsubscribe(channelToSubscribe wshandler.WebsocketChannelSubscription) error
Unsubscribe sends a websocket message to stop receiving data from the channel
func (*Bitstamp) UnsubscribeToWebsocketChannels ¶
func (b *Bitstamp) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing
func (*Bitstamp) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*Bitstamp) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*Bitstamp) WithdrawCryptocurrencyFunds ¶
func (b *Bitstamp) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*Bitstamp) WithdrawFiatFunds ¶
func (b *Bitstamp) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*Bitstamp) WithdrawFiatFundsToInternationalBank ¶
func (b *Bitstamp) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
func (*Bitstamp) WsHandleData ¶
func (b *Bitstamp) WsHandleData()
WsHandleData handles websocket data from WsReadData
type CaptureError ¶
type CaptureError struct { Status interface{} `json:"status"` Reason interface{} `json:"reason"` Code interface{} `json:"code"` Error interface{} `json:"error"` }
CaptureError is used to capture unmarshalled errors
type CryptoWithdrawalResponse ¶
type CryptoWithdrawalResponse struct { ID string `json:"id"` Error map[string][]string `json:"error"` }
CryptoWithdrawalResponse response from a crypto withdrawal request
type EURUSDConversionRate ¶
type EURUSDConversionRate struct { Buy float64 `json:"buy,string"` Sell float64 `json:"sell,string"` }
EURUSDConversionRate holds buy sell conversion rate information
type FIATWithdrawalResponse ¶
type FIATWithdrawalResponse struct { ID string `json:"id"` Status string `json:"status"` Reason map[string][]string `json:"reason"` }
FIATWithdrawalResponse response from a fiat withdrawal request
type Order ¶
type Order struct { ID int64 `json:"id"` Date int64 `json:"datetime"` Type int `json:"type"` Price float64 `json:"price"` Amount float64 `json:"amount"` Currency string `json:"currency_pair"` }
Order holds current open order data
type OrderStatus ¶
type OrderStatus struct { Status string Transactions []struct { TradeID int64 `json:"tid"` USD float64 `json:"usd,string"` Price float64 `json:"price,string"` Fee float64 `json:"fee,string"` BTC float64 `json:"btc,string"` } }
OrderStatus holds order status information
type Orderbook ¶
type Orderbook struct { Timestamp int64 `json:"timestamp,string"` Bids []OrderbookBase Asks []OrderbookBase }
Orderbook holds orderbook information
type OrderbookBase ¶
OrderbookBase holds singular price information
type Ticker ¶
type Ticker struct { Last float64 `json:"last,string"` High float64 `json:"high,string"` Low float64 `json:"low,string"` Vwap float64 `json:"vwap,string"` Volume float64 `json:"volume,string"` Bid float64 `json:"bid,string"` Ask float64 `json:"ask,string"` Timestamp int64 `json:"timestamp,string"` Open float64 `json:"open,string"` }
Ticker holds ticker information
type TradingPair ¶
type TradingPair struct { Name string `json:"name"` URLSymbol string `json:"url_symbol"` BaseDecimals int `json:"base_decimals"` CounterDecimals int `json:"counter_decimals"` MinimumOrder string `json:"minimum_order"` Trading string `json:"trading"` Description string `json:"description"` }
TradingPair holds trading pair information
type Transactions ¶
type Transactions struct { Date int64 `json:"date,string"` TradeID int64 `json:"tid,string"` Price float64 `json:"price,string"` Type int `json:"type,string"` Amount float64 `json:"amount,string"` }
Transactions holds transaction data
type UnconfirmedBTCTransactions ¶
type UnconfirmedBTCTransactions struct { Amount float64 `json:"amount,string"` Address string `json:"address"` Confirmations int `json:"confirmations"` }
UnconfirmedBTCTransactions holds address information about unconfirmed transactions
type UserTransactions ¶
type UserTransactions struct { Date string `json:"datetime"` TransID int64 `json:"id"` Type int `json:"type,string"` USD float64 `json:"usd"` EUR float64 `json:"eur"` BTC float64 `json:"btc"` XRP float64 `json:"xrp"` BTCUSD float64 `json:"btc_usd"` Fee float64 `json:"fee,string"` OrderID int64 `json:"order_id"` }
UserTransactions holds user transaction information
type WithdrawalRequests ¶
type WithdrawalRequests struct { OrderID int64 `json:"id"` Date string `json:"datetime"` Type int `json:"type"` Amount float64 `json:"amount,string"` Status int `json:"status"` Data interface{} Address string `json:"address"` // Bitcoin withdrawals only TransactionID string `json:"transaction_id"` // Bitcoin withdrawals only }
WithdrawalRequests holds request information on withdrawals