Documentation ¶
Index ¶
- Constants
- type Account
- type AccountsParams
- type CancelAfter
- type Candle
- type CandlesParams
- type Channel
- type Client
- func (client *Client) Account(id string) (*Account, error)
- func (client *Client) Accounts() ([]Account, error)
- func (client *Client) Candles(productID string, p CandlesParams) ([]Candle, *PaginationResponse, error)
- func (client *Client) Currencies() ([]Currency, error)
- func (client *Client) Currency(id string) (*Currency, error)
- func (client *Client) Fills() ([]Fill, error)
- func (client *Client) Ledger(p LedgerParams) ([]Ledger, *PaginationResponse, error)
- func (client *Client) Order(id string) (*Order, error)
- func (client *Client) OrderCreate(body OrderCreateBody) (*Order, error)
- func (client *Client) Orders(p OrdersParams) ([]Order, *PaginationResponse, error)
- func (client *Client) Product(id string) (*Product, error)
- func (client *Client) Products() ([]Product, error)
- func (client *Client) Profiles() ([]Profile, error)
- func (client *Client) Transfers(accountID string, p TransfersParams) ([]Transfer, *PaginationResponse, error)
- func (client *Client) WebSocketCreate(channels []Channel, wsh WebSockerHandler) *WebSocket
- type ClientCredentials
- type Currency
- type Fill
- type Granularity
- type Ledger
- type LedgerParams
- type Order
- type OrderCreateBody
- type OrderSide
- type OrderStatus
- type OrderType
- type OrdersParams
- type PaginationParams
- type PaginationResponse
- type Product
- type ProductID
- type ProductsParams
- type Profile
- type Request
- type Sorting
- type SubscribeRequest
- type TickerMessage
- type TimeInForce
- type Transfer
- type TransfersParams
- type WebSockerHandler
- type WebSocket
- type WebsocketResponse
Constants ¶
View Source
const ( TimeInForceGoodTillCanceled = "GTC" TimeInForceGoodTillTime = "GTT" )
View Source
const ( CancelAfterMin = "min" CancelAFterHour = "hour" CancelAfterDay = "day" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID string `json:"id" binding:"required"` Currency string `json:"currency" binding:"required"` Balance float64 `json:"balance,string" binding:"required"` Available float64 `json:"available,string" binding:"required"` Hold string `json:"hold" binding:"required"` ProfileId string `json:"profile_id" binding:"required"` TradingEnabled bool `json:"trading_enabled" binding:"required"` }
type AccountsParams ¶
type AccountsParams struct {
PaginationParams
}
type CancelAfter ¶
type CancelAfter string
type Candle ¶
type Candle struct { Timestamp int `json:"timestamp"` PriceLow float64 `json:"price_low"` PriceHigh float64 `json:"price_high"` PriceOpen float64 `json:"price_open"` PriceClose float64 `json:"price_close"` }
func (*Candle) UnmarshalJSON ¶
type CandlesParams ¶
type CandlesParams struct { PaginationParams Granularity Granularity `url:"granularity,omitempty"` Start int64 `url:"start,omitempty"` End int64 `url:"end,omitempty"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(credentials ClientCredentials) *Client
func (*Client) Candles ¶
func (client *Client) Candles(productID string, p CandlesParams) ([]Candle, *PaginationResponse, error)
func (*Client) Currencies ¶
func (*Client) Ledger ¶
func (client *Client) Ledger(p LedgerParams) ([]Ledger, *PaginationResponse, error)
func (*Client) OrderCreate ¶
func (client *Client) OrderCreate(body OrderCreateBody) (*Order, error)
func (*Client) Orders ¶
func (client *Client) Orders(p OrdersParams) ([]Order, *PaginationResponse, error)
func (*Client) Transfers ¶
func (client *Client) Transfers(accountID string, p TransfersParams) ([]Transfer, *PaginationResponse, error)
func (*Client) WebSocketCreate ¶
func (client *Client) WebSocketCreate(channels []Channel, wsh WebSockerHandler) *WebSocket
type ClientCredentials ¶
type Currency ¶
type Currency struct { ID string `json:"id" binding:"required"` Name string `json:"name" binding:"required"` MinSize float64 `json:"min_size,string" binding:"required"` Status string `json:"status" binding:"required"` Message string `json:"message"` MaxPrecision float64 `json:"max_precision,string" binding:"required"` ConvertibleTo []string `json:"convertible_to"` }
type Fill ¶
type Fill struct { TradeID string `json:"trade_id" binding:"required"` ProductID string `json:"product_id" binding:"required"` OrderID string `json:"order_id" binding:"required"` UserID string `json:"user_id" binding:"required"` ProfileID string `json:"profile_id" binding:"required"` Liquidity string `json:"liquidity" binding:"required"` }
type Granularity ¶
type Granularity int
var ( GranularityMinute Granularity = 60 GranularityFiveMinutes Granularity = 300 GranularityFifteenMinutes Granularity = 900 GranularityHour Granularity = 3600 GranularitySixHours Granularity = 21600 GranularityDay Granularity = 86400 )
type LedgerParams ¶
type Order ¶
type Order struct { ID string `json:"id" binding:"required"` Price string `json:"price"` Size string `json:"size"` ProductID ProductID `json:"product_id" binding:"required"` ProfileID string `json:"profile_id"` Side OrderSide `json:"side" binding:"required"` Funds string `json:"funds"` SpecifiedFunds string `json:"specified_funds"` Type OrderType `json:"type" binding:"required"` TimeInForce string `json:"time_in_force"` ExpireTime string `json:"expire_time"` PostOnly bool `json:"post_only" binding:"required"` CreatedAt string `json:"created_at" binding:"required"` DoneAt string `json:"done_at"` DoneReason string `json:"done_reason"` RejectReason string `json:"reject_reason"` FillFees string `json:"fill_fees" binding:"required"` FilledSize string `json:"filled_size" binding:"required"` ExecutedValue string `json:"executed_value"` Status OrderStatus `json:"status" binding:"required"` Settled bool `json:"settled" binding:"required"` Stop string `json:"stop"` StopPrice string `json:"stop_price"` FundingAmount string `json:"funding_amount"` ClientOID string `json:"client_oid"` }
type OrderCreateBody ¶
type OrderCreateBody struct { ProfileID string `json:"profile_id,omitempty"` Type OrderType `json:"type,omitempty"` Side OrderSide `json:"side" binding:"required"` ProductID ProductID `json:"product_id" binding:"required"` STP string `json:"stp,omitempty"` Stop string `json:"stop,omitempty"` StopPrice string `json:"stop_price,omitempty"` Price string `json:"price,omitempty"` Size string `json:"size,omitempty"` Funds string `json:"funds,omitempty"` TimeInForce TimeInForce `json:"time_in_force,omitempty"` CancelAfter CancelAfter `json:"cancel_after,omitempty"` PostOnly bool `json:"post_only,omitempty"` ClientOID string `json:"client_oid,omitempty"` }
type OrderStatus ¶
type OrderStatus string
const ( OrderStatusOpen OrderStatus = "open" OrderStatusPending OrderStatus = "pending" OrderStatusRejected OrderStatus = "rejected" OrderStatusDone OrderStatus = "done" OrderStatusActive OrderStatus = "active" OrderStatusReceived OrderStatus = "received" OrderStatusAll OrderStatus = "all" )
type OrdersParams ¶
type OrdersParams struct { PaginationParams ProfileID string `url:"profile_id,omitempty"` ProductID ProductID `url:"product_id,omitempty"` SortedBy string `url:"sortedBy,omitempty"` Sorting Sorting `url:"sorting,omitempty"` StartDate time.Time `url:"start_date,omitempty"` EndDate time.Time `url:"end_date,omitempty"` Status []OrderStatus `url:"status" binding:"required"` }
type PaginationParams ¶
type PaginationResponse ¶
type Product ¶
type Product struct { ID ProductID `json:"id" binding:"required"` QuoteCurrency string `json:"quote_currency" binding:"required"` QuoteIncrement float64 `json:"quote_increment,string" binding:"required"` BaseIncrement float64 `json:"base_increment,string" binding:"required"` DisplayName string `json:"display_name" binding:"required"` PostOnly bool `json:"post_only" binding:"required"` LimitOnly bool `json:"limit_only" binding:"required"` CancelOnly bool `json:"cancel_only" binding:"required"` Status string `json:"status" binding:"required"` StatusMessage string `json:"status_message" binding:"required"` TradingDisabled bool `json:"trading_disabled"` }
type ProductsParams ¶
type ProductsParams struct {
PaginationParams
}
type Profile ¶
type Profile struct { ID string `json:"id" binding:"required"` UserID string `json:"user_id" binding:"required"` Name string `json:"name" binding:"required"` Active bool `json:"active" binding:"required"` IsDefault bool `json:"is_default" binding:"required"` HasMargin bool `json:"has_margin" binding:"required"` CreatedAt time.Time `json:"creatd_at" binding:"required"` }
type SubscribeRequest ¶
type TickerMessage ¶
type TickerMessage struct { WebsocketResponse // Sequence int `json:"sequence"` ProductID ProductID `json:"product_id"` Price float64 `json:"price,string"` Open24H float64 `json:"open_24h,string"` Volume24H float64 `json:"volume_24h,string"` Low24H float64 `json:"low_24h,string"` High24H float64 `json:"high_24h,string"` Volume30D float64 `json:"volume_30d,string"` BestBid string `json:"best_bid"` BestAsk string `json:"best_ask"` Side string `json:"side"` Time time.Time `json:"time"` TradeID int `json:"trade_id"` LastSize float64 `json:"last_size,string"` }
type TimeInForce ¶
type TimeInForce string
type Transfer ¶
type Transfer struct { ID string `url:"id"` Type string `url:"type"` CreatedAt time.Time `url:"created_at"` CompletedAt time.Time `url:"completed_at"` CanceledAt time.Time `url:"canceled_at"` ProcessedAt time.Time `url:"processed_at"` Amount string `url:"amount"` UserNonce string `url:"user_nonce"` Details map[string]interface{} `url:"details"` }
type TransfersParams ¶
type TransfersParams struct { PaginationParams Type string `url:"type,omitempty"` }
type WebSockerHandler ¶
type WebsocketResponse ¶
type WebsocketResponse struct { Type string `json:"type"` Message string `json:"message"` OrderID string `json:"order_id"` OrderType string `json:"order_type"` Size string `json:"size"` RemainingSize string `json:"remaining_size"` Price string `json:"price"` ClientOID string `json:"client_oid"` Side string `json:"side"` ProductID string `json:"product_id"` Time string `json:"time"` // Sequence int `json:"sequence"` ProfileID string `json:"profile_id"` UserID string `json:"user_id"` Reason string `json:"reason"` }
Click to show internal directories.
Click to hide internal directories.