Documentation ¶
Index ¶
- Constants
- func CheckResponse(r *http.Response) error
- type AccountBalance
- type AccountData
- type AccountServiceOp
- type AssetData
- type BTCMClient
- func (c *BTCMClient) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *BTCMClient) DoAuthenticated(req *http.Request, data, result interface{}) (*http.Response, error)
- func (c *BTCMClient) GetServerTime() (ServerTime, error)
- func (c *BTCMClient) NewRequest(method, urlPath string, body interface{}) (*http.Request, error)
- type BTCMWSErrorEvent
- type BTCMWSHeartbeatEvent
- type BTCMWSOrderbookEvent
- type BTCMWSOrderbookUpdateEvent
- type BTCMWSTickEvent
- type BTCMWSTickResponse
- type BTCMWSTradeEvent
- type BatchCancelResponse
- type BatchOrderServiceOp
- func (b *BatchOrderServiceOp) BatchPlaceCancelOrders(cancelOrders []CancelBatch, placeOrders []PlaceBatch) (BatchPlaceCancelResponse, error)
- func (b *BatchOrderServiceOp) CancelBatchOrders(ids []string) (BatchCancelResponse, error)
- func (b *BatchOrderServiceOp) GetBatchOrders(ids []string) (BatchTradeResponse, error)
- type BatchPlaceCancelResponse
- type BatchPlaceData
- type BatchTradeResponse
- type CancelBatch
- type CancelOrderMethod
- type CancelOrderResp
- type Candle
- type ClientConfig
- type CreateReportResp
- type DepositAddress
- type ErrorResponse
- type FundManagementServiceOp
- func (f *FundManagementServiceOp) GetDeposit(orderID string) (WithdrawData, error)
- func (f *FundManagementServiceOp) GetDepositeAddress(assetName string, before, after, limit int64) (DepositAddress, error)
- func (f *FundManagementServiceOp) GetTransfers(orderID string) (WithdrawData, error)
- func (f *FundManagementServiceOp) GetWithdrawal(orderID string) (WithdrawData, error)
- func (f *FundManagementServiceOp) GetWithdrawalFees() ([]WithdrawalFee, error)
- func (f *FundManagementServiceOp) ListAssets() ([]AssetData, error)
- func (f *FundManagementServiceOp) ListDeposits(before, after int64, limit int32) ([]WithdrawData, error)
- func (f *FundManagementServiceOp) ListTransfers(before, after int64, limit int32) ([]TransferData, error)
- func (f *FundManagementServiceOp) ListWithdrawls(before, after int64, limit int32) ([]WithdrawData, error)
- func (f *FundManagementServiceOp) WithdrawCrypto(assetName, toAddress string, amount float64) (WithdrawData, error)
- func (f *FundManagementServiceOp) WithdrawFiat(assetName, toAddress string, amount float64) (WithdrawData, error)
- type Market
- type MarketCandle
- type MarketServiceOp
- func (s *MarketServiceOp) AllMarkets() ([]Market, error)
- func (s *MarketServiceOp) GetMarketCandles(marketID, timeWindow string, from, to *time.Time, before, after, limit int) ([]Candle, error)
- func (s *MarketServiceOp) GetMarketOrderbook(marketID string, level int) (*OrderBook, error)
- func (s *MarketServiceOp) GetMarketTicker(marketID string) (*Ticker, error)
- func (s *MarketServiceOp) GetMarketTrades(marketID string, after, before, limit int) ([]Trade, error)
- func (s *MarketServiceOp) GetMultipleOrderbooks(marketIDs []string, level int) ([]OrderBook, error)
- func (s *MarketServiceOp) GetMultipleTickers(marketIDs []string) ([]Ticker, error)
- type Order
- type OrderBook
- type OrderData
- type OrderPayload
- type OrderServiceOp
- func (o *OrderServiceOp) CancelAllOpenOrders() ([]CancelOrderResp, error)
- func (o *OrderServiceOp) CancelOpenOrdersByPairs(marketID []string) ([]CancelOrderResp, error)
- func (o *OrderServiceOp) CancelOrder(orderID string) (*CancelOrderResp, error)
- func (o *OrderServiceOp) GetOrder(orderID string) (*Order, error)
- func (o *OrderServiceOp) ListOrders(marketID, status string, before, after int64, limit int32) ([]Order, error)
- func (o *OrderServiceOp) PlaceNewOrder(marketID string, price, amount float64, orderType, side string, ...) (OrderData, error)
- type OrderToGo
- type PaymentDetails
- type PlaceBatch
- type PlaceOrderMethod
- type ReportData
- type ServerTime
- type Ticker
- type TimeResp
- type Trade
- type TradeHistoryData
- type TradeHistoryServiceOp
- type TradeResponse
- type TradingFee
- type TradingFeeData
- type TradingFeeResponse
- type TransactionData
- type TransferData
- type UnprocessedBatchResp
- type WSSubscribeMessage
- type WebSocketServiceOp
- type WithdrawData
- type WithdrawRequestCrypto
- type WithdrawRequestFiat
- type WithdrawalFee
Constants ¶
const ( // BtcMarketsAPIURL TODO: Below 4 lines need to be refactored BtcMarketsAPIURL = "https://api.btcmarkets.net" BtcMarketsAPIVersion = "/v3" BtcMarketsWSURL = "wss://socket.btcmarkets.net" BtcMarketsWSVersion = "/v2" BtcMarketsTradingFees = "/accounts/me/trading-fees" )
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a JSON response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type AccountBalance ¶
type AccountBalance struct { AssetName string `json:"assetName"` Available string `json:"available"` Balance string `json:"balance"` Locked string `json:"locked"` }
AccountBalance struct to represent Account balance JSON response
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 AccountServiceOp ¶
type AccountServiceOp struct {
// contains filtered or unexported fields
}
AccountServiceOp perform Account API actions
func (*AccountServiceOp) GetBalances ¶
func (a *AccountServiceOp) GetBalances() ([]AccountBalance, error)
GetBalances Returns list of assets covering balance, available, and locked amount for each asset due to open orders or pending withdrawals. This formula represents the relationship between those three elements: balance = available + locked
func (*AccountServiceOp) GetTradingFees ¶
func (a *AccountServiceOp) GetTradingFees() (TradingFeeResponse, error)
GetTradingFees Returns 30 day trading fee volume plus trading fee per market covering marker and taker.
func (*AccountServiceOp) ListTransactions ¶
func (a *AccountServiceOp) ListTransactions(assetName string, before, after int64, limit int32) ([]TransactionData, error)
ListTransactions Returns detail ledger recoerds for underlying wallets. This API supports pagination.
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 BTCMClient ¶
type BTCMClient struct { BaseURL *url.URL WSURL *url.URL UserAgent string Ratelimiter *rate.Limiter // Services used for communicating with the API // Market MarketService Market MarketServiceOp Order OrderServiceOp Batch BatchOrderServiceOp Trade TradeHistoryServiceOp FundManagement FundManagementServiceOp Account AccountServiceOp WebSocket WebSocketServiceOp // contains filtered or unexported fields }
BTCMClient is the main struct type representing an interface with the API as a particular client user.
func NewBTCMClient ¶
func NewBTCMClient(conf ClientConfig) (*BTCMClient, error)
NewBTCMClient returns a new instance of BTCMarkets Client
func (*BTCMClient) Do ¶
Do sends and API request and return the API Response. The response is JSON decoded and store in the value pointed by v, or returns an error
func (*BTCMClient) DoAuthenticated ¶
func (c *BTCMClient) DoAuthenticated(req *http.Request, data, result interface{}) (*http.Response, error)
DoAuthenticated makes API request and return the API Response
func (*BTCMClient) GetServerTime ¶
func (c *BTCMClient) GetServerTime() (ServerTime, error)
GetServerTime get the BTCMarkets server time This is required to build a valid authenticated request
func (*BTCMClient) NewRequest ¶
func (c *BTCMClient) NewRequest(method, urlPath string, body interface{}) (*http.Request, error)
NewRequest creates an API request.
type BTCMWSErrorEvent ¶
type BTCMWSErrorEvent struct { Code int64 `json:"code"` Message string `json:"message"` MessageType string `json:"messageType"` }
BTCMWSErrorEvent in case of errors, a message type of error is published. Authentication error Invalid input error Internal server error Throttle error Invalid Channel names Invalid MarketId Authenticate Error
type BTCMWSHeartbeatEvent ¶
type BTCMWSHeartbeatEvent struct { Channels []struct { MarketIds []string `json:"marketIds"` Name string `json:"name"` } `json:"channels"` MessageType string `json:"messageType"` }
BTCMWSHeartbeatEvent if you subscribe to heartbeat event then the server will send you a heartbeat event every 5 seconds. Note: Once a new subscription request is confirmed, a single heartbeat event is published to the client in order to confirm the connection working. This is regardless of requesting to subscribe to heartbeat channel.
type BTCMWSOrderbookEvent ¶
type BTCMWSOrderbookEvent struct { Asks [][]string `json:"asks"` Bids [][]string `json:"bids"` MarketID string `json:"marketId"` MessageType string `json:"messageType"` Timestamp string `json:"timestamp"` }
BTCMWSOrderbookEvent In order to receive orderbook events please add orderbook to the list of channels when subscribing via WebSocket. The current orderbook event represents the latest orderbook state and maximum 50 bids and asks are included in each event.
type BTCMWSOrderbookUpdateEvent ¶
type BTCMWSOrderbookUpdateEvent struct { Asks [][]interface{} `json:"asks"` Bids [][]interface{} `json:"bids"` MarketID string `json:"marketId"` MessageType string `json:"messageType"` Snapshot bool `json:"snapshot"` SnapshotID int64 `json:"snapshotId"` Timestamp string `json:"timestamp"` }
BTCMWSOrderbookUpdateEvent In many cases, it's more appropriate to maintain a local copy of the exchange orderbook by receiving only updates instead of the entire orderbook.
type BTCMWSTickEvent ¶
type BTCMWSTickEvent struct { BestAsk string `json:"bestAsk"` BestBid string `json:"bestBid"` LastPrice string `json:"lastPrice"` MarketID string `json:"marketId"` MessageType string `json:"messageType"` Timestamp string `json:"timestamp"` Volume24h string `json:"volume24h"` }
BTCMWSTickEvent The tick event is published every time lastPrice, bestBid or bestAsk is updated for a market which is the result of orderbook changes or trade matches.
type BTCMWSTickResponse ¶
type BTCMWSTickResponse struct { BestAsk string `json:"bestAsk"` BestBid string `json:"bestBid"` High24h string `json:"high24h"` LastPrice string `json:"lastPrice"` Low24h string `json:"low24h"` MarketID string `json:"marketId"` MessageType string `json:"messageType"` Price24h string `json:"price24h"` SnapshotID int64 `json:"snapshotId"` Timestamp string `json:"timestamp"` Volume24h string `json:"volume24h"` }
BTCMWSTickResponse Response object res
type BTCMWSTradeEvent ¶
type BTCMWSTradeEvent struct { MarketID string `json:"marketId"` MessageType string `json:"messageType"` Price string `json:"price"` Side string `json:"side"` Timestamp string `json:"timestamp"` TradeID int64 `json:"tradeId"` Volume string `json:"volume"` }
BTCMWSTradeEvent In order to receive trade events please add trade to the list of channels when subscribing via WebSocket.
type BatchCancelResponse ¶
type BatchCancelResponse struct { CancelOrders []CancelOrderResp `json:"cancelOrders"` UnprocessedRequests []UnprocessedBatchResp `json:"unprocessedRequests"` }
BatchCancelResponse stores the cancellation details from batch cancels
type BatchOrderServiceOp ¶
type BatchOrderServiceOp struct {
// contains filtered or unexported fields
}
BatchOrderServiceOp performs BatchOrder placements Operations on BTCMarkets
func (*BatchOrderServiceOp) BatchPlaceCancelOrders ¶
func (b *BatchOrderServiceOp) BatchPlaceCancelOrders(cancelOrders []CancelBatch, placeOrders []PlaceBatch) (BatchPlaceCancelResponse, error)
BatchPlaceCancelOrders Use this API to place multiple new orders or cancel existing ones via a single request. The request for batch processing is an array of items, and each item contains instructions for an order placement and a cancellation. There are restrictions on the number of items in a batch (currently set to 10) so a batch can c ontain up to 4 items in any form that is needed
func (*BatchOrderServiceOp) CancelBatchOrders ¶
func (b *BatchOrderServiceOp) CancelBatchOrders(ids []string) (BatchCancelResponse, error)
CancelBatchOrders cancels given ids
func (*BatchOrderServiceOp) GetBatchOrders ¶
func (b *BatchOrderServiceOp) GetBatchOrders(ids []string) (BatchTradeResponse, error)
GetBatchOrders gets batch trades
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 { ClientOrderID string `json:"clientOrderId"` OrderID string `json:"orderId"` }
CancelOrderResp stores data for cancelled orders
type Candle ¶
type Candle struct { Time time.Time Open float64 Close float64 Low float64 High float64 Volume float64 }
Candle holds time, open, high, low, close & volume information for a given trading pair
type ClientConfig ¶
type ClientConfig struct { Httpclient *http.Client APIKey string APISecret string WsURL *url.URL BaseURL *url.URL RateLimiter *rate.Limiter }
ClientConfig TODO:...
type CreateReportResp ¶
type CreateReportResp struct {
ReportID string `json:"reportId"`
}
CreateReportResp stores data for created report
type DepositAddress ¶
DepositAddress stores deposit address data
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // Error message - maybe the json for this is "fault" Message string `json:"message"` }
An ErrorResponse reports the error caused by an API request If response is 200 but there is marshalling error there could be a issue with Unmarshaling the data into the struct
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
Error method to satisfy the Error Interface requirement
type FundManagementServiceOp ¶
type FundManagementServiceOp struct {
// contains filtered or unexported fields
}
FundManagementServiceOp performs Fundmanagement operations on BTCMarkets
func (*FundManagementServiceOp) GetDeposit ¶
func (f *FundManagementServiceOp) GetDeposit(orderID string) (WithdrawData, error)
GetDeposit This API returns a deposit by id.
func (*FundManagementServiceOp) GetDepositeAddress ¶
func (f *FundManagementServiceOp) GetDepositeAddress(assetName string, before, after, limit int64) (DepositAddress, error)
GetDepositeAddress returns deposit address for the given asset Note: The documentation at https://api.btcmarkets.net/doc/v3#tag/Fund-Management-APIs/paths/~1v3~1addresses/get is wrong
func (*FundManagementServiceOp) GetTransfers ¶
func (f *FundManagementServiceOp) GetTransfers(orderID string) (WithdrawData, error)
GetTransfers This API retruns either deposit or withdrawal by id
func (*FundManagementServiceOp) GetWithdrawal ¶
func (f *FundManagementServiceOp) GetWithdrawal(orderID string) (WithdrawData, error)
GetWithdrawal This API is used to request to get withdraw by id.
func (*FundManagementServiceOp) GetWithdrawalFees ¶
func (f *FundManagementServiceOp) GetWithdrawalFees() ([]WithdrawalFee, error)
GetWithdrawalFees Returns fees associated with withdrawals. This API is public and does not require authentication as the fees as system wide and published on the website
func (*FundManagementServiceOp) ListAssets ¶
func (f *FundManagementServiceOp) ListAssets() ([]AssetData, error)
ListAssets Retrieves list of assets including configuration
assetName: name of the asset that us used for trading or investment minDepositAmount: minimum amount to deposit maxDepositAmount: maximum amount to deposit depositFee: deposit fee depositDecimals: number of decimal places allowed for deposits minWithdrawalAmount: minimum amount to withdraw maxWithdrawalAmount: maximum amount to withdraw withdrawalFee: withdrawal fee withdrawalDecimals: number of decimal places allowed for withdrawals
func (*FundManagementServiceOp) ListDeposits ¶
func (f *FundManagementServiceOp) ListDeposits(before, after int64, limit int32) ([]WithdrawData, error)
ListDeposits Returns list of depoists. This API supports pagination
func (*FundManagementServiceOp) ListTransfers ¶
func (f *FundManagementServiceOp) ListTransfers(before, after int64, limit int32) ([]TransferData, error)
ListTransfers A transfer record refers either to a deposit or withdraw and this API returns list of transfers covering both depoists and withdrawals. This API supports pagination
func (*FundManagementServiceOp) ListWithdrawls ¶
func (f *FundManagementServiceOp) ListWithdrawls(before, after int64, limit int32) ([]WithdrawData, error)
ListWithdrawls Returns list of withdrawals. This API supports pagination
func (*FundManagementServiceOp) WithdrawCrypto ¶
func (f *FundManagementServiceOp) WithdrawCrypto(assetName, toAddress string, amount float64) (WithdrawData, error)
WithdrawCrypto This API is used to request to withdraw of crypto assets
func (*FundManagementServiceOp) WithdrawFiat ¶
func (f *FundManagementServiceOp) WithdrawFiat(assetName, toAddress string, amount float64) (WithdrawData, error)
WithdrawFiat This API is used to request to withdraw of crypto assets
type Market ¶
type Market struct { MarketID string `json:"marketId"` BaseAsset string `json:"baseAssetName"` QuoteAsset string `json:"quoteAssetName"` 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 MarketServiceOp ¶
type MarketServiceOp struct {
// contains filtered or unexported fields
}
MarketServiceOp struct is used to perform Market API Operation on BTCMarkets via the BTCMClient Market Interface
func (*MarketServiceOp) AllMarkets ¶
func (s *MarketServiceOp) AllMarkets() ([]Market, error)
AllMarkets Retrieves list of active markets including configuration for each market
func (*MarketServiceOp) GetMarketCandles ¶
func (s *MarketServiceOp) GetMarketCandles(marketID, timeWindow string, from, to *time.Time, before, after, limit int) ([]Candle, error)
GetMarketCandles Retrieves array of candles for a given market. Each candle record is an array of string representing [time,open,high,low,close,volume] for the time window specified (default time window is 1 day). This API can be used to retrieve candles either by pagination (before, after, limit) or by specifying timestamp parameters (from and/or to). Pagination parameters can't be combined with timestamp parameters and default behavior is pagination when no query param is specified. When using timestamp parameters as query string, the maximum number of items that can be retrieved is 1000, and depending on the specified timeWindow this can be different time windows. For instance, when using timeWindow=1d then up to 1000 days of market candles can be retrieved.
func (*MarketServiceOp) GetMarketOrderbook ¶
func (s *MarketServiceOp) GetMarketOrderbook(marketID string, level int) (*OrderBook, error)
GetMarketOrderbook Retrieves list of bids and asks for a given market. passing level=1 returns top 50 for bids and asks. level=2 returns full orderbook (full orderbook data is cached and usually updated every 10 seconds). Each market order is represented as an array of string [price, volume]. The attribute, snapshotId, is a uniqueue number associated to orderbook and it changes every time orderbook changes.
func (*MarketServiceOp) GetMarketTicker ¶
func (s *MarketServiceOp) GetMarketTicker(marketID string) (*Ticker, error)
GetMarketTicker Returns ticker for the given marketId
func (*MarketServiceOp) GetMarketTrades ¶
func (s *MarketServiceOp) GetMarketTrades(marketID string, after, before, limit int) ([]Trade, error)
GetMarketTrades Retrieves list of most recent trades for the given market. This API supports pagination.
func (*MarketServiceOp) GetMultipleOrderbooks ¶
func (s *MarketServiceOp) GetMultipleOrderbooks(marketIDs []string, level int) ([]OrderBook, error)
GetMultipleOrderbooks This API works similar to /v3/markets/{marketId}/orderbook except it retrieves orderbooks for a given list of marketIds provided via query string (e.g. ?marketId=ETH-BTC&marketId=XRP-BTC). To gain better performance, restrict the number of marketIds to the items needed for your trading app instead of requesting all markets. Retrieving full orderbook (level=2), for multiple markets, was mainly provided for customers who are interested in capturing and keeping full orderbook history. Therefore, it's recommended to call this API with lower frequency as the data size can be large and also cached.
func (*MarketServiceOp) GetMultipleTickers ¶
func (s *MarketServiceOp) GetMultipleTickers(marketIDs []string) ([]Ticker, error)
GetMultipleTickers This API works similar to /v3/markets/{marketId}/ticker except it retrieves tickers for a given list of marketIds provided via query string (e.g. ?marketId=ETH-BTC&marketId=XRP-BTC). To gain better performance, restrict the number of marketIds to the items needed for your trading app instead of requesting all markets.
type Order ¶
type Order struct { Amount string `json:"amount"` CreationTime string `json:"creationTime"` MarketID string `json:"marketId"` OpenAmount string `json:"openAmount"` OrderID string `json:"orderId"` Price string `json:"price"` Side string `json:"side"` Status string `json:"status"` Type string `json:"type"` }
Order holds order information
type OrderBook ¶
type OrderBook struct { MarketID string `json:"marketId"` SnapshotID int `json:"snapshotId"` Asks [][]string `json:"asks"` Bids [][]string `json:"bids"` }
OrderBook holds current orderbook information returned from the exchange
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 OrderPayload ¶
type OrderPayload struct { Amount string `json:"amount"` MarketID string `json:"marketId"` Price string `json:"price"` Side string `json:"side"` Type string `json:"type"` }
OrderPayload store data for the payload send to place new order
type OrderServiceOp ¶
type OrderServiceOp struct {
// contains filtered or unexported fields
}
OrderServiceOp perform Order Placement API Operation on BTCMarkets via the BTCMClient Market Interface
func (*OrderServiceOp) CancelAllOpenOrders ¶
func (o *OrderServiceOp) CancelAllOpenOrders() ([]CancelOrderResp, error)
CancelAllOpenOrders Cancels all open orders
func (*OrderServiceOp) CancelOpenOrdersByPairs ¶
func (o *OrderServiceOp) CancelOpenOrdersByPairs(marketID []string) ([]CancelOrderResp, error)
CancelOpenOrdersByPairs Cancels specified trading pairs for open orders for all markets or optionally
for a given list of marketIds only.
func (*OrderServiceOp) CancelOrder ¶
func (o *OrderServiceOp) CancelOrder(orderID string) (*CancelOrderResp, error)
CancelOrder Cancels a single order. this API returns http error 400 if the order is realdy cancelled or matched, patrally matched.
func (*OrderServiceOp) GetOrder ¶
func (o *OrderServiceOp) GetOrder(orderID string) (*Order, error)
GetOrder Returns an order by using either the exachange `orderId` or `clientOrderId`
func (*OrderServiceOp) ListOrders ¶
func (o *OrderServiceOp) ListOrders(marketID, status string, before, after int64, limit int32) ([]Order, error)
ListOrders Return an array of historical orders or open orders only. All query string parametesr are optional so by default and when no query parameter is provided, this API retrieves open orders only for all markets. This API supports pagination only when retrieving all orders status=all, When sending using status=open all open orders are returned and with no pagination.
func (*OrderServiceOp) PlaceNewOrder ¶
func (o *OrderServiceOp) PlaceNewOrder(marketID string, price, amount float64, orderType, side string, triggerPrice, targetAmount float64, timeInForce string, postOnly bool, selfTrade, clientOrderID string) (OrderData, error)
PlaceNewOrder This API is used to place a new order. Some of the parameteres are mandatory as specified below. The right panel presents the default response with primary attributes. You can also select from the drop down to see an order response ' with all possible order attributes.
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 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 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 ServerTime ¶
type ServerTime struct {
Timestamp string `json:"timestamp"`
}
ServerTime holds the BTCMarket Server time returned after making a call to /v3/time
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 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 TradeHistoryServiceOp ¶
type TradeHistoryServiceOp struct {
// contains filtered or unexported fields
}
TradeHistoryServiceOp performs Trade API Operations on BTCMarkets
func (*TradeHistoryServiceOp) GetTradeByID ¶
func (th *TradeHistoryServiceOp) GetTradeByID(id string) (TradeHistoryData, error)
GetTradeByID returns the singular trade of the ID given
func (*TradeHistoryServiceOp) ListTrades ¶
func (th *TradeHistoryServiceOp) ListTrades(marketID, orderID string, before, after, limit int64) ([]TradeHistoryData, error)
ListTrades returns trade history
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 WithdrawData
TransferData convinience datatype to make code more readable
type UnprocessedBatchResp ¶
type UnprocessedBatchResp struct { Code string `json:"code"` Message string `json:"message"` RequestID string `json:"requestId"` }
UnprocessedBatchResp stores data for unprocessed response
type WSSubscribeMessage ¶
type WSSubscribeMessage struct { Channels []string `json:"channels"` MarketIds []string `json:"marketIds"` MessageType string `json:"messageType"` Timestamp string `json:"timestamp"` Key string `json:"key"` Signature string `json:"signature"` }
WSSubscribeMessage Subscribe message to initiate WebSocket Connection
type WebSocketServiceOp ¶
type WebSocketServiceOp struct {
// contains filtered or unexported fields
}
WebSocketServiceOp WebSocket feed provides real-time market data covering
orderbook updates, order life cycle and trades
func (*WebSocketServiceOp) Subscribe ¶
func (ws *WebSocketServiceOp) Subscribe(ctx context.Context, m WSSubscribeMessage) (chan []byte, error)
Subscribe returns a channel of bytes with messages from the websocket. The consumer of this method will need to handle the Implicit type Conversion of the bytes returned on the channel. This method needs to be called with a ContextWithCancel as first parameter to be able close the websocket and a SubscribeMessage to start receiving events for the specified channels and marketIds
type WithdrawData ¶
type WithdrawData 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,omitempty"` }
WithdrawData stores data from asset transfers
type WithdrawRequestCrypto ¶
type WithdrawRequestCrypto struct { Amount float64 `json:"amount"` Currency string `json:"currency"` Address string `json:"address"` }
WithdrawRequestCrypto is a generalized withdraw request type
type WithdrawRequestFiat ¶
type WithdrawRequestFiat 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"` }
WithdrawRequestFiat is a generalized withdraw request type
type WithdrawalFee ¶
WithdrawalFee stores data for fees