Documentation ¶
Index ¶
- Constants
- Variables
- type ACHResponse
- type Address
- type AlgoID
- type AssetPair
- type AssetPairs
- type Balance
- type BidAsk
- type Client
- func (c *Client) ACHDeposit(amount decimal.Decimal) (ACHResponse, error)
- func (c *Client) AccountBalance() ([]Balance, error)
- func (c *Client) AssetPairs() (AssetPairs, error)
- func (c *Client) BestPrice(side Side, amount decimal.Decimal, pair string) (Price, error)
- func (c *Client) CancelOrder(orderID int64) error
- func (c *Client) CreateAddress(currency string) (Address, error)
- func (c *Client) CryptoAddresses(currency string) ([]Address, error)
- func (c *Client) GetOrder(orderID int64) (Order, error)
- func (c *Client) OpenOrders() ([]Order, error)
- func (c *Client) Orderbook(pair string) (Orderbook, error)
- func (c *Client) PlaceOrder(side Side, newOrder NewOrder) (Order, error)
- func (c *Client) Transactions(t ...TimeBasedPagination) ([]Transaction, error)
- func (c *Client) Withdraw(amount decimal.Decimal, currency, address string) (WithdrawResponse, error)
- type ErrHttp
- type ErrHttpClient
- type ErrHttpServer
- type Event
- type NewOrder
- type Order
- type Orderbook
- type OrderbookMsg
- type Price
- type Side
- type TickerMsg
- type Time
- type TimeBasedPagination
- type TradeMsg
- type Transaction
- type Websocket
- type WebsocketEnvelope
- type WithdrawResponse
Constants ¶
View Source
const (
ProductionWebsocketHost = "wss://ws.sfox.com/ws"
)
Variables ¶
View Source
var (
ErrUnknownPayload = errors.New("Unknown payload")
)
Functions ¶
This section is empty.
Types ¶
type ACHResponse ¶
type AssetPairs ¶
type BidAsk ¶
func (*BidAsk) UnmarshalJSON ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewWithHost ¶
func (*Client) ACHDeposit ¶
func (c *Client) ACHDeposit(amount decimal.Decimal) (ACHResponse, error)
func (*Client) AccountBalance ¶
func (*Client) AssetPairs ¶
func (c *Client) AssetPairs() (AssetPairs, error)
func (*Client) CancelOrder ¶
func (*Client) CryptoAddresses ¶
func (*Client) OpenOrders ¶
func (*Client) PlaceOrder ¶
Place an order. Example of an "Instant" buy: NewOrder{Quantity: decimal.NewFromFloat(0.001)} Smart buy (no limit): NewOrder{Quantity: decimal.NewFromFloat(0.04), AlgoID: SmartAlgo, Pair: "ethusd"}
func (*Client) Transactions ¶
func (c *Client) Transactions(t ...TimeBasedPagination) ([]Transaction, error)
Transactions retrieves all the user's transactions, by default this will be all transactions inception to date.
type ErrHttpClient ¶
type ErrHttpClient struct {
ErrHttp
}
type ErrHttpServer ¶
type ErrHttpServer struct {
ErrHttp
}
type Event ¶
type Event struct { Msg WebsocketEnvelope Err error }
type NewOrder ¶
type NewOrder struct { Quantity decimal.Decimal `json:"quantity"` Pair string `json:"currency_pair"` Price decimal.Decimal `json:"price"` AlgoID AlgoID `json:"algorithm_id"` ClientOrderID string `json:"client_order_id"` Interval int64 `json:"interval"` // seconds TotalTime int64 `json:"total_time"` // seconds RoutingType string `json:"routing_type"` Extra map[string]interface{} `json:"extra"` }
type Order ¶
type Order struct { ID int64 `json:"id"` Quantity decimal.Decimal `json:"quantity"` Price decimal.Decimal `json:"price"` Action string `json:"o_action"` Pair string `json:"pair"` Type string `json:"type"` VWAP decimal.Decimal `json:"vwap"` Filled decimal.Decimal `json:"filled"` Status string `json:"status"` StatusCode int `json:"status_code"` ClientOrderID string `json:"client_order_id"` Updated Time `json:"dateupdated"` Expires *Time `json:"expires"` Fees decimal.Decimal `json:"fees"` NetProceeds decimal.Decimal `json:"net_proceeds"` Proceeds decimal.Decimal `json:"proceeds"` }
type OrderbookMsg ¶
type TickerMsg ¶
type TickerMsg struct { Amount decimal.Decimal `json:"amount"` Exchange string `json:"exchange"` Open decimal.Decimal `json:"open"` High decimal.Decimal `json:"high"` Low decimal.Decimal `json:"low"` Last decimal.Decimal `json:"last"` Volume decimal.Decimal `json:"volume"` VWAP decimal.Decimal `json:"vwap"` Pair string `json:"pair"` Route string `json:"route"` Source string `json:"source"` Time Time `json:"timestamp"` }
type Time ¶
func (*Time) UnmarshalJSON ¶
type TradeMsg ¶
type TradeMsg struct { ID string `json:"id"` Pair string `json:"pair"` Price decimal.Decimal `json:"price,string"` Quantity decimal.Decimal `json:"quantity,string"` Side string `json:"side"` BuyOrderID string `json:"buy_order_id"` SellOrderID string `json:"sell_order_id"` Exchange string `json:"exchange"` ExchangeID int `json:"exchange_id"` Timestamp Time `json:"timestamp"` }
type Transaction ¶
type Transaction struct { ID int64 `json:"id"` OrderID string `json:"order_id"` ClientOrderID string `json:"client_order_id"` Day Time `json:"day"` Action string `json:"action"` // TODO: make a type for these Currency string `json:"currency"` Amount decimal.Decimal `json:"amount"` NetProceeds decimal.Decimal `json:"net_proceeds"` Price decimal.Decimal `json:"price"` Fees decimal.Decimal `json:"fees"` Status string `json:"status"` HoldExpires Time `json:"hold_expires"` TxHash string `json:"tx_hash"` AlgoName string `json:"algo_name"` AlgoID string `json:"algo_id"` AccountBalance decimal.Decimal `json:"account_balance"` WalletDisplayID string `json:"wallet_display_id"` }
type Websocket ¶
type Websocket struct {
// contains filtered or unexported fields
}
func NewWebsocket ¶
func NewWebsocket() *Websocket
func NewWebsocketWithHost ¶
type WebsocketEnvelope ¶
type WebsocketEnvelope struct { Type string `json:"type"` Sequence int64 `json:"sequence"` Timestamp int64 `json:"timestamp"` Recipient string `json:"recipient"` RawPayload json.RawMessage `json:"payload"` // delay parsing }
func (*WebsocketEnvelope) Payload ¶
func (wse *WebsocketEnvelope) Payload() (interface{}, error)
type WithdrawResponse ¶
Click to show internal directories.
Click to hide internal directories.