Documentation ¶
Index ¶
- Variables
- func FilterOrdersByCurrencies(orders *[]Detail, currencies []currency.Pair)
- func FilterOrdersBySide(orders *[]Detail, side Side)
- func FilterOrdersByTickRange(orders *[]Detail, startTicks, endTicks time.Time)
- func FilterOrdersByType(orders *[]Detail, orderType Type)
- func SortOrdersByCurrency(orders *[]Detail, reverse bool)
- func SortOrdersByDate(orders *[]Detail, reverse bool)
- func SortOrdersByPrice(orders *[]Detail, reverse bool)
- func SortOrdersBySide(orders *[]Detail, reverse bool)
- func SortOrdersByType(orders *[]Detail, reverse bool)
- type ByCurrency
- type ByDate
- type ByOrderSide
- type ByOrderType
- type ByPrice
- type Cancel
- type CancelAllResponse
- type ClassificationError
- type Detail
- type GetOrdersRequest
- type Modify
- type ModifyResponse
- type Side
- type Status
- type Submit
- type SubmitResponse
- type TradeHistory
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( ErrSubmissionIsNil = errors.New("order submission is nil") ErrPairIsEmpty = errors.New("order pair is empty") ErrSideIsInvalid = errors.New("order side is invalid") ErrTypeIsInvalid = errors.New("order type is invalid") ErrAmountIsInvalid = errors.New("order amount is invalid") ErrPriceMustBeSetIfLimitOrder = errors.New("order price must be set if limit order type is desired") )
var error definitions
Functions ¶
func FilterOrdersByCurrencies ¶
FilterOrdersByCurrencies removes any order details that do not match the provided currency list. It is forgiving in that the provided currencies can match quote or base currencies
func FilterOrdersBySide ¶
FilterOrdersBySide removes any order details that don't match the order status provided
func FilterOrdersByTickRange ¶
FilterOrdersByTickRange removes any OrderDetails outside of the tick range
func FilterOrdersByType ¶
FilterOrdersByType removes any order details that don't match the order type provided
func SortOrdersByCurrency ¶
SortOrdersByCurrency the caller function to sort orders
func SortOrdersByDate ¶
SortOrdersByDate the caller function to sort orders
func SortOrdersByPrice ¶
SortOrdersByPrice the caller function to sort orders
func SortOrdersBySide ¶
SortOrdersBySide the caller function to sort orders
func SortOrdersByType ¶
SortOrdersByType the caller function to sort orders
Types ¶
type ByCurrency ¶
type ByCurrency []Detail
ByCurrency used for sorting orders by order currency
func (ByCurrency) Len ¶
func (b ByCurrency) Len() int
func (ByCurrency) Less ¶
func (b ByCurrency) Less(i, j int) bool
func (ByCurrency) Swap ¶
func (b ByCurrency) Swap(i, j int)
type ByOrderSide ¶
type ByOrderSide []Detail
ByOrderSide used for sorting orders by order side (buy sell)
func (ByOrderSide) Len ¶
func (b ByOrderSide) Len() int
func (ByOrderSide) Less ¶
func (b ByOrderSide) Less(i, j int) bool
func (ByOrderSide) Swap ¶
func (b ByOrderSide) Swap(i, j int)
type ByOrderType ¶
type ByOrderType []Detail
ByOrderType used for sorting orders by order type
func (ByOrderType) Len ¶
func (b ByOrderType) Len() int
func (ByOrderType) Less ¶
func (b ByOrderType) Less(i, j int) bool
func (ByOrderType) Swap ¶
func (b ByOrderType) Swap(i, j int)
type Cancel ¶
type Cancel struct { Price float64 Amount float64 Exchange string ID string ClientOrderID string AccountID string ClientID string WalletAddress string Type Type Side Side Status Status AssetType asset.Item Date time.Time Pair currency.Pair Trades []TradeHistory }
Cancel contains all properties that may be required to cancel an order on an exchange Each exchange has their own requirements, so not all fields are required to be populated
type CancelAllResponse ¶
CancelAllResponse returns the status from attempting to cancel all orders on an exchange
type ClassificationError ¶
ClassificationError returned when an order status side or type cannot be recognised
func (*ClassificationError) Error ¶
func (o *ClassificationError) Error() string
type Detail ¶
type Detail struct { ImmediateOrCancel bool HiddenOrder bool FillOrKill bool PostOnly bool Leverage string Price float64 Amount float64 LimitPriceUpper float64 LimitPriceLower float64 TriggerPrice float64 TargetAmount float64 ExecutedAmount float64 RemainingAmount float64 Fee float64 Exchange string InternalOrderID string ID string ClientOrderID string AccountID string ClientID string WalletAddress string Type Type Side Side Status Status AssetType asset.Item Date time.Time CloseTime time.Time LastUpdated time.Time Pair currency.Pair Trades []TradeHistory }
Detail contains all properties of an order Each exchange has their own requirements, so not all fields are required to be populated
func (*Detail) UpdateOrderFromDetail ¶
UpdateOrderFromDetail Will update an order detail (used in order management) by comparing passed in and existing values
func (*Detail) UpdateOrderFromModify ¶
UpdateOrderFromModify Will update an order detail (used in order management) by comparing passed in and existing values
type GetOrdersRequest ¶
type GetOrdersRequest struct { Type Type Side Side StartTicks time.Time EndTicks time.Time OrderId string // Currencies Empty array = all currencies. Some endpoints only support // singular currency enquiries Pairs []currency.Pair }
GetOrdersRequest used for GetOrderHistory and GetOpenOrders wrapper functions
type Modify ¶
type Modify struct { ImmediateOrCancel bool HiddenOrder bool FillOrKill bool PostOnly bool Leverage string Price float64 Amount float64 LimitPriceUpper float64 LimitPriceLower float64 TriggerPrice float64 TargetAmount float64 ExecutedAmount float64 RemainingAmount float64 Fee float64 Exchange string InternalOrderID string ID string ClientOrderID string AccountID string ClientID string WalletAddress string Type Type Side Side Status Status AssetType asset.Item Date time.Time LastUpdated time.Time Pair currency.Pair Trades []TradeHistory }
Modify contains all properties of an order that may be updated after it has been created Each exchange has their own requirements, so not all fields are required to be populated
type ModifyResponse ¶
type ModifyResponse struct {
OrderID string
}
ModifyResponse is an order modifying return type
type Side ¶
type Side string
Side enforces a standard for order sides across the code base
const ( AnySide Side = "ANY" Buy Side = "BUY" Sell Side = "SELL" Bid Side = "BID" Ask Side = "ASK" UnknownSide Side = "UNKNOWN" )
Order side types
func StringToOrderSide ¶
StringToOrderSide for converting case insensitive order side and returning a real Side
type Status ¶
type Status string
Status defines order status types
const ( AnyStatus Status = "ANY" New Status = "NEW" Active Status = "ACTIVE" PartiallyCancelled Status = "PARTIALLY_CANCELLED" PartiallyFilled Status = "PARTIALLY_FILLED" Filled Status = "FILLED" Cancelled Status = "CANCELLED" PendingCancel Status = "PENDING_CANCEL" InsufficientBalance Status = "INSUFFICIENT_BALANCE" Rejected Status = "REJECTED" Expired Status = "EXPIRED" Hidden Status = "HIDDEN" UnknownStatus Status = "UNKNOWN" Open Status = "OPEN" )
All order status types
func StringToOrderStatus ¶
StringToOrderStatus for converting case insensitive order status and returning a real Status
type Submit ¶
type Submit struct { ImmediateOrCancel bool HiddenOrder bool FillOrKill bool PostOnly bool Leverage string Price float64 Amount float64 LimitPriceUpper float64 LimitPriceLower float64 TriggerPrice float64 TargetAmount float64 ExecutedAmount float64 RemainingAmount float64 Fee float64 Exchange string InternalOrderID string ID string AccountID string ClientID string ClientOrderID string WalletAddress string Type Type Side Side Status Status AssetType asset.Item Date time.Time LastUpdated time.Time Pair currency.Pair Trades []TradeHistory }
Submit contains all properties of an order that may be required for an order to be created on an exchange Each exchange has their own requirements, so not all fields are required to be populated
type SubmitResponse ¶
SubmitResponse is what is returned after submitting an order to an exchange
type TradeHistory ¶
type TradeHistory struct { Price float64 Amount float64 Fee float64 Exchange string TID string Description string Type Type Side Side Timestamp time.Time IsMaker bool }
TradeHistory holds exchange history data
type Type ¶
type Type string
Type enforces a standard for order types across the code base
const ( AnyType Type = "ANY" Limit Type = "LIMIT" Market Type = "MARKET" PostOnly Type = "POST_ONLY" ImmediateOrCancel Type = "IMMEDIATE_OR_CANCEL" Stop Type = "STOP" StopLimit Type = "STOP LIMIT" TrailingStop Type = "TRAILING_STOP" FillOrKill Type = "FOK" IOS Type = "IOS" UnknownType Type = "UNKNOWN" )
Defined package order types
func StringToOrderType ¶
StringToOrderType for converting case insensitive order type and returning a real Type