btse

package
v0.0.0-...-83dca6d Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 34 Imported by: 0

README

GoCryptoTrader package Btse

Build Status Software License GoDoc Coverage Status Go Report Card

This btse package is part of the GoCryptoTrader codebase.

This is still in active development

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

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

BTCMarkets Exchange

Current Features
  • REST Support
  • Websocket Support
How to enable
	// Exchanges will be abstracted out in further updates and examples will be
	// supplied then
How to do REST public/private calls
  • If enabled via "configuration".json file the exchange will be added to the IBotExchange array in the go var bot Bot and you will only be able to use the wrapper interface functions for accessing exchange data. View routines.go for an example of integration usage with GoCryptoTrader. Rudimentary example below:

main.go

var b exchange.IBotExchange

for i := range bot.Exchanges {
	if bot.Exchanges[i].GetName() == "BTSE" {
		b = bot.Exchanges[i]
	}
}

// Public calls - wrapper functions

// Fetches current ticker information
tick, err := b.FetchTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.FetchOrderbook()
if err != nil {
	// Handle error
}

// Private calls - wrapper functions - make sure your APIKEY and APISECRET are
// set and AuthenticatedAPISupport is set to true

// Fetches current account information
accountInfo, err := b.GetAccountInfo()
if err != nil {
	// Handle error
}
  • If enabled via individually importing package, rudimentary example below:
// Public calls

// Fetches current ticker information
ticker, err := b.GetTicker()
if err != nil {
	// Handle error
}

// Fetches current orderbook information
ob, err := b.GetOrderBook()
if err != nil {
	// Handle error
}

// Private calls - make sure your APIKEY and APISECRET are set and
// AuthenticatedAPISupport is set to true

// GetUserInfo returns account info
accountInfo, err := b.GetUserInfo(...)
if err != nil {
	// Handle error
}

// Submits an order and the exchange and returns its tradeID
tradeID, err := b.Trade(...)
if err != nil {
	// Handle error
}
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:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountFees

type AccountFees struct {
	MakerFee float64 `json:"makerFee"`
	Symbol   string  `json:"symbol"`
	TakerFee float64 `json:"takerFee"`
}

AccountFees stores fee for each currency pair

type BTSE

type BTSE struct {
	exchange.Base
}

BTSE is the overarching type across this package

func (*BTSE) CancelAllAfter

func (b *BTSE) CancelAllAfter(ctx context.Context, timeout int) error

CancelAllAfter cancels all orders after timeout

func (*BTSE) CancelAllOrders

func (b *BTSE) CancelAllOrders(ctx context.Context, orderCancellation *order.Cancel) (order.CancelAllResponse, 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) CancelBatchOrders

func (b *BTSE) CancelBatchOrders(ctx context.Context, o []order.Cancel) (order.CancelBatchResponse, error)

CancelBatchOrders cancels an orders by their corresponding ID numbers

func (*BTSE) CancelExistingOrder

func (b *BTSE) CancelExistingOrder(ctx context.Context, orderID, symbol, clOrderID string) (CancelOrder, error)

CancelExistingOrder cancels an order

func (*BTSE) CancelOrder

func (b *BTSE) CancelOrder(ctx context.Context, o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*BTSE) CreateOrder

func (b *BTSE) CreateOrder(ctx context.Context, clOrderID string, deviation float64, postOnly bool, price float64, side string, size, stealth, stopPrice float64, symbol, timeInForce string, trailValue, triggerPrice float64, txType, orderType string) ([]Order, error)

CreateOrder creates an order

func (*BTSE) CreateWalletAddress

func (b *BTSE) CreateWalletAddress(ctx context.Context, currency string) (WalletAddress, error)

CreateWalletAddress create new deposit address for requested currency

func (*BTSE) FetchAccountInfo

func (b *BTSE) FetchAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*BTSE) FetchFundingHistory

func (b *BTSE) FetchFundingHistory(ctx context.Context, symbol string) (map[string][]FundingHistoryData, error)

FetchFundingHistory gets funding history

func (*BTSE) FetchOrderBook

func (b *BTSE) FetchOrderBook(ctx context.Context, symbol string, group, limitBids, limitAsks int, spot bool) (*Orderbook, error)

FetchOrderBook gets orderbook data for a given pair

func (*BTSE) FetchOrderBookL2

func (b *BTSE) FetchOrderBookL2(ctx context.Context, symbol string, depth int) (*Orderbook, error)

FetchOrderBookL2 retrieve level 2 orderbook for requested symbol and depth

func (*BTSE) FetchOrderbook

func (b *BTSE) FetchOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*BTSE) FetchTicker

func (b *BTSE) FetchTicker(ctx context.Context, p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*BTSE) FetchTradablePairs

func (b *BTSE) FetchTradablePairs(ctx context.Context, a asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*BTSE) FormatExchangeKlineInterval

func (b *BTSE) FormatExchangeKlineInterval(in kline.Interval) string

FormatExchangeKlineInterval formats kline interval to exchange requested type

func (*BTSE) GenerateDefaultSubscriptions

func (b *BTSE) GenerateDefaultSubscriptions() ([]stream.ChannelSubscription, error)

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

func (*BTSE) GetActiveOrders

func (b *BTSE) GetActiveOrders(ctx context.Context, req *order.GetOrdersRequest) ([]order.Detail, error)

GetActiveOrders retrieves any orders that are active/open

func (*BTSE) GetDefaultConfig

func (b *BTSE) GetDefaultConfig() (*config.Exchange, error)

GetDefaultConfig returns a default exchange config

func (*BTSE) GetDepositAddress

func (b *BTSE) GetDepositAddress(ctx context.Context, c currency.Code, accountID, _ string) (*deposit.Address, error)

GetDepositAddress returns a deposit address for a specified currency

func (*BTSE) GetFee

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

GetFee returns an estimate of fee based on type of transaction

func (*BTSE) GetFeeByType

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

GetFeeByType returns an estimate of fee based on type of transaction

func (*BTSE) GetFeeInformation

func (b *BTSE) GetFeeInformation(ctx context.Context, symbol string) ([]AccountFees, error)

GetFeeInformation retrieve fee's (maker/taker) for requested symbol

func (*BTSE) GetFundingHistory

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

GetFundingHistory returns funding history, deposits and withdrawals

func (*BTSE) GetHistoricCandles

func (b *BTSE) GetHistoricCandles(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandles returns candles between a time period for a set time interval

func (*BTSE) GetHistoricCandlesExtended

func (b *BTSE) GetHistoricCandlesExtended(ctx context.Context, pair currency.Pair, a asset.Item, start, end time.Time, interval kline.Interval) (kline.Item, error)

GetHistoricCandlesExtended returns candles between a time period for a set time interval

func (*BTSE) GetHistoricTrades

func (b *BTSE) GetHistoricTrades(_ context.Context, _ currency.Pair, _ asset.Item, _, _ time.Time) ([]trade.Data, error)

GetHistoricTrades returns historic trade data within the timeframe provided

func (*BTSE) GetMarketSummary

func (b *BTSE) GetMarketSummary(ctx context.Context, symbol string, spot bool) (MarketSummary, error)

GetMarketSummary stores market summary data

func (*BTSE) GetOrderHistory

func (b *BTSE) GetOrderHistory(ctx context.Context, getOrdersRequest *order.GetOrdersRequest) ([]order.Detail, error)

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

func (*BTSE) GetOrderInfo

func (b *BTSE) GetOrderInfo(ctx context.Context, orderID string, pair currency.Pair, assetType asset.Item) (order.Detail, error)

GetOrderInfo returns order information based on order ID

func (*BTSE) GetOrders

func (b *BTSE) GetOrders(ctx context.Context, symbol, orderID, clOrderID string) ([]OpenOrder, error)

GetOrders returns all pending orders

func (*BTSE) GetPrice

func (b *BTSE) GetPrice(ctx context.Context, symbol string) (Price, error)

GetPrice get current price for requested symbol

func (*BTSE) GetRecentTrades

func (b *BTSE) GetRecentTrades(ctx context.Context, p currency.Pair, assetType asset.Item) ([]trade.Data, error)

GetRecentTrades returns the most recent trades for a currency and asset

func (*BTSE) GetServerTime

func (b *BTSE) GetServerTime(ctx context.Context) (*ServerTime, error)

GetServerTime returns the exchanges server time

func (*BTSE) GetTrades

func (b *BTSE) GetTrades(ctx context.Context, symbol string, start, end time.Time, beforeSerialID, afterSerialID, count int, includeOld, spot bool) ([]Trade, error)

GetTrades returns a list of trades for the specified symbol

func (*BTSE) GetWalletAddress

func (b *BTSE) GetWalletAddress(ctx context.Context, currency string) (WalletAddress, error)

GetWalletAddress returns the users account balance

func (*BTSE) GetWalletHistory

func (b *BTSE) GetWalletHistory(ctx context.Context, symbol string, start, end time.Time, count int) (WalletHistory, error)

GetWalletHistory returns the users account balance

func (*BTSE) GetWalletInformation

func (b *BTSE) GetWalletInformation(ctx context.Context) ([]CurrencyBalance, error)

GetWalletInformation returns the users account balance

func (*BTSE) GetWithdrawalsHistory

func (b *BTSE) GetWithdrawalsHistory(ctx context.Context, c currency.Code) (resp []exchange.WithdrawalHistory, err error)

GetWithdrawalsHistory returns previous withdrawals data

func (*BTSE) IndexOrderPeg

func (b *BTSE) IndexOrderPeg(ctx context.Context, clOrderID string, deviation float64, postOnly bool, price float64, side string, size, stealth, stopPrice float64, symbol, timeInForce string, trailValue, triggerPrice float64, txType, orderType string) ([]Order, error)

IndexOrderPeg create peg order that will track a certain percentage above/below the index price

func (*BTSE) ModifyOrder

func (b *BTSE) ModifyOrder(ctx context.Context, action *order.Modify) (order.Modify, error)

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

func (*BTSE) OHLCV

func (b *BTSE) OHLCV(ctx context.Context, symbol string, start, end time.Time, resolution int) (OHLCV, error)

OHLCV retrieve and return OHLCV candle data for requested symbol

func (*BTSE) Run

func (b *BTSE) Run()

Run implements the BTSE wrapper

func (*BTSE) SendAuthenticatedHTTPRequest

func (b *BTSE) SendAuthenticatedHTTPRequest(ctx context.Context, ep exchange.URL, method, endpoint string, isSpot bool, values url.Values, req map[string]interface{}, result interface{}, f request.EndpointLimit) error

SendAuthenticatedHTTPRequest sends an authenticated HTTP request to the desired endpoint

func (*BTSE) SendHTTPRequest

func (b *BTSE) SendHTTPRequest(ctx context.Context, ep exchange.URL, method, endpoint string, result interface{}, spotEndpoint bool, f request.EndpointLimit) 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.Exchange) error

Setup takes in the supplied exchange configuration details and sets params

func (*BTSE) Start

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

Start starts the BTSE go routine

func (*BTSE) SubmitOrder

func (b *BTSE) SubmitOrder(ctx context.Context, s *order.Submit) (order.SubmitResponse, error)

SubmitOrder submits a new order

func (*BTSE) Subscribe

func (b *BTSE) Subscribe(channelsToSubscribe []stream.ChannelSubscription) error

Subscribe sends a websocket message to receive data from the channel

func (*BTSE) TradeHistory

func (b *BTSE) TradeHistory(ctx context.Context, symbol string, start, end time.Time, beforeSerialID, afterSerialID, count int, includeOld bool, clOrderID, orderID string) (TradeHistory, error)

TradeHistory returns previous trades on exchange

func (*BTSE) Unsubscribe

func (b *BTSE) Unsubscribe(channelsToUnsubscribe []stream.ChannelSubscription) error

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

func (*BTSE) UpdateAccountInfo

func (b *BTSE) UpdateAccountInfo(ctx context.Context, assetType asset.Item) (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies for the BTSE exchange

func (*BTSE) UpdateOrderbook

func (b *BTSE) UpdateOrderbook(ctx context.Context, p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*BTSE) UpdateTicker

func (b *BTSE) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*BTSE) UpdateTickers

func (b *BTSE) UpdateTickers(ctx context.Context, a asset.Item) error

UpdateTickers updates the ticker for all currency pairs of a given asset type

func (*BTSE) UpdateTradablePairs

func (b *BTSE) UpdateTradablePairs(ctx context.Context, forceUpdate bool) error

UpdateTradablePairs updates the exchanges available pairs and stores them in the exchanges config

func (*BTSE) ValidateCredentials

func (b *BTSE) ValidateCredentials(ctx context.Context, assetType asset.Item) error

ValidateCredentials validates current credentials used for wrapper functionality

func (*BTSE) WalletWithdrawal

func (b *BTSE) WalletWithdrawal(ctx context.Context, currency, address, tag, amount string) (WithdrawalResponse, error)

WalletWithdrawal submit request to withdraw crypto currency

func (*BTSE) WithdrawCryptocurrencyFunds

func (b *BTSE) WithdrawCryptocurrencyFunds(ctx context.Context, withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*BTSE) WithdrawFiatFunds

func (b *BTSE) WithdrawFiatFunds(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*BTSE) WithdrawFiatFundsToInternationalBank

func (b *BTSE) WithdrawFiatFundsToInternationalBank(_ context.Context, _ *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*BTSE) WsAuthenticate

func (b *BTSE) WsAuthenticate() error

WsAuthenticate Send an authentication message to receive auth data

func (*BTSE) WsConnect

func (b *BTSE) WsConnect() error

WsConnect connects the websocket client

type CancelOrder

type CancelOrder []Order

CancelOrder stores slice of orders

type CurrencyBalance

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

CurrencyBalance stores the account info data

type ErrorResponse

type ErrorResponse struct {
	ErrorCode int    `json:"errorCode"`
	Message   string `json:"message"`
	Status    int    `json:"status"`
}

ErrorResponse contains errors received from API

type FundingHistoryData

type FundingHistoryData struct {
	Time   int64   `json:"time"`
	Rate   float64 `json:"rate"`
	Symbol string  `json:"symbol"`
}

FundingHistoryData stores funding history data

type FuturesMarket

type FuturesMarket struct {
	Symbol              string   `json:"symbol"`
	Last                float64  `json:"last"`
	LowestAsk           float64  `json:"lowestAsk"`
	HighestBid          float64  `json:"highestBid"`
	OpenInterest        float64  `json:"openInterest"`
	OpenInterestUSD     float64  `json:"openInterestUSD"`
	PercentageChange    float64  `json:"percentageChange"`
	Volume              float64  `json:"volume"`
	High24Hr            float64  `json:"high24Hr"`
	Low24Hr             float64  `json:"low24Hr"`
	Base                string   `json:"base"`
	Quote               string   `json:"quote"`
	ContractStart       int64    `json:"contractStart"`
	ContractEnd         int64    `json:"contractEnd"`
	Active              bool     `json:"active"`
	TimeBasedContract   bool     `json:"timeBasedContract"`
	OpenTime            int64    `json:"openTime"`
	CloseTime           int64    `json:"closeTime"`
	StartMatching       int64    `json:"startMatching"`
	InactiveTime        int64    `json:"inactiveTime"`
	FundingRate         float64  `json:"fundingRate"`
	ContractSize        float64  `json:"contractSize"`
	MaxPosition         int64    `json:"maxPosition"`
	MinValidPrice       float64  `json:"minValidPrice"`
	MinPriceIncrement   float64  `json:"minPriceIncrement"`
	MinOrderSize        int32    `json:"minOrderSize"`
	MaxOrderSize        int32    `json:"maxOrderSize"`
	MinRiskLimit        int32    `json:"minRiskLimit"`
	MaxRiskLimit        int32    `json:"maxRiskLimit"`
	MinSizeIncrement    float64  `json:"minSizeIncrement"`
	AvailableSettlement []string `json:"availableSettlement"`
}

FuturesMarket 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   time.Time `json:"time"`
}

MarketStatistics stores market statistics for a particular product

type MarketSummary

type MarketSummary []struct {
	Symbol              string   `json:"symbol"`
	Last                float64  `json:"last"`
	LowestAsk           float64  `json:"lowestAsk"`
	HighestBid          float64  `json:"highestBid"`
	PercentageChange    float64  `json:"percentageChange"`
	Volume              float64  `json:"volume"`
	High24Hr            float64  `json:"high24Hr"`
	Low24Hr             float64  `json:"low24Hr"`
	Base                string   `json:"base"`
	Quote               string   `json:"quote"`
	Active              bool     `json:"active"`
	Size                float64  `json:"size"`
	MinValidPrice       float64  `json:"minValidPrice"`
	MinPriceIncrement   float64  `json:"minPriceIncrement"`
	MinOrderSize        float64  `json:"minOrderSize"`
	MaxOrderSize        float64  `json:"maxOrderSize"`
	MinSizeIncrement    float64  `json:"minSizeIncrement"`
	OpenInterest        float64  `json:"openInterest"`
	OpenInterestUSD     float64  `json:"openInterestUSD"`
	ContractStart       int64    `json:"contractStart"`
	ContractEnd         int64    `json:"contractEnd"`
	TimeBasedContract   bool     `json:"timeBasedContract"`
	OpenTime            int64    `json:"openTime"`
	CloseTime           int64    `json:"closeTime"`
	StartMatching       int64    `json:"startMatching"`
	InactiveTime        int64    `json:"inactiveTime"`
	FundingRate         float64  `json:"fundingRate"`
	ContractSize        float64  `json:"contractSize"`
	MaxPosition         int64    `json:"maxPosition"`
	MinRiskLimit        int      `json:"minRiskLimit"`
	MaxRiskLimit        int      `json:"maxRiskLimit"`
	AvailableSettlement []string `json:"availableSettlement"`
	Futures             bool     `json:"futures"`
}

MarketSummary response data

type OHLCV

type OHLCV [][]float64

OHLCV holds Open, High Low, Close, Volume data for set symbol

type OpenOrder

type OpenOrder struct {
	AverageFillPrice             float64 `json:"averageFillPrice"`
	CancelDuration               int64   `json:"cancelDuration"`
	ClOrderID                    string  `json:"clOrderID"`
	FillSize                     float64 `json:"fillSize"`
	FilledSize                   float64 `json:"filledSize"`
	OrderID                      string  `json:"orderID"`
	OrderState                   string  `json:"orderState"`
	OrderType                    int     `json:"orderType"`
	OrderValue                   float64 `json:"orderValue"`
	PegPriceDeviation            float64 `json:"pegPriceDeviation"`
	PegPriceMax                  float64 `json:"pegPriceMax"`
	PegPriceMin                  float64 `json:"pegPriceMin"`
	Price                        float64 `json:"price"`
	Side                         string  `json:"side"`
	Size                         float64 `json:"size"`
	Symbol                       string  `json:"symbol"`
	Timestamp                    int64   `json:"timestamp"`
	TrailValue                   float64 `json:"trailValue"`
	TriggerOrder                 bool    `json:"triggerOrder"`
	TriggerOrderType             int     `json:"triggerOrderType"`
	TriggerOriginalPrice         float64 `json:"triggerOriginalPrice"`
	TriggerPrice                 float64 `json:"triggerPrice"`
	TriggerStopPrice             float64 `json:"triggerStopPrice"`
	TriggerTrailingStopDeviation float64 `json:"triggerTrailingStopDeviation"`
	Triggered                    bool    `json:"triggered"`
}

OpenOrder stores an open order info

type Order

type Order struct {
	AverageFillPrice float64 `json:"averageFillPrice"`
	ClOrderID        string  `json:"clOrderID"`
	Deviation        float64 `json:"deviation"`
	FillSize         float64 `json:"fillSize"`
	Message          string  `json:"message"`
	OrderID          string  `json:"orderID"`
	OrderType        int     `json:"orderType"`
	Price            float64 `json:"price"`
	Side             string  `json:"side"`
	Size             float64 `json:"size"`
	Status           int     `json:"status"`
	Stealth          float64 `json:"stealth"`
	StopPrice        float64 `json:"stopPrice"`
	Symbol           string  `json:"symbol"`
	Timestamp        int64   `json:"timestamp"`
	Trigger          bool    `json:"trigger"`
	TriggerPrice     float64 `json:"triggerPrice"`
}

Order stores information for a single order

type OrderSizeLimit

type OrderSizeLimit struct {
	MinOrderSize     float64
	MaxOrderSize     float64
	MinSizeIncrement float64
}

OrderSizeLimit holds accepted minimum, maximum, and size increment when submitting new orders

func OrderSizeLimits

func OrderSizeLimits(pair string) (limits OrderSizeLimit, found bool)

OrderSizeLimits looks up currency pair in orderSizeLimitMap and returns OrderSizeLimit

type Orderbook

type Orderbook struct {
	BuyQuote  []QuoteData `json:"buyQuote"`
	SellQuote []QuoteData `json:"sellQuote"`
	Symbol    string      `json:"symbol"`
	Timestamp int64       `json:"timestamp"`
}

Orderbook stores orderbook info

type Price

type Price []struct {
	IndexPrice float64 `json:"indexPrice"`
	LastPrice  float64 `json:"lastPrice"`
	MarkPrice  float64 `json:"markPrice"`
	Symbol     string  `json:"symbol"`
}

Price stores last price for requested symbol

type QuoteData

type QuoteData struct {
	Price float64 `json:"price,string"`
	Size  float64 `json:"size,string"`
}

QuoteData stores quote data

type RateLimit

type RateLimit struct {
	Query  *rate.Limiter
	Orders *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

Limit executes rate limiting functionality for exchange

type ServerTime

type ServerTime struct {
	ISO   time.Time `json:"iso"`
	Epoch int64     `json:"epoch"`
}

ServerTime stores the server time data

type SpotMarket

type SpotMarket struct {
	Symbol            string  `json:"symbol"`
	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"`
	BaseIncrementSize float64 `json:"base_increment_size"`
	QuoteMinPrice     float64 `json:"quote_min_price"`
	QuoteIncrement    float64 `json:"quote_increment"`
	Status            string  `json:"status"`
}

SpotMarket stores market 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 int64   `json:"serialId"`
	Symbol   string  `json:"symbol"`
	Price    float64 `json:"price"`
	Amount   float64 `json:"size"`
	Time     int64   `json:"timestamp"`
	Side     string  `json:"side"`
	Type     string  `json:"type"`
}

Trade stores trade data

type TradeHistory

type TradeHistory []struct {
	Base         string  `json:"base"`
	ClOrderID    string  `json:"clOrderID"`
	FeeAmount    float64 `json:"feeAmount"`
	FeeCurrency  string  `json:"feeCurrency"`
	FilledPrice  float64 `json:"filledPrice"`
	FilledSize   float64 `json:"filledSize"`
	OrderID      string  `json:"orderId"`
	OrderType    int     `json:"orderType"`
	Price        float64 `json:"price"`
	Quote        string  `json:"quote"`
	RealizedPnl  float64 `json:"realizedPnl"`
	SerialID     int64   `json:"serialId"`
	Side         string  `json:"side"`
	Size         float64 `json:"size"`
	Symbol       string  `json:"symbol"`
	Timestamp    string  `json:"timestamp"`
	Total        float64 `json:"total"`
	TradeID      string  `json:"tradeId"`
	TriggerPrice float64 `json:"triggerPrice"`
	TriggerType  int     `json:"triggerType"`
	Username     string  `json:"username"`
	Wallet       string  `json:"wallet"`
}

TradeHistory stores user trades for exchange

type WalletAddress

type WalletAddress []struct {
	Address string `json:"address"`
	Created int    `json:"created"`
}

WalletAddress stores address for crypto deposit's

type WalletHistory

type WalletHistory []struct {
	Amount      float64 `json:"amount"`
	Currency    string  `json:"currency"`
	Description string  `json:"description"`
	Fees        float64 `json:"fees"`
	OrderID     string  `json:"orderId"`
	Status      string  `json:"status"`
	Timestamp   int64   `json:"timestamp"`
	Type        string  `json:"type"`
	Username    string  `json:"username"`
	Wallet      string  `json:"wallet"`
}

WalletHistory stores account funding history

type WithdrawalResponse

type WithdrawalResponse struct {
	WithdrawID string `json:"withdraw_id"`
}

WithdrawalResponse response received when submitting a crypto withdrawal request

type WsLoginAcknowledgement

type WsLoginAcknowledgement struct {
	Event   string `json:"event"`
	Success bool   `json:"success"`
}

WsLoginAcknowledgement contains whether authentication was successful

type WsSubscriptionAcknowledgement

type WsSubscriptionAcknowledgement struct {
	Channel []string `json:"channel"`
	Event   string   `json:"event"`
}

WsSubscriptionAcknowledgement contains successful subscription messages

Jump to

Keyboard shortcuts

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