bitfinex

package
v0.0.0-...-b8e8dbd Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2018 License: MIT Imports: 17 Imported by: 0

README

GoCryptoTrader package Bitfinex

Build Status Software License GoDoc Coverage Status Go Report Card

This bitfinex 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

Bitfinex 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

This section is empty.

Functions

This section is empty.

Types

type AccountFees

type AccountFees struct {
	Withdraw struct {
		BTC float64 `json:"BTC,string"`
		LTC float64 `json:"LTC,string"`
		ETH float64 `json:"ETH,string"`
		ETC float64 `json:"ETC,string"`
		ZEC float64 `json:"ZEC,string"`
		XMR float64 `json:"XMR,string"`
		DSH float64 `json:"DSH,string"`
		XRP float64 `json:"XRP,string"`
		IOT float64 `json:"IOT"`
		EOS float64 `json:"EOS,string"`
		SAN float64 `json:"SAN,string"`
		OMG float64 `json:"OMG,string"`
		BCH float64 `json:"BCH,string"`
	} `json:"withdraw"`
}

AccountFees stores withdrawal account fee data from Bitfinex

type AccountInfo

type AccountInfo struct {
	MakerFees string `json:"maker_fees"`
	TakerFees string `json:"taker_fees"`
	Fees      []struct {
		Pairs     string `json:"pairs"`
		MakerFees string `json:"maker_fees"`
		TakerFees string `json:"taker_fees"`
	} `json:"fees"`
	Message string `json:"message"`
}

AccountInfo general account information with fees

type AccountInfoFull

type AccountInfoFull struct {
	Info    []AccountInfo
	Message string `json:"message"`
}

AccountInfoFull adds the error message to Account info

type AccountSummary

type AccountSummary struct {
	TradeVolumePer30D []Currency `json:"trade_vol_30d"`
	FundingProfit30D  []Currency `json:"funding_profit_30d"`
	MakerFee          float64    `json:"maker_fee"`
	TakerFee          float64    `json:"taker_fee"`
}

AccountSummary holds account summary data

type Balance

type Balance struct {
	Type      string  `json:"type"`
	Currency  string  `json:"currency"`
	Amount    float64 `json:"amount,string"`
	Available float64 `json:"available,string"`
}

Balance holds current balance data

type BalanceHistory

type BalanceHistory struct {
	Currency    string  `json:"currency"`
	Amount      float64 `json:"amount,string"`
	Balance     float64 `json:"balance,string"`
	Description string  `json:"description"`
	Timestamp   string  `json:"timestamp"`
}

BalanceHistory holds balance history information

type Bitfinex

type Bitfinex struct {
	exchange.Base
	WebsocketConn         *websocket.Conn
	WebsocketSubdChannels map[int]WebsocketChanInfo
}

Bitfinex is the overarching type across the bitfinex package Notes: Bitfinex has added a rate limit to the number of REST requests. Rate limit policy can vary in a range of 10 to 90 requests per minute depending on some factors (e.g. servers load, endpoint, etc.).

func (*Bitfinex) CancelAllExchangeOrders

func (b *Bitfinex) CancelAllExchangeOrders(p pair.CurrencyPair) error

CancelAllExchangeOrders cancels all orders associated with a currency pair

func (*Bitfinex) CancelAllOrders

func (b *Bitfinex) CancelAllOrders() (string, error)

CancelAllOrders cancels all active and open orders

func (*Bitfinex) CancelExchangeOrder

func (b *Bitfinex) CancelExchangeOrder(p pair.CurrencyPair, orderID int64) (int64, error)

CancelExchangeOrder cancels an order by its corresponding ID number

func (*Bitfinex) CancelMultipleOrders

func (b *Bitfinex) CancelMultipleOrders(OrderIDs []int64) (string, error)

CancelMultipleOrders cancels multiple orders

func (*Bitfinex) CancelOffer

func (b *Bitfinex) CancelOffer(OfferID int64) (Offer, error)

CancelOffer cancels offer by offerID

func (*Bitfinex) CancelOrder

func (b *Bitfinex) CancelOrder(OrderID int64) (Order, error)

CancelOrder cancels a single order

func (*Bitfinex) ClaimPosition

func (b *Bitfinex) ClaimPosition(PositionID int) (Position, error)

ClaimPosition allows positions to be claimed

func (*Bitfinex) CloseMarginFunding

func (b *Bitfinex) CloseMarginFunding(SwapID int64) (Offer, error)

CloseMarginFunding closes an unused or used taken fund

func (*Bitfinex) GetAccountBalance

func (b *Bitfinex) GetAccountBalance() ([]Balance, error)

GetAccountBalance returns full wallet balance information

func (*Bitfinex) GetAccountFees

func (b *Bitfinex) GetAccountFees() (AccountFees, error)

GetAccountFees - NOT YET IMPLEMENTED

func (*Bitfinex) GetAccountInfo

func (b *Bitfinex) GetAccountInfo() ([]AccountInfo, error)

GetAccountInfo returns information about your account incl. trading fees

func (*Bitfinex) GetAccountSummary

func (b *Bitfinex) GetAccountSummary() (AccountSummary, error)

GetAccountSummary returns a 30-day summary of your trading volume and return on margin funding

func (*Bitfinex) GetActiveCredits

func (b *Bitfinex) GetActiveCredits() ([]Offer, error)

GetActiveCredits returns all available credits

func (*Bitfinex) GetActiveMarginFunding

func (b *Bitfinex) GetActiveMarginFunding() ([]MarginFunds, error)

GetActiveMarginFunding returns an array of active margin funds

func (*Bitfinex) GetActiveOffers

func (b *Bitfinex) GetActiveOffers() ([]Offer, error)

GetActiveOffers returns all current active offers

func (*Bitfinex) GetActiveOrders

func (b *Bitfinex) GetActiveOrders() ([]Order, error)

GetActiveOrders returns all active orders and statuses

func (*Bitfinex) GetActivePositions

func (b *Bitfinex) GetActivePositions() ([]Position, error)

GetActivePositions returns an array of active positions

func (*Bitfinex) GetBalanceHistory

func (b *Bitfinex) GetBalanceHistory(symbol string, timeSince, timeUntil time.Time, limit int, wallet string) ([]BalanceHistory, error)

GetBalanceHistory returns balance history for the account

func (*Bitfinex) GetExchangeAccountInfo

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

GetExchangeAccountInfo retrieves balances for all enabled currencies on the Bitfinex exchange

func (*Bitfinex) GetExchangeDepositAddress

func (b *Bitfinex) GetExchangeDepositAddress(p pair.CurrencyPair) (string, error)

GetExchangeDepositAddress returns a deposit address for a specified currency

func (*Bitfinex) GetExchangeHistory

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

GetExchangeHistory returns historic trade data since exchange opening.

func (*Bitfinex) GetExchangeOrderInfo

func (b *Bitfinex) GetExchangeOrderInfo(orderID int64) (float64, error)

GetExchangeOrderInfo returns information on a current open order

func (*Bitfinex) GetFundingBook

func (b *Bitfinex) GetFundingBook(symbol string) (FundingBook, error)

GetFundingBook the entire margin funding book for both bids and asks sides per currency string symbol - example "USD"

func (*Bitfinex) GetKeyPermissions

func (b *Bitfinex) GetKeyPermissions() (KeyPermissions, error)

GetKeyPermissions checks the permissions of the key being used to generate this request.

func (*Bitfinex) GetLendbook

func (b *Bitfinex) GetLendbook(symbol string, values url.Values) (Lendbook, error)

GetLendbook returns a list of the most recent funding data for the given currency: total amount provided and Flash Return Rate (in % by 365 days) over time Symbol - example "USD"

func (*Bitfinex) GetLends

func (b *Bitfinex) GetLends(symbol string, values url.Values) ([]Lends, error)

GetLends returns a list of the most recent funding data for the given currency: total amount provided and Flash Return Rate (in % by 365 days) over time Symbol - example "USD"

func (*Bitfinex) GetMarginInfo

func (b *Bitfinex) GetMarginInfo() ([]MarginInfo, error)

GetMarginInfo shows your trading wallet information for margin trading

func (*Bitfinex) GetMarginTotalTakenFunds

func (b *Bitfinex) GetMarginTotalTakenFunds() ([]MarginTotalTakenFunds, error)

GetMarginTotalTakenFunds returns an array of active funding used in a position

func (*Bitfinex) GetMovementHistory

func (b *Bitfinex) GetMovementHistory(symbol, method string, timeSince, timeUntil time.Time, limit int) ([]MovementHistory, error)

GetMovementHistory returns an array of past deposits and withdrawals

func (*Bitfinex) GetOfferStatus

func (b *Bitfinex) GetOfferStatus(OfferID int64) (Offer, error)

GetOfferStatus checks offer status whether it has been cancelled, execute or is still active

func (*Bitfinex) GetOrderStatus

func (b *Bitfinex) GetOrderStatus(OrderID int64) (Order, error)

GetOrderStatus returns order status information

func (*Bitfinex) GetOrderbook

func (b *Bitfinex) GetOrderbook(currencyPair string, values url.Values) (Orderbook, error)

GetOrderbook retieves the orderbook bid and ask price points for a currency pair - By default the response will return 25 bid and 25 ask price points. CurrencyPair - Example "BTCUSD" Values can contain limit amounts for both the asks and bids - Example "limit_bids" = 1000

func (*Bitfinex) GetOrderbookEx

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

GetOrderbookEx returns the orderbook for a currency pair

func (*Bitfinex) GetOrderbookV2

func (b *Bitfinex) GetOrderbookV2(symbol, precision string, values url.Values) (OrderbookV2, error)

GetOrderbookV2 retieves the orderbook bid and ask price points for a currency pair - By default the response will return 25 bid and 25 ask price points. symbol - Example "tBTCUSD" precision - P0,P1,P2,P3,R0 Values can contain limit amounts for both the asks and bids - Example "len" = 1000

func (*Bitfinex) GetPlatformStatus

func (b *Bitfinex) GetPlatformStatus() (int, error)

GetPlatformStatus returns the Bifinex platform status

func (*Bitfinex) GetStats

func (b *Bitfinex) GetStats(symbol string) ([]Stat, error)

GetStats returns various statistics about the requested pair

func (*Bitfinex) GetSymbols

func (b *Bitfinex) GetSymbols() ([]string, error)

GetSymbols returns the available currency pairs on the exchange

func (*Bitfinex) GetSymbolsDetails

func (b *Bitfinex) GetSymbolsDetails() ([]SymbolDetails, error)

GetSymbolsDetails a list of valid symbol IDs and the pair details

func (*Bitfinex) GetTicker

func (b *Bitfinex) GetTicker(symbol string, values url.Values) (Ticker, error)

GetTicker returns ticker information

func (*Bitfinex) GetTickerPrice

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

GetTickerPrice returns the ticker for a currency pair

func (*Bitfinex) GetTickerV2

func (b *Bitfinex) GetTickerV2(symbol string) (Tickerv2, error)

GetTickerV2 returns ticker information

func (*Bitfinex) GetTickersV2

func (b *Bitfinex) GetTickersV2(symbols string) ([]Tickersv2, error)

GetTickersV2 returns ticker information for multiple symbols

func (*Bitfinex) GetTradeHistory

func (b *Bitfinex) GetTradeHistory(currencyPair string, timestamp, until time.Time, limit, reverse int) ([]TradeHistory, error)

GetTradeHistory returns past executed trades

func (*Bitfinex) GetTrades

func (b *Bitfinex) GetTrades(currencyPair string, values url.Values) ([]TradeStructure, error)

GetTrades returns a list of the most recent trades for the given curencyPair By default the response will return 100 trades CurrencyPair - Example "BTCUSD" Values can contain limit amounts for the number of trades returned - Example "limit_trades" = 1000

func (*Bitfinex) GetTradesV2

func (b *Bitfinex) GetTradesV2(currencyPair string, timestampStart, timestampEnd int64, reOrderResp bool) ([]TradeStructureV2, error)

GetTradesV2 uses the V2 API to get historic trades that occurred on the exchange

currencyPair e.g. "tBTCUSD" v2 prefixes currency pairs with t. (?) timestampStart is an int64 unix epoch time timestampEnd is an int64 unix epoch time, make sure this is always there or you will get the most recent trades. reOrderResp reorders the returned data.

func (*Bitfinex) GetUnusedMarginFunds

func (b *Bitfinex) GetUnusedMarginFunds() ([]MarginFunds, error)

GetUnusedMarginFunds returns an array of funding borrowed but not currently used

func (*Bitfinex) ModifyExchangeOrder

func (b *Bitfinex) ModifyExchangeOrder(p pair.CurrencyPair, orderID, action int64) (int64, error)

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

func (*Bitfinex) NewDeposit

func (b *Bitfinex) NewDeposit(method, walletName string, renew int) (DepositResponse, error)

NewDeposit returns a new deposit address Method - Example methods accepted: “bitcoin”, “litecoin”, “ethereum”, “tethers", "ethereumc", "zcash", "monero", "iota", "bcash" WalletName - accepted: “trading”, “exchange”, “deposit” renew - Default is 0. If set to 1, will return a new unused deposit address

func (*Bitfinex) NewOffer

func (b *Bitfinex) NewOffer(symbol string, amount, rate float64, period int64, direction string) (Offer, error)

NewOffer submits a new offer

func (*Bitfinex) NewOrder

func (b *Bitfinex) NewOrder(currencyPair string, amount float64, price float64, buy bool, Type string, hidden bool) (Order, error)

NewOrder submits a new order and returns a order information Major Upgrade needed on this function to include all query params

func (*Bitfinex) NewOrderMulti

func (b *Bitfinex) NewOrderMulti(orders []PlaceOrder) (OrderMultiResponse, error)

NewOrderMulti allows several new orders at once

func (*Bitfinex) ReplaceOrder

func (b *Bitfinex) ReplaceOrder(OrderID int64, Symbol string, Amount float64, Price float64, Buy bool, Type string, Hidden bool) (Order, error)

ReplaceOrder replaces an older order with a new order

func (*Bitfinex) Run

func (b *Bitfinex) Run()

Run implements the Bitfinex wrapper

func (*Bitfinex) SendAuthenticatedHTTPRequest

func (b *Bitfinex) SendAuthenticatedHTTPRequest(method, path string, params map[string]interface{}, result interface{}) error

SendAuthenticatedHTTPRequest sends an autheticated http request and json unmarshals result to a supplied variable

func (*Bitfinex) SendHTTPRequest

func (b *Bitfinex) SendHTTPRequest(path string, result interface{}, verbose bool) error

SendHTTPRequest sends an unauthenticated request

func (*Bitfinex) SetDefaults

func (b *Bitfinex) SetDefaults()

SetDefaults sets the basic defaults for bitfinex

func (*Bitfinex) Setup

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

Setup takes in the supplied exchange configuration details and sets params

func (*Bitfinex) Start

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

Start starts the Bitfinex go routine

func (*Bitfinex) SubmitExchangeOrder

func (b *Bitfinex) SubmitExchangeOrder(p pair.CurrencyPair, side string, orderType int, amount, price float64) (int64, error)

SubmitExchangeOrder submits a new order

func (*Bitfinex) UpdateOrderbook

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

UpdateOrderbook updates and returns the orderbook for a currency pair

func (*Bitfinex) UpdateTicker

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

UpdateTicker updates and returns the ticker for a currency pair

func (*Bitfinex) WalletTransfer

func (b *Bitfinex) WalletTransfer(amount float64, currency, walletFrom, walletTo string) ([]WalletTransfer, error)

WalletTransfer move available balances between your wallets Amount - Amount to move Currency - example "BTC" WalletFrom - example "exchange" WalletTo - example "deposit"

func (*Bitfinex) WebsocketAddSubscriptionChannel

func (b *Bitfinex) WebsocketAddSubscriptionChannel(chanID int, channel, pair string)

WebsocketAddSubscriptionChannel adds a new subscription channel to the WebsocketSubdChannels map in bitfinex.go (Bitfinex struct)

func (*Bitfinex) WebsocketClient

func (b *Bitfinex) WebsocketClient()

WebsocketClient makes a connection with the websocket server

func (*Bitfinex) WebsocketPingHandler

func (b *Bitfinex) WebsocketPingHandler() error

WebsocketPingHandler sends a ping request to the websocket server

func (*Bitfinex) WebsocketSend

func (b *Bitfinex) WebsocketSend(data interface{}) error

WebsocketSend sends data to the websocket server

func (*Bitfinex) WebsocketSendAuth

func (b *Bitfinex) WebsocketSendAuth() error

WebsocketSendAuth sends a autheticated event payload

func (*Bitfinex) WebsocketSendUnauth

func (b *Bitfinex) WebsocketSendUnauth() error

WebsocketSendUnauth sends an unauthenticated payload

func (*Bitfinex) WebsocketSubscribe

func (b *Bitfinex) WebsocketSubscribe(channel string, params map[string]string) error

WebsocketSubscribe subscribes to the websocket channel

func (*Bitfinex) WithdrawExchangeFunds

func (b *Bitfinex) WithdrawExchangeFunds(address string, p pair.CurrencyPair, amount float64) (string, error)

WithdrawExchangeFunds returns a withdrawal ID when a withdrawal is submitted

func (*Bitfinex) Withdrawal

func (b *Bitfinex) Withdrawal(withdrawType, wallet, address string, amount float64) ([]Withdrawal, error)

Withdrawal requests a withdrawal from one of your wallets. Major Upgrade needed on this function to include all query params

type Book

type Book struct {
	Price           float64 `json:"price,string"`
	Rate            float64 `json:"rate,string"`
	Amount          float64 `json:"amount,string"`
	Period          int     `json:"period"`
	Timestamp       string  `json:"timestamp"`
	FlashReturnRate string  `json:"frr"`
}

Book is a generalised sub-type to hold book information

type BookV2

type BookV2 struct {
	Price  float64
	Rate   float64
	Period float64
	Count  int64
	Amount float64
}

BookV2 holds the orderbook item

type Currency

type Currency struct {
	Currency string  `json:"curr"`
	Volume   float64 `json:"vol,string"`
	Amount   float64 `json:"amount,string"`
}

Currency is a sub-type for AccountSummary data

type DepositResponse

type DepositResponse struct {
	Result   string `json:"string"`
	Method   string `json:"method"`
	Currency string `json:"currency"`
	Address  string `json:"address"`
}

DepositResponse holds deposit address information

type ErrorCapture

type ErrorCapture struct {
	Message string `json:"message"`
}

ErrorCapture is a simple type for returned errors from Bitfinex

type Fee

type Fee struct {
	Currency  string
	TakerFees float64
	MakerFees float64
}

Fee holds fee data for a specified currency

type FundingBook

type FundingBook struct {
	Bids    []Book `json:"bids"`
	Asks    []Book `json:"asks"`
	Message string `json:"message"`
}

FundingBook holds current the full margin funding book

type GenericResponse

type GenericResponse struct {
	Result string `json:"result"`
}

GenericResponse holds the result for a generic response

type KeyPermissions

type KeyPermissions struct {
	Account   Permission `json:"account"`
	History   Permission `json:"history"`
	Orders    Permission `json:"orders"`
	Positions Permission `json:"positions"`
	Funding   Permission `json:"funding"`
	Wallets   Permission `json:"wallets"`
	Withdraw  Permission `json:"withdraw"`
}

KeyPermissions holds the key permissions for the API key set

type Lendbook

type Lendbook struct {
	Bids []Book `json:"bids"`
	Asks []Book `json:"asks"`
}

Lendbook holds most recent funding data for a relevant currency

type Lends

type Lends struct {
	Rate       float64 `json:"rate,string"`
	AmountLent float64 `json:"amount_lent,string"`
	AmountUsed float64 `json:"amount_used,string"`
	Timestamp  int64   `json:"timestamp"`
}

Lends holds the lent information by currency

type MarginData

type MarginData struct {
	MarginBalance     float64        `json:"margin_balance,string"`
	TradableBalance   float64        `json:"tradable_balance,string"`
	UnrealizedPL      int64          `json:"unrealized_pl"`
	UnrealizedSwap    int64          `json:"unrealized_swap"`
	NetValue          float64        `json:"net_value,string"`
	RequiredMargin    int64          `json:"required_margin"`
	Leverage          float64        `json:"leverage,string"`
	MarginRequirement float64        `json:"margin_requirement,string"`
	MarginLimits      []MarginLimits `json:"margin_limits"`
}

MarginData holds wallet information for margin trading

type MarginFunds

type MarginFunds struct {
	ID         int64   `json:"id"`
	PositionID int64   `json:"position_id"`
	Currency   string  `json:"currency"`
	Rate       float64 `json:"rate,string"`
	Period     int     `json:"period"`
	Amount     float64 `json:"amount,string"`
	Timestamp  string  `json:"timestamp"`
	AutoClose  bool    `json:"auto_close"`
}

MarginFunds holds active funding information used in a margin position

type MarginInfo

type MarginInfo struct {
	Info    MarginData
	Message string `json:"message"`
}

MarginInfo holds metadata for margin information from bitfinex

type MarginLimits

type MarginLimits struct {
	OnPair            string  `json:"on_pair"`
	InitialMargin     float64 `json:"initial_margin,string"`
	MarginRequirement float64 `json:"margin_requirement,string"`
	TradableBalance   float64 `json:"tradable_balance,string"`
}

MarginLimits holds limit data per pair

type MarginTotalTakenFunds

type MarginTotalTakenFunds struct {
	PositionPair string  `json:"position_pair"`
	TotalSwaps   float64 `json:"total_swaps,string"`
}

MarginTotalTakenFunds holds position funding including sum of active backing as total swaps

type MovementHistory

type MovementHistory struct {
	ID               int64   `json:"id"`
	TxID             int64   `json:"txid"`
	Currency         string  `json:"currency"`
	Method           string  `json:"method"`
	Type             string  `json:"withdrawal"`
	Amount           float64 `json:"amount,string"`
	Description      string  `json:"description"`
	Address          string  `json:"address"`
	Status           string  `json:"status"`
	Timestamp        string  `json:"timestamp"`
	TimestampCreated string  `json:"timestamp_created"`
	Fee              float64 `json:"fee"`
}

MovementHistory holds deposit and withdrawal history data

type Offer

type Offer struct {
	ID              int64   `json:"id"`
	Currency        string  `json:"currency"`
	Rate            float64 `json:"rate,string"`
	Period          int64   `json:"period"`
	Direction       string  `json:"direction"`
	Timestamp       string  `json:"timestamp"`
	Type            string  `json:"type"`
	IsLive          bool    `json:"is_live"`
	IsCancelled     bool    `json:"is_cancelled"`
	OriginalAmount  float64 `json:"original_amount,string"`
	RemainingAmount float64 `json:"remaining_amount,string"`
	ExecutedAmount  float64 `json:"executed_amount,string"`
}

Offer holds offer information

type Order

type Order struct {
	ID                    int64   `json:"id"`
	Symbol                string  `json:"symbol"`
	Exchange              string  `json:"exchange"`
	Price                 float64 `json:"price,string"`
	AverageExecutionPrice float64 `json:"avg_execution_price,string"`
	Side                  string  `json:"side"`
	Type                  string  `json:"type"`
	Timestamp             string  `json:"timestamp"`
	IsLive                bool    `json:"is_live"`
	IsCancelled           bool    `json:"is_cancelled"`
	IsHidden              bool    `json:"is_hidden"`
	WasForced             bool    `json:"was_forced"`
	OriginalAmount        float64 `json:"original_amount,string"`
	RemainingAmount       float64 `json:"remaining_amount,string"`
	ExecutedAmount        float64 `json:"executed_amount,string"`
	OrderID               int64   `json:"order_id"`
}

Order holds order information when an order is in the market

type OrderMultiResponse

type OrderMultiResponse struct {
	Orders []Order `json:"order_ids"`
	Status string  `json:"status"`
}

OrderMultiResponse holds order information on the executed orders

type Orderbook

type Orderbook struct {
	Bids []Book
	Asks []Book
}

Orderbook holds orderbook information from bid and ask sides

type OrderbookV2

type OrderbookV2 struct {
	Bids []BookV2
	Asks []BookV2
}

OrderbookV2 holds orderbook information from bid and ask sides

type Permission

type Permission struct {
	Read  bool `json:"read"`
	Write bool `json:"write"`
}

Permission sub-type for KeyPermissions

type PlaceOrder

type PlaceOrder struct {
	Symbol   string  `json:"symbol"`
	Amount   float64 `json:"amount,string"`
	Price    float64 `json:"price,string"`
	Exchange string  `json:"exchange"`
	Side     string  `json:"side"`
	Type     string  `json:"type"`
}

PlaceOrder is used for order placement

type Position

type Position struct {
	ID        int64   `json:"id"`
	Symbol    string  `json:"string"`
	Status    string  `json:"active"`
	Base      float64 `json:"base,string"`
	Amount    float64 `json:"amount,string"`
	Timestamp string  `json:"timestamp"`
	Swap      float64 `json:"swap,string"`
	PL        float64 `json:"pl,string"`
}

Position holds position information

type Stat

type Stat struct {
	Period int64   `json:"period"`
	Volume float64 `json:"volume,string"`
}

Stat holds individual statistics from exchange

type SymbolDetails

type SymbolDetails struct {
	Pair             string  `json:"pair"`
	PricePrecision   int     `json:"price_precision"`
	InitialMargin    float64 `json:"initial_margin,string"`
	MinimumMargin    float64 `json:"minimum_margin,string"`
	MaximumOrderSize float64 `json:"maximum_order_size,string"`
	MinimumOrderSize float64 `json:"minimum_order_size,string"`
	Expiration       string  `json:"expiration"`
}

SymbolDetails holds currency pair information

type Ticker

type Ticker struct {
	Mid       float64 `json:"mid,string"`
	Bid       float64 `json:"bid,string"`
	Ask       float64 `json:"ask,string"`
	Last      float64 `json:"last_price,string"`
	Low       float64 `json:"low,string"`
	High      float64 `json:"high,string"`
	Volume    float64 `json:"volume,string"`
	Timestamp string  `json:"timestamp"`
	Message   string  `json:"message"`
}

Ticker holds basic ticker information from the exchange

type Tickersv2

type Tickersv2 struct {
	Symbol string
	Tickerv2
}

Tickersv2 holds the version 2 tickers information

type Tickerv2

type Tickerv2 struct {
	FlashReturnRate float64
	Bid             float64
	BidPeriod       int64
	BidSize         float64
	Ask             float64
	AskPeriod       int64
	AskSize         float64
	DailyChange     float64
	DailyChangePerc float64
	Last            float64
	Volume          float64
	High            float64
	Low             float64
}

Tickerv2 holds the version 2 ticker information

type TradeHistory

type TradeHistory struct {
	Price       float64 `json:"price,string"`
	Amount      float64 `json:"amount,string"`
	Timestamp   string  `json:"timestamp"`
	Exchange    string  `json:"exchange"`
	Type        string  `json:"type"`
	FeeCurrency string  `json:"fee_currency"`
	FeeAmount   float64 `json:"fee_amount,string"`
	TID         int64   `json:"tid"`
	OrderID     int64   `json:"order_id"`
}

TradeHistory holds trade history data

type TradeStructure

type TradeStructure struct {
	Timestamp int64   `json:"timestamp"`
	Tid       int64   `json:"tid"`
	Price     float64 `json:"price,string"`
	Amount    float64 `json:"amount,string"`
	Exchange  string  `json:"exchange"`
	Type      string  `json:"sell"`
}

TradeStructure holds executed trade information

type TradeStructureV2

type TradeStructureV2 struct {
	Timestamp int64
	TID       int64
	Price     float64
	Amount    float64
	Exchange  string
	Type      string
}

TradeStructureV2 holds resp information

type WalletTransfer

type WalletTransfer struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

WalletTransfer holds status of wallet to wallet content transfer on exchange

type WebsocketBook

type WebsocketBook struct {
	Price  float64
	Count  int
	Amount float64
}

WebsocketBook holds booking information

type WebsocketChanInfo

type WebsocketChanInfo struct {
	Channel string
	Pair    string
}

WebsocketChanInfo holds websocket channel information

type WebsocketOrder

type WebsocketOrder struct {
	OrderID    int64
	Pair       string
	Amount     float64
	OrigAmount float64
	OrderType  string
	Status     string
	Price      float64
	PriceAvg   float64
	Timestamp  string
	Notify     int
}

WebsocketOrder holds order data

type WebsocketPosition

type WebsocketPosition struct {
	Pair              string
	Status            string
	Amount            float64
	Price             float64
	MarginFunding     float64
	MarginFundingType int
}

WebsocketPosition holds position information

type WebsocketTicker

type WebsocketTicker struct {
	Bid             float64
	BidSize         float64
	Ask             float64
	AskSize         float64
	DailyChange     float64
	DialyChangePerc float64
	LastPrice       float64
	Volume          float64
}

WebsocketTicker holds ticker information

type WebsocketTrade

type WebsocketTrade struct {
	ID        int64
	Timestamp int64
	Price     float64
	Amount    float64
}

WebsocketTrade holds trade information

type WebsocketTradeExecuted

type WebsocketTradeExecuted struct {
	TradeID        int64
	Pair           string
	Timestamp      int64
	OrderID        int64
	AmountExecuted float64
	PriceExecuted  float64
}

WebsocketTradeExecuted holds executed trade data

type WebsocketWallet

type WebsocketWallet struct {
	Name              string
	Currency          string
	Balance           float64
	UnsettledInterest float64
}

WebsocketWallet holds wallet information

type Withdrawal

type Withdrawal struct {
	Status       string `json:"status"`
	Message      string `json:"message"`
	WithdrawalID int64  `json:"withdrawal_id,string"`
}

Withdrawal holds withdrawal status information

Jump to

Keyboard shortcuts

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