btcc

package
v0.0.0-...-8bcfbc3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2018 License: MIT Imports: 16 Imported by: 0

README

GoCryptoTrader package Btcc

Build Status Software License GoDoc Coverage Status Go Report Card

This btcc package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progresss on this Trello board: https://trello.com/b/ZAhMhpOy/gocryptotrader.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

BTCC Exchange

Current Features
  • Initial generation
Please click GoDocs chevron above to view current GoDoc information for this package

Contribution

Please feel free to submit any pull requests or suggest any desired features to be added.

When submitting a PR, please abide by our coding guidelines:

  • Code must adhere to the official Go formatting guidelines (i.e. uses gofmt).
  • Code must be documented adhering to the official Go commentary guidelines.
  • Code must adhere to our coding style.
  • Pull requests need to be based on and opened against the master branch.

Donations

If this framework helped you in any way, or you would like to support the developers working on it, please donate Bitcoin to:

1F5zVDgNjorJ51oGebSvNCrSAHpwGkUdDB

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BTCCSocket *socketio.SocketIO

BTCCSocket is a pointer to a IO socket

Functions

This section is empty.

Types

type BTCC

type BTCC struct {
	exchange.Base
	*request.Handler
}

BTCC is the main overaching type across the BTCC package

func (*BTCC) CancelIcebergOrder

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

CancelIcebergOrder cancels iceberg order

func (*BTCC) CancelOrder

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

CancelOrder cancels an order

func (*BTCC) CancelStopOrder

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

CancelStopOrder cancels a stop order

func (*BTCC) GetAccountInfo

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

GetAccountInfo returns account information

func (*BTCC) GetDeposits

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

GetDeposits returns deposit information

func (*BTCC) GetExchangeAccountInfo

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

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

func (*BTCC) GetExchangeHistory

func (b *BTCC) GetExchangeHistory(p pair.CurrencyPair, assetType string) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data since exchange opening.

func (*BTCC) GetFee

func (b *BTCC) GetFee() float64

GetFee returns the fees associated with transactions

func (*BTCC) GetIcebergOrder

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

GetIcebergOrder returns information on your iceberg order

func (*BTCC) GetIcebergOrders

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

GetIcebergOrders returns information on all iceberg orders

func (*BTCC) GetMarketDepth

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

GetMarketDepth returns market depth at limit

func (*BTCC) GetOrder

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

GetOrder returns information about a specific order

func (*BTCC) GetOrderBook

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

GetOrderBook returns current symbol 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, symbol string, limit, offset, since int64, detailed bool)

GetOrders returns information of a range of orders

func (*BTCC) GetStopOrder

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

GetStopOrder returns a stop order

func (*BTCC) GetStopOrders

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

GetStopOrders returns all stop orders

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) GetTransactions

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

GetTransactions returns transaction lists

func (*BTCC) GetWithdrawal

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

GetWithdrawal returns information about a withdrawal process

func (*BTCC) GetWithdrawals

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

GetWithdrawals gets information about all withdrawals

func (*BTCC) IcebergOrder

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

IcebergOrder intiates a large order but at intervals to preserve orderbook integrity

func (*BTCC) OnConnect

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

OnConnect gets information from the server when its connected

func (*BTCC) OnDisconnect

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

OnDisconnect alerts when disconnection occurs

func (*BTCC) OnError

func (b *BTCC) OnError()

OnError alerts when error occurs

func (*BTCC) OnGroupOrder

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

OnGroupOrder handles group order information

func (*BTCC) OnMessage

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

OnMessage if message received and verbose it is printed out

func (*BTCC) OnTicker

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

OnTicker handles ticker information

func (*BTCC) OnTrade

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

OnTrade handles group trade information

func (*BTCC) PlaceOrder

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

PlaceOrder places a new order

func (*BTCC) PlaceStopOrder

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

PlaceStopOrder inserts a stop loss order

func (*BTCC) RequestWithdrawal

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

RequestWithdrawal requests a new withdrawal

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)

SendAuthenticatedHTTPRequest sends a valid authenticated HTTP request

func (*BTCC) SendHTTPRequest

func (b *BTCC) SendHTTPRequest(path string, result interface{}) error

SendHTTPRequest sends an unauthenticated HTTP request

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()

WebsocketClient initiates a websocket client

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"`
}

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 {
	BidPrice           float64 `json:"BidPrice"`
	AskPrice           float64 `json:"AskPrice"`
	Open               float64 `json:"Open"`
	High               float64 `json:"High"`
	Low                float64 `json:"Low"`
	Last               float64 `json:"Last"`
	LastQuantity       float64 `json:"LastQuantity"`
	PrevCls            float64 `json:"PrevCls"`
	Volume             float64 `json:"Volume"`
	Volume24H          float64 `json:"Volume24H"`
	Timestamp          int64   `json:"Timestamp"`
	ExecutionLimitDown float64 `json:"ExecutionLimitDown"`
	ExecutionLimitUp   float64 `json:"ExecutionLimitUp"`
}

Ticker holds basic ticker information

type Trade

type Trade struct {
	ID        int64   `json:"Id"`
	Timestamp int64   `json:"Timestamp"`
	Price     float64 `json:"Price"`
	Quantity  float64 `json:"Quantity"`
	Side      string  `json:"Side"`
}

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
y or Y : Canonical URL