Documentation ¶
Index ¶
- Variables
- type AccountBalance
- type BTCMarkets
- func (b *BTCMarkets) AuthenticateWebsocket() error
- func (b *BTCMarkets) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
- func (b *BTCMarkets) CancelExistingOrder(orderID []int64) ([]ResponseDetails, error)
- func (b *BTCMarkets) CancelOrder(order *exchange.OrderCancellation) error
- func (b *BTCMarkets) GetAccountBalance() ([]AccountBalance, error)
- func (b *BTCMarkets) GetAccountInfo() (exchange.AccountInfo, error)
- func (b *BTCMarkets) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (b *BTCMarkets) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
- func (b *BTCMarkets) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
- func (b *BTCMarkets) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *BTCMarkets) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
- func (b *BTCMarkets) GetFundingHistory() ([]exchange.FundHistory, error)
- func (b *BTCMarkets) GetMarkets() ([]Market, error)
- func (b *BTCMarkets) GetOpenOrders() ([]Order, error)
- func (b *BTCMarkets) GetOrderDetail(orderID []int64) ([]Order, error)
- func (b *BTCMarkets) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
- func (b *BTCMarkets) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
- func (b *BTCMarkets) GetOrderbook(firstPair, secondPair string) (Orderbook, error)
- func (b *BTCMarkets) GetOrderbookEx(p currency.Pair, assetType string) (orderbook.Base, error)
- func (b *BTCMarkets) GetOrders(currency, instrument string, limit, since int64, historic bool) ([]Order, error)
- func (b *BTCMarkets) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
- func (b *BTCMarkets) GetTicker(firstPair, secondPair string) (Ticker, error)
- func (b *BTCMarkets) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)
- func (b *BTCMarkets) GetTrades(firstPair, secondPair string, values url.Values) ([]Trade, error)
- func (b *BTCMarkets) GetTradingFee(base, quote currency.Code) (TradingFee, error)
- func (b *BTCMarkets) GetWebsocket() (*wshandler.Websocket, error)
- func (b *BTCMarkets) ModifyOrder(action *exchange.ModifyOrder) (string, error)
- func (b *BTCMarkets) NewOrder(currency, instrument string, price, amount float64, ...) (int64, error)
- func (b *BTCMarkets) Run()
- func (b *BTCMarkets) SendAuthenticatedRequest(reqType, path string, data, result interface{}) (err error)
- func (b *BTCMarkets) SendHTTPRequest(path string, result interface{}) error
- func (b *BTCMarkets) SetDefaults()
- func (b *BTCMarkets) Setup(exch *config.ExchangeConfig)
- func (b *BTCMarkets) Start(wg *sync.WaitGroup)
- func (b *BTCMarkets) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, ...) (exchange.SubmitOrderResponse, error)
- func (b *BTCMarkets) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (b *BTCMarkets) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
- func (b *BTCMarkets) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)
- func (b *BTCMarkets) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)
- func (b *BTCMarkets) WithdrawAUD(accountName, accountNumber, bankName, bsbNumber string, amount float64) (string, error)
- func (b *BTCMarkets) WithdrawCrypto(amount float64, currency, address string) (string, error)
- func (b *BTCMarkets) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *BTCMarkets) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
- func (b *BTCMarkets) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
- type Market
- type Order
- type OrderToGo
- type Orderbook
- type Response
- type ResponseDetails
- type Ticker
- type Trade
- type TradeResponse
- type TradingFee
- type WithdrawRequestAUD
- type WithdrawRequestCrypto
Constants ¶
This section is empty.
Variables ¶
var WithdrawalFees = map[currency.Code]float64{ currency.AUD: 0, currency.BTC: 0.001, currency.ETH: 0.001, currency.ETC: 0.001, currency.LTC: 0.0001, currency.XRP: 0.15, currency.BCH: 0.0001, currency.OMG: 0.15, currency.POWR: 5, }
WithdrawalFees the large list of predefined withdrawal fees Prone to change
Functions ¶
This section is empty.
Types ¶
type AccountBalance ¶
type AccountBalance struct { Balance float64 `json:"balance"` PendingFunds float64 `json:"pendingFunds"` Currency string `json:"currency"` }
AccountBalance holds account balance details
type BTCMarkets ¶
BTCMarkets is the overarching type across the BTCMarkets package
func (*BTCMarkets) AuthenticateWebsocket ¶
func (b *BTCMarkets) AuthenticateWebsocket() error
AuthenticateWebsocket sends an authentication message to the websocket
func (*BTCMarkets) CancelAllOrders ¶
func (b *BTCMarkets) CancelAllOrders(_ *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)
CancelAllOrders cancels all orders associated with a currency pair
func (*BTCMarkets) CancelExistingOrder ¶
func (b *BTCMarkets) CancelExistingOrder(orderID []int64) ([]ResponseDetails, error)
CancelExistingOrder cancels an order by its ID orderID - id for order example "1337"
func (*BTCMarkets) CancelOrder ¶
func (b *BTCMarkets) CancelOrder(order *exchange.OrderCancellation) error
CancelOrder cancels an order by its corresponding ID number
func (*BTCMarkets) GetAccountBalance ¶
func (b *BTCMarkets) GetAccountBalance() ([]AccountBalance, error)
GetAccountBalance returns the full account balance
func (*BTCMarkets) GetAccountInfo ¶
func (b *BTCMarkets) GetAccountInfo() (exchange.AccountInfo, error)
GetAccountInfo retrieves balances for all enabled currencies for the BTCMarkets exchange
func (*BTCMarkets) GetActiveOrders ¶
func (b *BTCMarkets) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetActiveOrders retrieves any orders that are active/open
func (*BTCMarkets) GetDepositAddress ¶
func (b *BTCMarkets) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)
GetDepositAddress returns a deposit address for a specified currency
func (*BTCMarkets) GetExchangeHistory ¶
func (b *BTCMarkets) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)
GetExchangeHistory returns historic trade data since exchange opening.
func (*BTCMarkets) GetFee ¶
func (b *BTCMarkets) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFee returns an estimate of fee based on type of transaction
func (*BTCMarkets) GetFeeByType ¶
func (b *BTCMarkets) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
GetFeeByType returns an estimate of fee based on type of transaction
func (*BTCMarkets) GetFundingHistory ¶
func (b *BTCMarkets) GetFundingHistory() ([]exchange.FundHistory, error)
GetFundingHistory returns funding history, deposits and withdrawals
func (*BTCMarkets) GetMarkets ¶
func (b *BTCMarkets) GetMarkets() ([]Market, error)
GetMarkets returns the BTCMarkets instruments
func (*BTCMarkets) GetOpenOrders ¶
func (b *BTCMarkets) GetOpenOrders() ([]Order, error)
GetOpenOrders returns all open orders
func (*BTCMarkets) GetOrderDetail ¶
func (b *BTCMarkets) GetOrderDetail(orderID []int64) ([]Order, error)
GetOrderDetail returns order information an a specific order orderID - example "1337"
func (*BTCMarkets) GetOrderHistory ¶
func (b *BTCMarkets) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)
GetOrderHistory retrieves account order information Can Limit response to specific order status
func (*BTCMarkets) GetOrderInfo ¶
func (b *BTCMarkets) GetOrderInfo(orderID string) (exchange.OrderDetail, error)
GetOrderInfo returns information on a current open order
func (*BTCMarkets) GetOrderbook ¶
func (b *BTCMarkets) GetOrderbook(firstPair, secondPair string) (Orderbook, error)
GetOrderbook returns current orderbook symbol - example "btc" or "ltc"
func (*BTCMarkets) GetOrderbookEx ¶
GetOrderbookEx returns orderbook base on the currency pair
func (*BTCMarkets) GetOrders ¶
func (b *BTCMarkets) GetOrders(currency, instrument string, limit, since int64, historic bool) ([]Order, error)
GetOrders returns current order information on the exchange currency - example "AUD" instrument - example "BTC" limit - example "10" since - since a time example "33434568724" historic - if false just normal Orders open
func (*BTCMarkets) GetSubscriptions ¶
func (b *BTCMarkets) GetSubscriptions() ([]wshandler.WebsocketChannelSubscription, error)
GetSubscriptions returns a copied list of subscriptions
func (*BTCMarkets) GetTicker ¶
func (b *BTCMarkets) GetTicker(firstPair, secondPair string) (Ticker, error)
GetTicker returns a ticker symbol - example "btc" or "ltc"
func (*BTCMarkets) GetTickerPrice ¶
GetTickerPrice returns the ticker for a currency pair
func (*BTCMarkets) GetTrades ¶
GetTrades returns executed trades on the exchange symbol - example "btc" or "ltc" values - optional paramater "since" example values.Set(since, "59868345231")
func (*BTCMarkets) GetTradingFee ¶
func (b *BTCMarkets) GetTradingFee(base, quote currency.Code) (TradingFee, error)
GetTradingFee returns the account's trading fee for a currency pair
func (*BTCMarkets) GetWebsocket ¶
func (b *BTCMarkets) GetWebsocket() (*wshandler.Websocket, error)
GetWebsocket returns a pointer to the exchange websocket
func (*BTCMarkets) ModifyOrder ¶
func (b *BTCMarkets) ModifyOrder(action *exchange.ModifyOrder) (string, error)
ModifyOrder will allow of changing orderbook placement and limit to market conversion
func (*BTCMarkets) NewOrder ¶
func (b *BTCMarkets) NewOrder(currency, instrument string, price, amount float64, orderSide, orderType, clientReq string) (int64, error)
NewOrder requests a new order and returns an ID currency - example "AUD" instrument - example "BTC" price - example 13000000000 (i.e x 100000000) amount - example 100000000 (i.e x 100000000) orderside - example "Bid" or "Ask" orderType - example "limit" clientReq - example "abc-cdf-1000"
func (*BTCMarkets) SendAuthenticatedRequest ¶
func (b *BTCMarkets) SendAuthenticatedRequest(reqType, path string, data, result interface{}) (err error)
SendAuthenticatedRequest sends an authenticated HTTP request
func (*BTCMarkets) SendHTTPRequest ¶
func (b *BTCMarkets) SendHTTPRequest(path string, result interface{}) error
SendHTTPRequest sends an unauthenticated HTTP request
func (*BTCMarkets) Setup ¶
func (b *BTCMarkets) Setup(exch *config.ExchangeConfig)
Setup takes in an exchange configuration and sets all parameters
func (*BTCMarkets) Start ¶
func (b *BTCMarkets) Start(wg *sync.WaitGroup)
Start starts the BTC Markets go routine
func (*BTCMarkets) SubmitOrder ¶
func (b *BTCMarkets) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error)
SubmitOrder submits a new order
func (*BTCMarkets) SubscribeToWebsocketChannels ¶
func (b *BTCMarkets) SubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing
func (*BTCMarkets) UnsubscribeToWebsocketChannels ¶
func (b *BTCMarkets) UnsubscribeToWebsocketChannels(channels []wshandler.WebsocketChannelSubscription) error
UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing
func (*BTCMarkets) UpdateOrderbook ¶
UpdateOrderbook updates and returns the orderbook for a currency pair
func (*BTCMarkets) UpdateTicker ¶
UpdateTicker updates and returns the ticker for a currency pair
func (*BTCMarkets) WithdrawAUD ¶
func (b *BTCMarkets) WithdrawAUD(accountName, accountNumber, bankName, bsbNumber string, amount float64) (string, error)
WithdrawAUD withdraws AUD into a designated bank address Does not return a TxID!
func (*BTCMarkets) WithdrawCrypto ¶
func (b *BTCMarkets) WithdrawCrypto(amount float64, currency, address string) (string, error)
WithdrawCrypto withdraws cryptocurrency into a designated address
func (*BTCMarkets) WithdrawCryptocurrencyFunds ¶
func (b *BTCMarkets) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted
func (*BTCMarkets) WithdrawFiatFunds ¶
func (b *BTCMarkets) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted
func (*BTCMarkets) WithdrawFiatFundsToInternationalBank ¶
func (b *BTCMarkets) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)
WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted
type Order ¶
type Order struct { ID int64 `json:"id"` Currency string `json:"currency"` Instrument string `json:"instrument"` OrderSide string `json:"orderSide"` OrderType string `json:"ordertype"` CreationTime float64 `json:"creationTime"` Status string `json:"status"` ErrorMessage string `json:"errorMessage"` Price float64 `json:"price"` Volume float64 `json:"volume"` OpenVolume float64 `json:"openVolume"` ClientRequestID string `json:"clientRequestId"` Trades []TradeResponse `json:"trades"` }
Order holds order information
type OrderToGo ¶
type OrderToGo struct { Currency string `json:"currency"` Instrument string `json:"instrument"` Price int64 `json:"price"` Volume int64 `json:"volume"` OrderSide string `json:"orderSide"` OrderType string `json:"ordertype"` ClientRequestID string `json:"clientRequestId"` }
OrderToGo holds order information to be sent to the exchange
type Orderbook ¶
type Orderbook struct { Currency string `json:"currency"` Instrument string `json:"instrument"` Timestamp int64 `json:"timestamp"` Asks [][]float64 `json:"asks"` Bids [][]float64 `json:"bids"` }
Orderbook holds current orderbook information returned from the exchange
type Response ¶
type Response struct { Success bool `json:"success"` ErrorCode int `json:"errorCode"` ErrorMessage string `json:"errorMessage"` ID int `json:"id"` Responses []ResponseDetails `json:"responses"` ClientRequestID string `json:"clientRequestId"` Orders []Order `json:"orders"` Status string `json:"status"` }
Response is the genralized response type
type ResponseDetails ¶
type ResponseDetails struct { Success bool `json:"success"` ErrorCode int `json:"errorCode"` ErrorMessage string `json:"errorMessage"` ID int64 `json:"id"` }
ResponseDetails holds order status details
type Ticker ¶
type Ticker struct { BestBID float64 `json:"bestBid"` BestAsk float64 `json:"bestAsk"` LastPrice float64 `json:"lastPrice"` Currency string `json:"currency"` Instrument string `json:"instrument"` Timestamp int64 `json:"timestamp"` Volume float64 `json:"volume24h"` }
Ticker holds ticker information
type Trade ¶
type Trade struct { TradeID int64 `json:"tid"` Amount float64 `json:"amount"` Price float64 `json:"price"` Date int64 `json:"date"` }
Trade holds trade information
type TradeResponse ¶
type TradeResponse struct { ID int64 `json:"id"` CreationTime float64 `json:"creationTime"` Description string `json:"description"` Price float64 `json:"price"` Volume float64 `json:"volume"` Fee float64 `json:"fee"` }
TradeResponse holds trade information
type TradingFee ¶
type TradingFee struct { Success bool `json:"success"` ErrorCode int `json:"errorCode"` ErrorMessage string `json:"errorMessage"` TradingFeeRate float64 `json:"tradingfeerate"` Volume30Day float64 `json:"volume30day"` }
TradingFee 30 day trade volume
type WithdrawRequestAUD ¶
type WithdrawRequestAUD struct { Amount int64 `json:"amount"` Currency string `json:"currency"` AccountName string `json:"accountName"` AccountNumber string `json:"accountNumber"` BankName string `json:"bankName"` BSBNumber string `json:"bsbNumber"` }
WithdrawRequestAUD is a generalized withdraw request type
type WithdrawRequestCrypto ¶
type WithdrawRequestCrypto struct { Amount int64 `json:"amount"` Currency string `json:"currency"` Address string `json:"address"` }
WithdrawRequestCrypto is a generalized withdraw request type