btcc

package
Version: v0.0.0-...-cf2d4bb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BTCC_SOCKETIO_ADDRESS = "https://websocket.btcc.com"
)

Variables

View Source
var BTCCSocket *socketio.SocketIO

Functions

This section is empty.

Types

type BTCC

type BTCC struct {
	exchange.Base
}

BTCC is the main overaching type across the BTCC package

func (*BTCC) CancelIcebergOrder

func (b *BTCC) CancelIcebergOrder(orderID int64, market string)

func (*BTCC) CancelOrder

func (b *BTCC) CancelOrder(orderID int64, market string)

func (*BTCC) CancelStopOrder

func (b *BTCC) CancelStopOrder(orderID int64, market string)

func (*BTCC) GetAccountInfo

func (b *BTCC) GetAccountInfo(infoType string) error

func (*BTCC) GetDeposits

func (b *BTCC) GetDeposits(currency string, pending bool)

func (*BTCC) GetExchangeAccountInfo

func (b *BTCC) GetExchangeAccountInfo() (exchange.AccountInfo, error)

GetExchangeAccountInfo : Retrieves balances for all enabled currencies for the Kraken exchange - TODO

func (*BTCC) GetFee

func (b *BTCC) GetFee() float64

GetFee returns the fees associated with transactions

func (*BTCC) GetIcebergOrder

func (b *BTCC) GetIcebergOrder(orderID int64, market string)

func (*BTCC) GetIcebergOrders

func (b *BTCC) GetIcebergOrders(limit, offset int64, market string)

func (*BTCC) GetMarketDepth

func (b *BTCC) GetMarketDepth(market string, limit int64)

func (*BTCC) GetOrder

func (b *BTCC) GetOrder(orderID int64, market string, detailed bool)

func (*BTCC) GetOrderBook

func (b *BTCC) GetOrderBook(currencyPair string, limit int) (Orderbook, error)

GetOrderBook returns current market order book currencyPair - Example "btccny", "ltccny" or "ltcbtc" limit - limits the returned trades example "10" if 0 will return full orderbook

func (*BTCC) GetOrderbookEx

func (b *BTCC) GetOrderbookEx(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns the orderbook for a currency pair

func (*BTCC) GetOrders

func (b *BTCC) GetOrders(openonly bool, market string, limit, offset, since int64, detailed bool)

func (*BTCC) GetStopOrder

func (b *BTCC) GetStopOrder(orderID int64, market string)

func (*BTCC) GetStopOrders

func (b *BTCC) GetStopOrders(status, orderType string, stopPrice float64, limit, offset int64, market string)

func (*BTCC) GetTicker

func (b *BTCC) GetTicker(currencyPair string) (Ticker, error)

GetTicker returns ticker information currencyPair - Example "btccny", "ltccny" or "ltcbtc"

func (*BTCC) GetTickerPrice

func (b *BTCC) GetTickerPrice(p pair.CurrencyPair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*BTCC) GetTradeHistory

func (b *BTCC) GetTradeHistory(currencyPair string, limit, sinceTid int64, time time.Time) ([]Trade, error)

GetTradeHistory returns trade history data currencyPair - Example "btccny", "ltccny" or "ltcbtc" limit - limits the returned trades example "10" sinceTid - returns trade records starting from id supplied example "5000" time - returns trade records starting from unix time 1406794449

func (*BTCC) GetTradesLast24h

func (b *BTCC) GetTradesLast24h(currencyPair string) ([]Trade, error)

GetTradesLast24h returns the trades executed on the exchange over the past 24 hours by currency pair currencyPair - Example "btccny", "ltccny" or "ltcbtc"

func (*BTCC) GetTransactions

func (b *BTCC) GetTransactions(transType string, limit, offset, since int64, sinceType string)

func (*BTCC) GetWithdrawal

func (b *BTCC) GetWithdrawal(withdrawalID int64, currency string)

func (*BTCC) GetWithdrawals

func (b *BTCC) GetWithdrawals(currency string, pending bool)

func (*BTCC) IcebergOrder

func (b *BTCC) IcebergOrder(buyOrder bool, price, amount, discAmount, variance float64, market string)

func (*BTCC) OnConnect

func (b *BTCC) OnConnect(output chan socketio.Message)

func (*BTCC) OnDisconnect

func (b *BTCC) OnDisconnect(output chan socketio.Message)

func (*BTCC) OnError

func (b *BTCC) OnError()

func (*BTCC) OnGroupOrder

func (b *BTCC) OnGroupOrder(message []byte, output chan socketio.Message)

func (*BTCC) OnMessage

func (b *BTCC) OnMessage(message []byte, output chan socketio.Message)

func (*BTCC) OnTicker

func (b *BTCC) OnTicker(message []byte, output chan socketio.Message)

func (*BTCC) OnTrade

func (b *BTCC) OnTrade(message []byte, output chan socketio.Message)

func (*BTCC) PlaceOrder

func (b *BTCC) PlaceOrder(buyOrder bool, price, amount float64, market string)

func (*BTCC) PlaceStopOrder

func (b *BTCC) PlaceStopOrder(buyOder bool, stopPrice, price, amount, trailingAmt, trailingPct float64, market string)

func (*BTCC) RequestWithdrawal

func (b *BTCC) RequestWithdrawal(currency string, amount float64)

func (*BTCC) Run

func (b *BTCC) Run()

Run implements the BTCC wrapper

func (*BTCC) SendAuthenticatedHTTPRequest

func (b *BTCC) SendAuthenticatedHTTPRequest(method string, params []interface{}) (err error)

func (*BTCC) SetDefaults

func (b *BTCC) SetDefaults()

SetDefaults sets default values for the exchange

func (*BTCC) Setup

func (b *BTCC) Setup(exch config.ExchangeConfig)

Setup is run on startup to setup exchange with config values

func (*BTCC) Start

func (b *BTCC) Start()

Start starts the BTCC go routine

func (*BTCC) UpdateOrderbook

func (b *BTCC) UpdateOrderbook(p pair.CurrencyPair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*BTCC) UpdateTicker

func (b *BTCC) UpdateTicker(p pair.CurrencyPair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*BTCC) WebsocketClient

func (b *BTCC) WebsocketClient()

type BidAsk

type BidAsk struct {
	Price  float64
	Amount float64
}

BidAsk holds bid and ask information

type CurrencyGeneric

type CurrencyGeneric struct {
	Currency      string
	Symbol        string
	Amount        string
	AmountInt     int64   `json:"amount_integer"`
	AmountDecimal float64 `json:"amount_decimal"`
}

CurrencyGeneric holds currency information

type Deposit

type Deposit struct {
	ID       int64
	Address  string
	Currency string
	Amount   float64
	Date     int64
	Status   string
}

Deposit holds deposit address information

type Depth

type Depth struct {
	Bid []BidAsk
	Ask []BidAsk
}

Depth holds order book depth

type IcebergOrder

type IcebergOrder struct {
	ID              int64
	Type            string
	Price           float64
	Market          string
	Amount          float64
	AmountOrig      float64 `json:"amount_original"`
	DisclosedAmount float64 `json:"disclosed_amount"`
	Variance        float64
	Date            int64
	Status          string
}

IcebergOrder holds iceberg lettuce

type Order

type Order struct {
	ID         int64
	Type       string
	Price      float64
	Currency   string
	Amount     float64
	AmountOrig float64 `json:"amount_original"`
	Date       int64
	Status     string
	Detail     OrderDetail
}

Order holds order information

type OrderDetail

type OrderDetail struct {
	Dateline int64
	Price    float64
	Amount   float64
}

OrderDetail holds order detail information

type Orderbook

type Orderbook struct {
	Bids [][]float64 `json:"bids"`
	Asks [][]float64 `json:"asks"`
	Date int64       `json:"date"`
}

Orderbook holds orderbook data

type Profile

type Profile struct {
	Username             string
	TradePasswordEnabled bool    `json:"trade_password_enabled,bool"`
	OTPEnabled           bool    `json:"otp_enabled,bool"`
	TradeFee             float64 `json:"trade_fee"`
	TradeFeeCNYLTC       float64 `json:"trade_fee_cnyltc"`
	TradeFeeBTCLTC       float64 `json:"trade_fee_btcltc"`
	DailyBTCLimit        float64 `json:"daily_btc_limit"`
	DailyLTCLimit        float64 `json:"daily_ltc_limit"`
	BTCDespoitAddress    string  `json:"btc_despoit_address"`
	BTCWithdrawalAddress string  `json:"btc_withdrawal_address"`
	LTCDepositAddress    string  `json:"ltc_deposit_address"`
	LTCWithdrawalAddress string  `json:"ltc_withdrawal_request"`
	APIKeyPermission     int64   `json:"api_key_permission"`
}

Profile holds profile information

type Response

type Response struct {
	Ticker Ticker `json:"ticker"`
	BtcCny Ticker `json:"ticker_btccny"`
	LtcCny Ticker `json:"ticker_ltccny"`
	LtcBtc Ticker `json:"ticker_ltcbtc"`
}

Response is the generalized response type

type StopOrder

type StopOrder struct {
	ID          int64
	Type        string
	StopPrice   float64 `json:"stop_price"`
	TrailingAmt float64 `json:"trailing_amount"`
	TrailingPct float64 `json:"trailing_percentage"`
	Price       float64
	Market      string
	Amount      float64
	Date        int64
	Status      string
	OrderID     int64 `json:"order_id"`
}

StopOrder holds stop order information

type Ticker

type Ticker struct {
	High      float64 `json:"high,string"`
	Low       float64 `json:"low,string"`
	Buy       float64 `json:"buy,string"`
	Sell      float64 `json:"sell,string"`
	Last      float64 `json:"last,string"`
	Vol       float64 `json:"vol,string"`
	Date      int64   `json:"date"`
	Vwap      float64 `json:"vwap,string"`
	PrevClose float64 `json:"prev_close,string"`
	Open      float64 `json:"open,string"`
}

Ticker holds basic ticker information

type Trade

type Trade struct {
	Date   int64   `json:"date,string"`
	Price  float64 `json:"price"`
	Amount float64 `json:"amount"`
	TID    int64   `json:"tid,string"`
	Type   string  `json:"type"`
}

Trade holds executed trade data

type Transaction

type Transaction struct {
	ID        int64
	Type      string
	BTCAmount float64 `json:"btc_amount"`
	LTCAmount float64 `json:"ltc_amount"`
	CNYAmount float64 `json:"cny_amount"`
	Date      int64
}

Transaction holds transaction information

type WebsocketGroupOrder

type WebsocketGroupOrder struct {
	Asks   []WebsocketOrder `json:"ask"`
	Bids   []WebsocketOrder `json:"bid"`
	Market string           `json:"market"`
}

WebsocketGroupOrder holds websocket group order book information

type WebsocketOrder

type WebsocketOrder struct {
	Price       float64 `json:"price"`
	TotalAmount float64 `json:"totalamount"`
	Type        string  `json:"type"`
}

WebsocketOrder holds websocket order information

type WebsocketTicker

type WebsocketTicker struct {
	Buy       float64 `json:"buy"`
	Date      float64 `json:"date"`
	High      float64 `json:"high"`
	Last      float64 `json:"last"`
	Low       float64 `json:"low"`
	Market    string  `json:"market"`
	Open      float64 `json:"open"`
	PrevClose float64 `json:"prev_close"`
	Sell      float64 `json:"sell"`
	Volume    float64 `json:"vol"`
	Vwap      float64 `json:"vwap"`
}

WebsocketTicker holds websocket ticker information

type WebsocketTrade

type WebsocketTrade struct {
	Amount  float64 `json:"amount"`
	Date    float64 `json:"date"`
	Market  string  `json:"market"`
	Price   float64 `json:"price"`
	TradeID float64 `json:"trade_id"`
	Type    string  `json:"type"`
}

WebsocketTrade holds websocket trade information

type Withdrawal

type Withdrawal struct {
	ID          int64
	Address     string
	Currency    string
	Amount      float64
	Date        int64
	Transaction string
	Status      string
}

Withdrawal holds withdrawal transaction information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL