btcmarkets

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 31 Imported by: 0

README

GoCryptoTrader package Btcmarkets

Build Status Software License GoDoc Coverage Status Go Report Card

This btcmarkets 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() == "BTCMarkets" {
    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 AccountData

type AccountData struct {
	AssetName string  `json:"assetName"`
	Balance   float64 `json:"balance,string"`
	Available float64 `json:"available,string"`
	Locked    float64 `json:"locked,string"`
}

AccountData stores account data

type AssetData

type AssetData struct {
	AssetName           string  `json:"assetName"`
	MinDepositAmount    float64 `json:"minDepositAmount,string"`
	MaxDepositAmount    float64 `json:"maxDepositAmount,string"`
	DepositDecimals     float64 `json:"depositDecimals,string"`
	MinWithdrawalAmount float64 `json:"minWithdrawalAmount,string"`
	MaxWithdrawalAmount float64 `json:"maxWithdrawalAmount,string"`
	WithdrawalDecimals  float64 `json:"withdrawalDecimals,string"`
	WithdrawalFee       float64 `json:"withdrawalFee,string"`
	DepositFee          float64 `json:"depositFee,string"`
}

AssetData stores data for given asset

type BTCMarkets

type BTCMarkets struct {
	exchange.Base
}

BTCMarkets is the overarching type across the BTCMarkets package

func (*BTCMarkets) BatchPlaceCancelOrders

func (b *BTCMarkets) BatchPlaceCancelOrders(cancelOrders []CancelBatch, placeOrders []PlaceBatch) (BatchPlaceCancelResponse, error)

BatchPlaceCancelOrders places and cancels batch orders

func (*BTCMarkets) CancelAllOpenOrdersByPairs

func (b *BTCMarkets) CancelAllOpenOrdersByPairs(marketIDs []string) ([]CancelOrderResp, error)

CancelAllOpenOrdersByPairs cancels all open orders unless pairs are specified

func (*BTCMarkets) CancelAllOrders

func (b *BTCMarkets) CancelAllOrders(_ *order.Cancel) (order.CancelAllResponse, error)

CancelAllOrders cancels all orders associated with a currency pair

func (*BTCMarkets) CancelBatchOrders

func (b *BTCMarkets) CancelBatchOrders(ids []string) (BatchCancelResponse, error)

CancelBatchOrders cancels given ids

func (*BTCMarkets) CancelOrder

func (b *BTCMarkets) CancelOrder(o *order.Cancel) error

CancelOrder cancels an order by its corresponding ID number

func (*BTCMarkets) CreateNewReport

func (b *BTCMarkets) CreateNewReport(reportType, format string) (CreateReportResp, error)

CreateNewReport creates a new report

func (*BTCMarkets) FetchAccountInfo

func (b *BTCMarkets) FetchAccountInfo() (account.Holdings, error)

FetchAccountInfo retrieves balances for all enabled currencies

func (*BTCMarkets) FetchDepositAddress

func (b *BTCMarkets) FetchDepositAddress(assetName string, before, after, limit int64) (DepositAddress, error)

FetchDepositAddress gets deposit address for the given asset

func (*BTCMarkets) FetchOrder

func (b *BTCMarkets) FetchOrder(id string) (OrderData, error)

FetchOrder finds order based on the provided id

func (*BTCMarkets) FetchOrderbook

func (b *BTCMarkets) FetchOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

FetchOrderbook returns orderbook base on the currency pair

func (*BTCMarkets) FetchTicker

func (b *BTCMarkets) FetchTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)

FetchTicker returns the ticker for a currency pair

func (*BTCMarkets) FetchTradablePairs

func (b *BTCMarkets) FetchTradablePairs(a asset.Item) ([]string, error)

FetchTradablePairs returns a list of the exchanges tradable pairs

func (*BTCMarkets) FormatExchangeKlineInterval

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

FormatExchangeKlineInterval returns Interval to exchange formatted string

func (*BTCMarkets) GetAccountBalance

func (b *BTCMarkets) GetAccountBalance() ([]AccountData, error)

GetAccountBalance returns the full account balance

func (*BTCMarkets) GetActiveOrders

func (b *BTCMarkets) GetActiveOrders(req *order.GetOrdersRequest) ([]order.Detail, error)

GetActiveOrders retrieves any orders that are active/open

func (*BTCMarkets) GetBatchTrades

func (b *BTCMarkets) GetBatchTrades(ids []string) (BatchTradeResponse, error)

GetBatchTrades gets batch trades

func (*BTCMarkets) GetDefaultConfig

func (b *BTCMarkets) GetDefaultConfig() (*config.ExchangeConfig, error)

GetDefaultConfig returns a default exchange config

func (*BTCMarkets) GetDeposit

func (b *BTCMarkets) GetDeposit(id string) (TransferData, error)

GetDeposit gets deposit info for a given ID

func (*BTCMarkets) GetDepositAddress

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

GetDepositAddress returns a deposit address for a specified currency

func (*BTCMarkets) GetExchangeHistory

func (b *BTCMarkets) GetExchangeHistory(p currency.Pair, assetType asset.Item, timestampStart, timestampEnd time.Time) ([]exchange.TradeHistory, error)

GetExchangeHistory returns historic trade data within the timeframe provided.

func (*BTCMarkets) GetFee

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

GetFee returns an estimate of fee based on type of transaction

func (*BTCMarkets) GetFeeByType

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

GetFeeByType returns an estimate of fee based on type of transaction

func (*BTCMarkets) GetFundingHistory

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

GetFundingHistory returns funding history, deposits and withdrawals

func (*BTCMarkets) GetHistoricCandles

func (b *BTCMarkets) GetHistoricCandles(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 (*BTCMarkets) GetHistoricCandlesExtended

func (b *BTCMarkets) GetHistoricCandlesExtended(p 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 (*BTCMarkets) GetMarketCandles

func (b *BTCMarkets) GetMarketCandles(marketID, timeWindow string, from, to time.Time, before, after, limit int64) (out CandleResponse, err error)

GetMarketCandles gets candles for specified currency pair

func (*BTCMarkets) GetMarkets

func (b *BTCMarkets) GetMarkets() ([]Market, error)

GetMarkets returns the BTCMarkets instruments

func (*BTCMarkets) GetMultipleOrderbooks

func (b *BTCMarkets) GetMultipleOrderbooks(marketIDs []string) ([]Orderbook, error)

GetMultipleOrderbooks gets orderbooks

func (*BTCMarkets) GetOrderHistory

func (b *BTCMarkets) GetOrderHistory(req *order.GetOrdersRequest) ([]order.Detail, error)

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

func (*BTCMarkets) GetOrderHistoryById

func (b *BTCMarkets) GetOrderHistoryById(getOrdersRequest string) ([]order.Detail, error)

GetOrderHistoryById retrieves specified closed order information Can Limit response to specific order status

func (*BTCMarkets) GetOrderInfo

func (b *BTCMarkets) GetOrderInfo(orderID string) (order.Detail, error)

GetOrderInfo returns information on a current open order

func (*BTCMarkets) GetOrderbook

func (b *BTCMarkets) GetOrderbook(marketID string, level int64) (Orderbook, error)

GetOrderbook returns current orderbook

func (*BTCMarkets) GetOrders

func (b *BTCMarkets) GetOrders(marketID string, before, after, limit int64, openOnly bool) ([]OrderData, error)

GetOrders returns current order information on the exchange

func (*BTCMarkets) GetReport

func (b *BTCMarkets) GetReport(reportID string) (ReportData, error)

GetReport finds details bout a past report

func (*BTCMarkets) GetServerTime

func (b *BTCMarkets) GetServerTime() (time.Time, error)

GetServerTime gets time from btcmarkets

func (*BTCMarkets) GetTicker

func (b *BTCMarkets) GetTicker(marketID string) (Ticker, error)

GetTicker returns a ticker symbol - example "btc" or "ltc"

func (*BTCMarkets) GetTickers

func (b *BTCMarkets) GetTickers(marketIDs currency.Pairs) ([]Ticker, error)

GetTickers gets multiple tickers

func (*BTCMarkets) GetTradeByID

func (b *BTCMarkets) GetTradeByID(id string) (TradeHistoryData, error)

GetTradeByID returns the singular trade of the ID given

func (*BTCMarkets) GetTradeHistory

func (b *BTCMarkets) GetTradeHistory(marketID, orderID string, before, after, limit int64) ([]TradeHistoryData, error)

GetTradeHistory returns trade history

func (*BTCMarkets) GetTrades

func (b *BTCMarkets) GetTrades(marketID string, before, after, limit int64) ([]Trade, error)

GetTrades returns executed trades on the exchange

func (*BTCMarkets) GetTradingFees

func (b *BTCMarkets) GetTradingFees() (TradingFeeResponse, error)

GetTradingFees returns trading fees for all pairs based on trading activity

func (*BTCMarkets) GetTransactions

func (b *BTCMarkets) GetTransactions(assetName string, before, after, limit int64) ([]TransactionData, error)

GetTransactions gets trading fees

func (*BTCMarkets) GetTransfer

func (b *BTCMarkets) GetTransfer(id string) (TransferData, error)

GetTransfer gets asset transfer info for a given ID

func (*BTCMarkets) GetWithdrawal

func (b *BTCMarkets) GetWithdrawal(id string) (TransferData, error)

GetWithdrawal gets withdrawawl info for a given id

func (*BTCMarkets) GetWithdrawalFees

func (b *BTCMarkets) GetWithdrawalFees() ([]WithdrawalFeeData, error)

GetWithdrawalFees gets withdrawal fees for all assets

func (*BTCMarkets) ListAssets

func (b *BTCMarkets) ListAssets() ([]AssetData, error)

ListAssets lists all available assets

func (*BTCMarkets) ListDeposits

func (b *BTCMarkets) ListDeposits(before, after, limit int64) ([]TransferData, error)

ListDeposits lists the deposit history

func (*BTCMarkets) ListTransfers

func (b *BTCMarkets) ListTransfers(before, after, limit int64) ([]TransferData, error)

ListTransfers lists the past asset transfers

func (*BTCMarkets) ListWithdrawals

func (b *BTCMarkets) ListWithdrawals(before, after, limit int64) ([]TransferData, error)

ListWithdrawals lists the withdrawal history

func (*BTCMarkets) ModifyOrder

func (b *BTCMarkets) ModifyOrder(action *order.Modify) (string, error)

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

func (*BTCMarkets) NewOrder

func (b *BTCMarkets) NewOrder(marketID string, price, amount float64, orderType, side string, triggerPrice,
	targetAmount float64, timeInForce string, postOnly bool, selfTrade, clientOrderID string) (OrderData, error)

NewOrder requests a new order and returns an ID

func (*BTCMarkets) RemoveOrder

func (b *BTCMarkets) RemoveOrder(id string) (CancelOrderResp, error)

RemoveOrder removes a given order

func (*BTCMarkets) RequestWithdraw

func (b *BTCMarkets) RequestWithdraw(assetName string, amount float64,
	toAddress, accountName, accountNumber, bsbNumber, bankName string) (TransferData, error)

RequestWithdraw requests withdrawals

func (*BTCMarkets) Run

func (b *BTCMarkets) Run()

Run implements the BTC Markets wrapper

func (*BTCMarkets) SendAuthenticatedRequest

func (b *BTCMarkets) SendAuthenticatedRequest(method, path string, data, result interface{}, f request.EndpointLimit) (err error)

SendAuthenticatedRequest sends an authenticated HTTP request

func (*BTCMarkets) SendHTTPRequest

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

SendHTTPRequest sends an unauthenticated HTTP request

func (*BTCMarkets) SetDefaults

func (b *BTCMarkets) SetDefaults()

SetDefaults sets basic defaults

func (*BTCMarkets) Setup

func (b *BTCMarkets) Setup(exch *config.ExchangeConfig) error

Setup takes in an exchange configuration and sets all parameters

func (*BTCMarkets) Start

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

Start starts the BTC Markets go routine

func (*BTCMarkets) SubmitOrder

func (b *BTCMarkets) SubmitOrder(s *order.Submit) (order.SubmitResponse, error)

SubmitOrder submits a new order

func (*BTCMarkets) Subscribe

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

Subscribe sends a websocket message to receive data from the channel

func (*BTCMarkets) UpdateAccountInfo

func (b *BTCMarkets) UpdateAccountInfo() (account.Holdings, error)

UpdateAccountInfo retrieves balances for all enabled currencies

func (*BTCMarkets) UpdateOrderbook

func (b *BTCMarkets) UpdateOrderbook(p currency.Pair, assetType asset.Item) (*orderbook.Base, error)

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*BTCMarkets) UpdateTicker

func (b *BTCMarkets) UpdateTicker(p currency.Pair, assetType asset.Item) (*ticker.Price, error)

UpdateTicker updates and returns the ticker for a currency pair

func (*BTCMarkets) UpdateTradablePairs

func (b *BTCMarkets) UpdateTradablePairs(forceUpdate bool) error

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

func (*BTCMarkets) ValidateCredentials

func (b *BTCMarkets) ValidateCredentials() error

ValidateCredentials validates current credentials used for wrapper functionality

func (*BTCMarkets) WithdrawCryptocurrencyFunds

func (b *BTCMarkets) WithdrawCryptocurrencyFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawCryptocurrencyFunds returns a withdrawal ID when a withdrawal is submitted

func (*BTCMarkets) WithdrawFiatFunds

func (b *BTCMarkets) WithdrawFiatFunds(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFunds returns a withdrawal ID when a withdrawal is submitted

func (*BTCMarkets) WithdrawFiatFundsToInternationalBank

func (b *BTCMarkets) WithdrawFiatFundsToInternationalBank(withdrawRequest *withdraw.Request) (*withdraw.ExchangeResponse, error)

WithdrawFiatFundsToInternationalBank returns a withdrawal ID when a withdrawal is submitted

func (*BTCMarkets) WsConnect

func (b *BTCMarkets) WsConnect() error

WsConnect connects to a websocket feed

type BatchCancelResponse

type BatchCancelResponse struct {
	CancelOrders        []CancelOrderResp      `json:"cancelOrders"`
	UnprocessedRequests []UnprocessedBatchResp `json:"unprocessedRequests"`
}

BatchCancelResponse stores the cancellation details from batch cancels

type BatchPlaceCancelResponse

type BatchPlaceCancelResponse struct {
	PlacedOrders      []BatchPlaceData       `json:"placeOrders"`
	CancelledOrders   []CancelOrderResp      `json:"cancelOrders"`
	UnprocessedOrders []UnprocessedBatchResp `json:"unprocessedRequests"`
}

BatchPlaceCancelResponse stores place and cancel batch data

type BatchPlaceData

type BatchPlaceData struct {
	OrderID       string    `json:"orderId"`
	MarketID      string    `json:"marketId"`
	Side          string    `json:"side"`
	Type          string    `json:"type"`
	CreationTime  time.Time `json:"creationTime"`
	Price         float64   `json:"price,string"`
	Amount        float64   `json:"amount,string"`
	OpenAmount    float64   `json:"openAmount,string"`
	Status        string    `json:"status"`
	ClientOrderID string    `json:"clientOrderId"`
}

BatchPlaceData stores data for placed batch orders

type BatchTradeResponse

type BatchTradeResponse struct {
	Orders              []BatchPlaceData       `json:"orders"`
	UnprocessedRequests []UnprocessedBatchResp `json:"unprocessedRequests"`
}

BatchTradeResponse stores the trades from batchtrades

type CancelBatch

type CancelBatch struct {
	OrderID       string `json:"orderId,omitempty"`
	ClientOrderID string `json:"clientOrderId,omitempty"`
}

CancelBatch stores data for batch cancel request

type CancelOrderMethod

type CancelOrderMethod struct {
	CancelOrder CancelBatch `json:"cancelOrder,omitempty"`
}

CancelOrderMethod stores data for Cancel request

type CancelOrderResp

type CancelOrderResp struct {
	OrderID       string `json:"orderId"`
	ClientOrderID string `json:"clientOrderId"`
}

CancelOrderResp stores data for cancelled orders

type CandleResponse

type CandleResponse [][6]string

CandleResponse holds OHLCV data for exchange

type CreateReportResp

type CreateReportResp struct {
	ReportID string `json:"reportId"`
}

CreateReportResp stores data for created report

type DepositAddress

type DepositAddress struct {
	Address   string `json:"address"`
	AssetName string `json:"assetName"`
}

DepositAddress stores deposit address data

type Market

type Market struct {
	MarketID       string  `json:"marketId"`
	BaseAsset      string  `json:"baseAsset"`
	QuoteAsset     string  `json:"quoteAsset"`
	MinOrderAmount float64 `json:"minOrderAmount,string"`
	MaxOrderAmount float64 `json:"maxOrderAmount,string"`
	AmountDecimals int64   `json:"amountDecimals,string"`
	PriceDecimals  int64   `json:"priceDecimals,string"`
}

Market holds a tradable market instrument

type MarketCandle

type MarketCandle struct {
	Time   time.Time
	Open   float64
	Close  float64
	Low    float64
	High   float64
	Volume float64
}

MarketCandle stores candle data for a given pair

type OBData

type OBData struct {
	Price  float64
	Volume float64
}

OBData stores orderbook data

type Order

type Order struct {
	ID              int64           `json:"id"`
	Currency        string          `json:"currency"`
	Instrument      string          `json:"instrument"`
	OrderSide       string          `json:"orderSide"`
	OrderType       string          `json:"ordertype"`
	CreationTime    time.Time       `json:"creationTime"`
	Status          string          `json:"status"`
	ErrorMessage    string          `json:"errorMessage"`
	Price           float64         `json:"price"`
	Volume          float64         `json:"volume"`
	OpenVolume      float64         `json:"openVolume"`
	ClientRequestID string          `json:"clientRequestId"`
	Trades          []TradeResponse `json:"trades"`
}

Order holds order information

type OrderData

type OrderData struct {
	OrderID      string    `json:"orderId"`
	MarketID     string    `json:"marketId"`
	Side         string    `json:"side"`
	Type         string    `json:"type"`
	CreationTime time.Time `json:"creationTime"`
	Price        float64   `json:"price,string"`
	Amount       float64   `json:"amount,string"`
	OpenAmount   float64   `json:"openAmount,string"`
	Status       string    `json:"status"`
}

OrderData stores data for new order created

type OrderToGo

type OrderToGo struct {
	Currency        string `json:"currency"`
	Instrument      string `json:"instrument"`
	Price           int64  `json:"price"`
	Volume          int64  `json:"volume"`
	OrderSide       string `json:"orderSide"`
	OrderType       string `json:"ordertype"`
	ClientRequestID string `json:"clientRequestId"`
}

OrderToGo holds order information to be sent to the exchange

type Orderbook

type Orderbook struct {
	MarketID   string
	SnapshotID int64
	Asks       []OBData
	Bids       []OBData
}

Orderbook holds current orderbook information returned from the exchange

type PaymentDetails

type PaymentDetails struct {
	Address string `json:"address"`
}

PaymentDetails stores payment address

type PlaceBatch

type PlaceBatch struct {
	MarketID      string  `json:"marketId"`
	Price         float64 `json:"price"`
	Amount        float64 `json:"amount"`
	OrderType     string  `json:"type"`
	Side          string  `json:"side"`
	TriggerPrice  float64 `json:"triggerPrice,omitempty"`
	TriggerAmount float64 `json:"triggerAmount,omitempty"`
	TimeInForce   string  `json:"timeInForce,omitempty"`
	PostOnly      bool    `json:"postOnly,omitempty"`
	SelfTrade     string  `json:"selfTrade,omitempty"`
	ClientOrderID string  `json:"clientOrderId,omitempty"`
}

PlaceBatch stores data for place batch request

type PlaceOrderMethod

type PlaceOrderMethod struct {
	PlaceOrder PlaceBatch `json:"placeOrder,omitempty"`
}

PlaceOrderMethod stores data for place request

type RateLimit

type RateLimit struct {
	Auth            *rate.Limiter
	UnAuth          *rate.Limiter
	OrderPlacement  *rate.Limiter
	BatchOrders     *rate.Limiter
	WithdrawRequest *rate.Limiter
	CreateNewReport *rate.Limiter
}

RateLimit implements the request.Limiter interface

func SetRateLimit

func SetRateLimit() *RateLimit

SetRateLimit returns the rate limit for the exchange

func (*RateLimit) Limit

func (r *RateLimit) Limit(f request.EndpointLimit) error

Limit limits the outbound requests

type ReportData

type ReportData struct {
	ID           string    `json:"id"`
	ContentURL   string    `json:"contentUrl"`
	CreationTime time.Time `json:"creationTime"`
	ReportType   string    `json:"reportType"`
	Status       string    `json:"status"`
	Format       string    `json:"format"`
}

ReportData gets data for a created report

type Ticker

type Ticker struct {
	MarketID  string    `json:"marketId"`
	BestBID   float64   `json:"bestBid,string"`
	BestAsk   float64   `json:"bestAsk,string"`
	LastPrice float64   `json:"lastPrice,string"`
	Volume    float64   `json:"volume24h,string"`
	Change24h float64   `json:"price24h,string"`
	Low24h    float64   `json:"low24h,string"`
	High24h   float64   `json:"high24h,string"`
	Timestamp time.Time `json:"timestamp"`
}

Ticker holds ticker information

type TimeResp

type TimeResp struct {
	Time time.Time `json:"timestamp"`
}

TimeResp stores server time

type Trade

type Trade struct {
	TradeID   string    `json:"id"`
	Amount    float64   `json:"amount,string"`
	Price     float64   `json:"price,string"`
	Timestamp time.Time `json:"timestamp"`
	Side      string    `json:"side"`
}

Trade holds trade information

type TradeHistoryData

type TradeHistoryData struct {
	ID            string    `json:"id"`
	MarketID      string    `json:"marketId"`
	Timestamp     time.Time `json:"timestamp"`
	Price         float64   `json:"price,string"`
	Amount        float64   `json:"amount,string"`
	Side          string    `json:"side"`
	Fee           float64   `json:"fee,string"`
	OrderID       string    `json:"orderId"`
	LiquidityType string    `json:"liquidityType"`
}

TradeHistoryData stores data of past trades

type TradeResponse

type TradeResponse struct {
	ID           int64     `json:"id"`
	CreationTime time.Time `json:"creationTime"`
	Description  string    `json:"description"`
	Price        float64   `json:"price"`
	Volume       float64   `json:"volume"`
	Fee          float64   `json:"fee"`
}

TradeResponse holds trade information

type TradingFee

type TradingFee struct {
	Success        bool    `json:"success"`
	ErrorCode      int     `json:"errorCode"`
	ErrorMessage   string  `json:"errorMessage"`
	TradingFeeRate float64 `json:"tradingfeerate"`
	Volume30Day    float64 `json:"volume30day"`
}

TradingFee 30 day trade volume

type TradingFeeData

type TradingFeeData struct {
	MakerFeeRate float64 `json:"makerFeeRate,string"`
	TakerFeeRate float64 `json:"takerFeeRate,string"`
	MarketID     string  `json:"marketId"`
}

TradingFeeData stores trading fee data

type TradingFeeResponse

type TradingFeeResponse struct {
	MonthlyVolume float64          `json:"volume30Day,string"`
	FeeByMarkets  []TradingFeeData `json:"FeeByMarkets"`
}

TradingFeeResponse stores trading fee data

type TransactionData

type TransactionData struct {
	ID           string    `json:"id"`
	CreationTime time.Time `json:"creationTime"`
	Description  string    `json:"description"`
	AssetName    string    `json:"assetName"`
	Amount       float64   `json:"amount,string"`
	Balance      float64   `json:"balance,string"`
	FeeType      string    `json:"type"`
	RecordType   string    `json:"recordType"`
	ReferrenceID string    `json:"referrenceId"`
}

TransactionData stores data from past transactions

type TransferData

type TransferData struct {
	ID             string         `json:"id"`
	AssetName      string         `json:"assetName"`
	Amount         float64        `json:"amount,string"`
	RequestType    string         `json:"type"`
	CreationTime   time.Time      `json:"creationTime"`
	Status         string         `json:"status"`
	Description    string         `json:"description"`
	Fee            float64        `json:"fee,string"`
	LastUpdate     string         `json:"lastUpdate"`
	PaymentDetails PaymentDetails `json:"paymentDetail"`
}

TransferData stores data from asset transfers

type UnprocessedBatchResp

type UnprocessedBatchResp struct {
	Code      string `json:"code"`
	Message   string `json:"message"`
	RequestID string `json:"requestId"`
}

UnprocessedBatchResp stores data for unprocessed response

type WithdrawRequestAUD

type WithdrawRequestAUD struct {
	Amount        int64  `json:"amount"`
	Currency      string `json:"currency"`
	AccountName   string `json:"accountName"`
	AccountNumber string `json:"accountNumber"`
	BankName      string `json:"bankName"`
	BSBNumber     string `json:"bsbNumber"`
}

WithdrawRequestAUD is a generalized withdraw request type

type WithdrawRequestCrypto

type WithdrawRequestCrypto struct {
	Amount   int64  `json:"amount"`
	Currency string `json:"currency"`
	Address  string `json:"address"`
}

WithdrawRequestCrypto is a generalized withdraw request type

type WithdrawalFeeData

type WithdrawalFeeData struct {
	AssetName string  `json:"assetName"`
	Fee       float64 `json:"fee,string"`
}

WithdrawalFeeData stores data for fees

type WsError

type WsError struct {
	MessageType string `json:"messageType"`
	Code        int64  `json:"code"`
	Message     string `json:"message"`
}

WsError stores websocket error data

type WsFundTransfer

type WsFundTransfer struct {
	FundTransferID int64     `json:"fundtransferId"`
	TransferType   string    `json:"type"`
	Status         string    `json:"status"`
	Timestamp      time.Time `json:"timestamp"`
	Amount         float64   `json:"amount,string"`
	Currency       string    `json:"currency"`
	Fee            float64   `json:"fee,string"`
	MessageType    string    `json:"messageType"`
}

WsFundTransfer stores fund transfer data for websocket

type WsMessageType

type WsMessageType struct {
	MessageType string `json:"messageType"`
}

WsMessageType message sent via ws to determine type

type WsOrderChange

type WsOrderChange struct {
	OrderID       int64         `json:"orderId"`
	MarketID      string        `json:"marketId"`
	Side          string        `json:"side"`
	OrderType     string        `json:"type"`
	OpenVolume    float64       `json:"openVolume,string"`
	Status        string        `json:"status"`
	TriggerStatus string        `json:"triggerStatus"`
	Trades        []WsTradeData `json:"trades"`
	Timestamp     time.Time     `json:"timestamp"`
	MessageType   string        `json:"messageType"`
}

WsOrderChange stores order data

type WsOrderbook

type WsOrderbook struct {
	Currency    string          `json:"marketId"`
	Timestamp   time.Time       `json:"timestamp"`
	Bids        [][]interface{} `json:"bids"`
	Asks        [][]interface{} `json:"asks"`
	MessageType string          `json:"messageType"`
	Snapshot    bool            `json:"snapshot"`
}

WsOrderbook message received for orderbook data

type WsSubscribe

type WsSubscribe struct {
	MarketIDs   []string `json:"marketIds,omitempty"`
	Channels    []string `json:"channels,omitempty"`
	Key         string   `json:"key,omitempty"`
	Signature   string   `json:"signature,omitempty"`
	Timestamp   string   `json:"timestamp,omitempty"`
	MessageType string   `json:"messageType,omitempty"`
}

WsSubscribe defines a subscription message used in the Subscribe function

type WsTick

type WsTick struct {
	Currency    string    `json:"marketId"`
	Timestamp   time.Time `json:"timestamp"`
	Bid         float64   `json:"bestBid,string"`
	Ask         float64   `json:"bestAsk,string"`
	Last        float64   `json:"lastPrice,string"`
	Volume      float64   `json:"volume24h,string"`
	Price24h    float64   `json:"price24h,string"`
	Low24h      float64   `json:"low24h,string"`
	High24      float64   `json:"high24h,string"`
	MessageType string    `json:"messageType"`
}

WsTick message received for ticker data

type WsTrade

type WsTrade struct {
	Currency    string    `json:"marketId"`
	Timestamp   time.Time `json:"timestamp"`
	TradeID     int64     `json:"tradeId"`
	Price       float64   `json:"price,string"`
	Volume      float64   `json:"volume,string"`
	Side        string    `json:"side"`
	MessageType string    `json:"messageType"`
}

WsTrade message received for trade data

type WsTradeData

type WsTradeData struct {
	TradeID       int64   `json:"tradeId"`
	Price         float64 `json:"price,string"`
	Volume        float64 `json:"volume,string"`
	Fee           float64 `json:"fee,string"`
	LiquidityType string  `json:"liquidityType"`
}

WsTradeData stores trade data for websocket

Jump to

Keyboard shortcuts

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