btse

package
v0.0.0-...-eb07c7e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: MIT Imports: 17 Imported by: 0

README

GoCryptoTrader Btse Exchange Wrapper

An exchange interface wrapper for the GoCryptoTrader application.

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.

Current Btse Exchange Features

  • REST Support

  • Websocket Support

  • Can be used as a package

Notes

  • Please add notes here with any production issues
  • Please provide link to exchange website and API documentation

Contributors

  • Please add your information
User Github Contribution
AliasGoesHere https://github.com/AliasGoesHere WHAT-YOU-DID

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance []CurrencyBalance

AccountBalance stores an array of currency balances

type BTSE

type BTSE struct {
	exchange.Base
	WebsocketConn *websocket.Conn
	// contains filtered or unexported fields
}

BTSE is the overarching type across this package

func (*BTSE) AuthenticateWebsocket

func (b *BTSE) AuthenticateWebsocket() error

AuthenticateWebsocket sends an authentication message to the websocket

func (*BTSE) CancelAllOrders

func (b *BTSE) CancelAllOrders(orderCancellation *exchange.OrderCancellation) (exchange.CancelAllOrdersResponse, error)

CancelAllOrders cancels all orders associated with a currency pair If product ID is sent, all orders of that specified market will be cancelled If not specified, all orders of all markets will be cancelled

func (*BTSE) CancelExistingOrder

func (b *BTSE) CancelExistingOrder(orderID, productID string) (*CancelOrder, error)

CancelExistingOrder cancels an order

func (*BTSE) CancelOrder

func (b *BTSE) CancelOrder(order *exchange.OrderCancellation) error

CancelOrder cancels an order by its corresponding ID number

func (*BTSE) CancelOrders

func (b *BTSE) CancelOrders(productID string) (*CancelOrder, error)

CancelOrders cancels all orders productID optional. If product ID is sent, all orders of that specified market will be cancelled. If not specified, all orders of all markets will be cancelled

func (*BTSE) CreateOrder

func (b *BTSE) CreateOrder(amount, price float64, side, orderType, symbol, timeInForce, tag string) (*string, error)

CreateOrder creates an order

func (*BTSE) GenerateDefaultSubscriptions

func (b *BTSE) GenerateDefaultSubscriptions()

GenerateDefaultSubscriptions Adds default subscriptions to websocket to be handled by ManageSubscriptions()

func (*BTSE) GetAccountBalance

func (b *BTSE) GetAccountBalance() (*AccountBalance, error)

GetAccountBalance returns the users account balance

func (*BTSE) GetAccountInfo

func (b *BTSE) GetAccountInfo() (exchange.AccountInfo, error)

GetAccountInfo retrieves balances for all enabled currencies for the BTSE exchange

func (*BTSE) GetActiveOrders

func (b *BTSE) GetActiveOrders(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)

GetActiveOrders retrieves any orders that are active/open

func (*BTSE) GetDepositAddress

func (b *BTSE) GetDepositAddress(cryptocurrency currency.Code, accountID string) (string, error)

GetDepositAddress returns a deposit address for a specified currency

func (*BTSE) GetExchangeHistory

func (b *BTSE) GetExchangeHistory(p currency.Pair, assetType string) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data since exchange opening.

func (*BTSE) GetFee

func (b *BTSE) GetFee(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFee returns an estimate of fee based on type of transaction

func (*BTSE) GetFeeByType

func (b *BTSE) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)

GetFeeByType returns an estimate of fee based on type of transaction

func (*BTSE) GetFills

func (b *BTSE) GetFills(orderID, productID, before, after, limit string) (*FilledOrders, error)

GetFills gets all filled orders

func (*BTSE) GetFundingHistory

func (b *BTSE) GetFundingHistory() ([]exchange.FundHistory, error)

GetFundingHistory returns funding history, deposits and withdrawals

func (*BTSE) GetMarketStatistics

func (b *BTSE) GetMarketStatistics(symbol string) (*MarketStatistics, error)

GetMarketStatistics gets market statistics for a specificed market

func (*BTSE) GetMarkets

func (b *BTSE) GetMarkets() (*Markets, error)

GetMarkets returns a list of markets available on BTSE

func (*BTSE) GetOrderHistory

func (b *BTSE) GetOrderHistory(getOrdersRequest *exchange.GetOrdersRequest) ([]exchange.OrderDetail, error)

GetOrderHistory retrieves account order information Can Limit response to specific order status

func (*BTSE) GetOrderInfo

func (b *BTSE) GetOrderInfo(orderID string) (exchange.OrderDetail, error)

GetOrderInfo returns information on a current open order

func (*BTSE) GetOrderbookEx

func (b *BTSE) GetOrderbookEx(p currency.Pair, assetType string) (orderbook.Base, error)

GetOrderbookEx returns orderbook base on the currency pair

func (*BTSE) GetOrders

func (b *BTSE) GetOrders(productID string) (*OpenOrders, error)

GetOrders returns all pending orders

func (*BTSE) GetServerTime

func (b *BTSE) GetServerTime() (*ServerTime, error)

GetServerTime returns the exchanges server time

func (*BTSE) GetSubscriptions

func (b *BTSE) GetSubscriptions() ([]exchange.WebsocketChannelSubscription, error)

GetSubscriptions returns a copied list of subscriptions

func (*BTSE) GetTicker

func (b *BTSE) GetTicker(symbol string) (*Ticker, error)

GetTicker returns the ticker for a specified symbol

func (*BTSE) GetTickerPrice

func (b *BTSE) GetTickerPrice(p currency.Pair, assetType string) (ticker.Price, error)

GetTickerPrice returns the ticker for a currency pair

func (*BTSE) GetTrades

func (b *BTSE) GetTrades(symbol string) (*Trades, error)

GetTrades returns a list of trades for the specified symbol

func (*BTSE) GetWebsocket

func (b *BTSE) GetWebsocket() (*exchange.Websocket, error)

GetWebsocket returns a pointer to the exchange websocket

func (*BTSE) ModifyOrder

func (b *BTSE) ModifyOrder(action *exchange.ModifyOrder) (string, error)

ModifyOrder will allow of changing orderbook placement and limit to market conversion

func (*BTSE) Run

func (b *BTSE) Run()

Run implements the BTSE wrapper

func (*BTSE) SendAuthenticatedHTTPRequest

func (b *BTSE) SendAuthenticatedHTTPRequest(method, endpoint string, req map[string]interface{}, result interface{}) error

SendAuthenticatedHTTPRequest sends an authenticated HTTP request to the desired endpoint

func (*BTSE) SendHTTPRequest

func (b *BTSE) SendHTTPRequest(method, endpoint string, result interface{}) error

SendHTTPRequest sends an HTTP request to the desired endpoint

func (*BTSE) SetDefaults

func (b *BTSE) SetDefaults()

SetDefaults sets the basic defaults for BTSE

func (*BTSE) Setup

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

Setup takes in the supplied exchange configuration details and sets params

func (*BTSE) Start

func (b *BTSE) Start(wg *sync.WaitGroup)

Start starts the BTSE go routine

func (*BTSE) SubmitOrder

func (b *BTSE) SubmitOrder(p currency.Pair, side exchange.OrderSide, orderType exchange.OrderType, amount, price float64, clientID string) (exchange.SubmitOrderResponse, error)

SubmitOrder submits a new order

func (*BTSE) Subscribe

func (b *BTSE) Subscribe(channelToSubscribe exchange.WebsocketChannelSubscription) error

Subscribe sends a websocket message to receive data from the channel

func (*BTSE) SubscribeToWebsocketChannels

func (b *BTSE) SubscribeToWebsocketChannels(channels []exchange.WebsocketChannelSubscription) error

SubscribeToWebsocketChannels appends to ChannelsToSubscribe which lets websocket.manageSubscriptions handle subscribing

func (*BTSE) Unsubscribe

func (b *BTSE) Unsubscribe(channelToSubscribe exchange.WebsocketChannelSubscription) error

Unsubscribe sends a websocket message to stop receiving data from the channel

func (*BTSE) UnsubscribeToWebsocketChannels

func (b *BTSE) UnsubscribeToWebsocketChannels(channels []exchange.WebsocketChannelSubscription) error

UnsubscribeToWebsocketChannels removes from ChannelsToSubscribe which lets websocket.manageSubscriptions handle unsubscribing

func (*BTSE) UpdateOrderbook

func (b *BTSE) UpdateOrderbook(p currency.Pair, assetType string) (orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*BTSE) UpdateTicker

func (b *BTSE) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*BTSE) WithdrawCryptocurrencyFunds

func (b *BTSE) WithdrawCryptocurrencyFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*BTSE) WithdrawFiatFunds

func (b *BTSE) WithdrawFiatFunds(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*BTSE) WithdrawFiatFundsToInternationalBank

func (b *BTSE) WithdrawFiatFundsToInternationalBank(withdrawRequest *exchange.WithdrawRequest) (string, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*BTSE) WsConnect

func (b *BTSE) WsConnect() error

WsConnect connects the websocket client

func (*BTSE) WsHandleData

func (b *BTSE) WsHandleData()

WsHandleData handles read data from websocket connection

func (*BTSE) WsReadData

func (b *BTSE) WsReadData() (exchange.WebsocketResponse, error)

WsReadData reads data from the websocket connection

type CancelOrder

type CancelOrder struct {
	Code int   `json:"code"`
	Time int64 `json:"time"`
}

CancelOrder stores the cancel order response data

type CurrencyBalance

type CurrencyBalance struct {
	Currency  string  `json:"currency"`
	Total     float64 `json:"total,string"`
	Available float64 `json:"available,string"`
}

CurrencyBalance stores the account info data

type FilledOrder

type FilledOrder struct {
	Price     float64 `json:"price"`
	Amount    float64 `json:"amount"`
	Fee       float64 `json:"fee"`
	Side      string  `json:"side"`
	Tag       string  `json:"tag"`
	ID        int64   `json:"id"`
	TradeID   string  `json:"trade_id"`
	ProductID string  `json:"product_id"`
	OrderID   string  `json:"order_id"`
	CreatedAt string  `json:"created_at"`
}

FilledOrder stores filled order data

type FilledOrders

type FilledOrders []FilledOrder

FilledOrders stores an array of filled orders

type Market

type Market struct {
	ID                  string  `json:"id"`
	BaseCurrency        string  `json:"base_currency"`
	QuoteCurrency       string  `json:"quote_currency"`
	BaseMinSize         float64 `json:"base_min_size"`
	BaseMaxSize         float64 `json:"base_max_size"`
	BaseIncremementSize float64 `json:"base_increment_size"`
	QuoteMinPrice       float64 `json:"quote_min_price"`
	QuoteIncrement      float64 `json:"quote_increment"`
	Status              string  `json:"status"`
}

Market stores market data

type MarketStatistics

type MarketStatistics struct {
	Open   float64 `json:"open,string"`
	Low    float64 `json:"low,string"`
	High   float64 `json:"high,string"`
	Close  float64 `json:"close,string"`
	Volume float64 `json:"volume,string"`
	Time   string  `json:"time"`
}

MarketStatistics stores market statistics for a particular product

type Markets

type Markets []Market

Markets stores an array of market data

type OpenOrder

type OpenOrder struct {
	Order
	Status string `json:"status"`
}

OpenOrder stores an open order info

type OpenOrders

type OpenOrders []OpenOrder

OpenOrders stores an array of orders

type Order

type Order struct {
	ID        string  `json:"id"`
	Type      string  `json:"type"`
	Side      string  `json:"side"`
	Price     float64 `json:"price"`
	Amount    float64 `json:"amount"`
	Tag       string  `json:"tag"`
	ProductID string  `json:"product_id"`
	CreatedAt string  `json:"created_at"`
}

Order stores the order info

type ServerTime

type ServerTime struct {
	ISO   string  `json:"iso"`
	Epoch float64 `json:"epoch"`
}

ServerTime stores the server time data

type Ticker

type Ticker struct {
	Price  float64 `json:"price,string"`
	Size   float64 `json:"size,string"`
	Bid    float64 `json:"bid,string"`
	Ask    float64 `json:"ask,string"`
	Volume float64 `json:"volume,string"`
	Time   string  `json:"time"`
}

Ticker stores the ticker data

type Trade

type Trade struct {
	SerialID string  `json:"serial_id"`
	Symbol   string  `json:"symbol"`
	Price    float64 `json:"price"`
	Amount   float64 `json:"amount"`
	Time     string  `json:"time"`
	Type     string  `json:"type"`
}

Trade stores trade data

type Trades

type Trades []Trade

Trades stores an array of trade data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL