Documentation ¶
Overview ¶
Package btce provides native Go client for interacting with BTC-E Public API v3 and Trading API.
Example usage:
package main import ( "fmt" btc "github.com/onuryilmaz/go-btce" ) func main() { api := btc.API{} ticker, err := api.Public.Ticker([]string{"btc_usd"}) if err == nil { fmt.Printf("BTC buy price: %.3f \n", ticker["btc_usd"].Buy) fmt.Printf("BTC sell price: %.3f \n", ticker["btc_usd"].Sell) } info, err := api.Trade.GetInfoAuth("API_KEY", "API_SECRET") if err == nil { fmt.Printf("BTC amount: %.3f \n", info.Funds["btc"]) } }
Index ¶
- type API
- type AccountInfo
- type ActiveOrder
- type ActiveOrders
- type CancelOrder
- type CreateCoupon
- type Depth
- type DepthItem
- type DepthPair
- type HistoryFilter
- type Info
- type InfoPair
- type OrderInfo
- type OrderInfoItem
- type PublicAPI
- type RedeemCoupon
- type Response
- type Rights
- type Ticker
- type TickerPair
- type TradeAPI
- func (tapi *TradeAPI) ActiveOrders(pair string) (ActiveOrders, error)
- func (tapi *TradeAPI) ActiveOrdersAuth(key string, secret string, pair string) (ActiveOrders, error)
- func (tapi *TradeAPI) Auth(key string, secret string)
- func (tapi *TradeAPI) CancelOrder(orderID string) (CancelOrder, error)
- func (tapi *TradeAPI) CancelOrderAuth(key string, secret string, orderID string) (CancelOrder, error)
- func (tapi *TradeAPI) CreateCoupon(currency string, amount float64) (CreateCoupon, error)
- func (tapi *TradeAPI) CreateCouponAuth(key string, secret string, currency string, amount float64) (CreateCoupon, error)
- func (tapi *TradeAPI) GetInfo() (AccountInfo, error)
- func (tapi *TradeAPI) GetInfoAuth(key string, secret string) (AccountInfo, error)
- func (tapi *TradeAPI) OrderInfo(orderID string) (OrderInfo, error)
- func (tapi *TradeAPI) OrderInfoAuth(key string, secret string, orderID string) (OrderInfo, error)
- func (tapi *TradeAPI) RedeemCoupon(coupon string) (RedeemCoupon, error)
- func (tapi *TradeAPI) RedeemCouponAuth(key string, secret string, coupon string) (RedeemCoupon, error)
- func (tapi *TradeAPI) Trade(pair string, orderType string, rate float64, amount float64) (TradeResponse, error)
- func (tapi *TradeAPI) TradeAuth(key string, secret string, pair string, orderType string, rate float64, ...) (TradeResponse, error)
- func (tapi *TradeAPI) TradeHistory(filter HistoryFilter, pair string) (TradeHistory, error)
- func (tapi *TradeAPI) TradeHistoryAuth(key string, secret string, filter HistoryFilter, pair string) (TradeHistory, error)
- func (tapi *TradeAPI) TransactionHistory(filter HistoryFilter) (TransactionHistory, error)
- func (tapi *TradeAPI) TransactionHistoryAuth(key string, secret string, filter HistoryFilter) (TransactionHistory, error)
- func (tapi *TradeAPI) WithdrawCoin(coinName string, amount float64, address string) (WithdrawCoin, error)
- func (tapi *TradeAPI) WithdrawCoinAuth(key string, secret string, coinName string, amount float64, address string) (WithdrawCoin, error)
- type TradeError
- type TradeHistory
- type TradeHistoryItem
- type TradeItem
- type TradePair
- type TradeResponse
- type Trades
- type TransactionHistory
- type TransactionHistoryItem
- type WithdrawCoin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountInfo ¶
type ActiveOrder ¶
type ActiveOrders ¶
type ActiveOrders map[string]ActiveOrder
type CancelOrder ¶
type CreateCoupon ¶
type HistoryFilter ¶
type OrderInfo ¶
type OrderInfo map[string]OrderInfoItem
type OrderInfoItem ¶
type PublicAPI ¶
type PublicAPI struct{}
PublicAPI provides access to such information as tickers of currency pairs, active orders on different pairs, the latest trades for each pair etc.
func (*PublicAPI) Info ¶
Info provides all the information about currently active pairs, such as the maximum number of digits after the decimal point, the minimum price, the maximum price, the minimum transaction size, whether the pair is hidden, the commission for each pair.
type RedeemCoupon ¶
type Response ¶
type Response struct { Success int `json:"success"` Return json.RawMessage `json:"return"` Error string `json:"error"` }
type Ticker ¶
type Ticker map[string]TickerPair
type TickerPair ¶
type TradeAPI ¶
TradeAPI allows to trade on the exchange and receive information about the account.
To use this API, you need to create an API key. An API key can be created in your Profile in the API Keys section. After creating an API key you’ll receive a key and a secret. Note that the Secret can be received only during the first hour after the creation of the Key. API key information is used for authentication.
func (*TradeAPI) ActiveOrders ¶
func (tapi *TradeAPI) ActiveOrders(pair string) (ActiveOrders, error)
ActiveOrders returns the list of your active orders. To use this method you need a privilege of the info key. If the order disappears from the list, it was either executed or canceled.
func (*TradeAPI) ActiveOrdersAuth ¶
func (tapi *TradeAPI) ActiveOrdersAuth(key string, secret string, pair string) (ActiveOrders, error)
ActiveOrdersAuth provides ActiveOrders capability with authorization
func (*TradeAPI) CancelOrder ¶
func (tapi *TradeAPI) CancelOrder(orderID string) (CancelOrder, error)
CancelOrder provides method used for order cancellation. To use this method you need a privilege of the trade key.
func (*TradeAPI) CancelOrderAuth ¶
func (tapi *TradeAPI) CancelOrderAuth(key string, secret string, orderID string) (CancelOrder, error)
CancelOrderAuth provides CancelOrder capability with authorization
func (*TradeAPI) CreateCoupon ¶
func (tapi *TradeAPI) CreateCoupon(currency string, amount float64) (CreateCoupon, error)
CreateCoupon allows you to create Coupons. In order to use this method, you need the Coupon key privilege.
func (*TradeAPI) CreateCouponAuth ¶
func (tapi *TradeAPI) CreateCouponAuth(key string, secret string, currency string, amount float64) (CreateCoupon, error)
CreateCouponAuth provides CreateCoupon capability with authorization
func (*TradeAPI) GetInfo ¶
func (tapi *TradeAPI) GetInfo() (AccountInfo, error)
GetInfo returns information about the user’s current balance, API-key privileges, the number of open orders and Server Time. To use this method you need a privilege of the key info.
func (*TradeAPI) GetInfoAuth ¶
func (tapi *TradeAPI) GetInfoAuth(key string, secret string) (AccountInfo, error)
GetInfoAuth provides GetInfo capability with authorization
func (*TradeAPI) OrderInfo ¶
OrderInfo provides the information on particular order. To use this method you need a privilege of the info key.
func (*TradeAPI) OrderInfoAuth ¶
OrderInfoAuth provides OrderInfo capability with authorization
func (*TradeAPI) RedeemCoupon ¶
func (tapi *TradeAPI) RedeemCoupon(coupon string) (RedeemCoupon, error)
RedeemCoupon method is used to redeem coupons. In order to use this method, you need the Coupon key privilege.
func (*TradeAPI) RedeemCouponAuth ¶
func (tapi *TradeAPI) RedeemCouponAuth(key string, secret string, coupon string) (RedeemCoupon, error)
RedeemCouponAuth provides RedeemCoupon capability with authorization
func (*TradeAPI) Trade ¶
func (tapi *TradeAPI) Trade(pair string, orderType string, rate float64, amount float64) (TradeResponse, error)
Trade provide method that can be used for creating orders and trading on the exchange. To use this method you need an API key privilege to trade.
You can only create limit orders using this method, but you can emulate market orders using rate parameters. E.g. using rate=0.1 you can sell at the best market price.
Each pair has a different limit on the minimum / maximum amounts, the minimum amount and the number of digits after the decimal point. All limitations can be obtained using the info method in PublicAPI.
func (*TradeAPI) TradeAuth ¶
func (tapi *TradeAPI) TradeAuth(key string, secret string, pair string, orderType string, rate float64, amount float64) (TradeResponse, error)
TradeAuth provides Trade capability with authorization
func (*TradeAPI) TradeHistory ¶
func (tapi *TradeAPI) TradeHistory(filter HistoryFilter, pair string) (TradeHistory, error)
TradeHistory returns trade history. To use this method you need a privilege of the info key.
func (*TradeAPI) TradeHistoryAuth ¶
func (tapi *TradeAPI) TradeHistoryAuth(key string, secret string, filter HistoryFilter, pair string) (TradeHistory, error)
TradeHistoryAuth provides TradeHistory capability with authorization
func (*TradeAPI) TransactionHistory ¶
func (tapi *TradeAPI) TransactionHistory(filter HistoryFilter) (TransactionHistory, error)
TransactionHistory returns the history of transactions. To use this method you need a privilege of the info key.
func (*TradeAPI) TransactionHistoryAuth ¶
func (tapi *TradeAPI) TransactionHistoryAuth(key string, secret string, filter HistoryFilter) (TransactionHistory, error)
TransactionHistoryAuth provides TransactionHistory capability with authorization
func (*TradeAPI) WithdrawCoin ¶
func (tapi *TradeAPI) WithdrawCoin(coinName string, amount float64, address string) (WithdrawCoin, error)
WithdrawCoin provides cryptocurrency withdrawals. You need to have the privilege of the Withdraw key to be able to use this method.
func (*TradeAPI) WithdrawCoinAuth ¶
func (tapi *TradeAPI) WithdrawCoinAuth(key string, secret string, coinName string, amount float64, address string) (WithdrawCoin, error)
WithdrawCoinAuth provides WithdrawCoin capability with authorization
type TradeError ¶
type TradeError struct {
// contains filtered or unexported fields
}
custom error type for server/trading errors
func (TradeError) Error ¶
func (e TradeError) Error() string
type TradeHistory ¶
type TradeHistory map[string]TradeHistoryItem
type TradeHistoryItem ¶
type TradeResponse ¶
type TransactionHistory ¶
type TransactionHistory map[string]TransactionHistoryItem