package
0.0.0-20250311023717-5c21e974eed8
Repository: https://github.com/thrasher-corp/gocryptotrader.git
Documentation: pkg.go.dev

# README

GoCryptoTrader package Order

Build Status Software License GoDoc Coverage Status Go Report Card

This order package is part of the GoCryptoTrader codebase.

This is still in active development

You can track ideas, planned features and what's in progress on our GoCryptoTrader Kanban board.

Join our slack to discuss all things related to GoCryptoTrader! GoCryptoTrader Slack

Current Features for order

  • This package services the exchanges package with order handling.

    • Creation of order
    • Deletion of order
    • Order tracking
  • For futures orders, this package also contains a futures position controller. It is responsible for tracking all futures orders that GoCryptoTrader processes. It keeps a running history of realised and unreaslied PNL to allow a trader to track their profits. Positions are closed once the exposure reaches zero, then upon a new futures order being processed, a new position is created. To view futures positions, see the GRPC command getfuturesposition

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:

bc1qk0jareu4jytc0cfrhr5wgshsq8282awpavfahc

# Functions

CopyPointerOrderSlice returns a copy of all order detail and returns a slice of pointers.
FilterOrdersByPairs removes any order details that do not match the provided currency pairs list.
FilterOrdersBySide removes any order details that don't match the order status provided.
FilterOrdersByTimeRange removes any OrderDetails outside of the time range.
FilterOrdersByType removes any order details that don't match the order type provided.
IsValidOrderSubmissionSide validates that the order side is a valid submission direction.
SortOrdersByCurrency the caller function to sort orders.
SortOrdersByDate the caller function to sort orders.
SortOrdersByPrice the caller function to sort orders.
SortOrdersBySide the caller function to sort orders.
SortOrdersByType the caller function to sort orders.
StringToOrderSide for converting case insensitive order side and returning a real Side.
StringToOrderStatus for converting case insensitive order status and returning a real Status.
StringToOrderType for converting case insensitive order type and returning a real Type.
StringToTrackingMode converts TrackingMode instance from string.

# Constants

All order status types.
Order side types.
All order status types.
Defined package order types.
Order side types.
All order status types.
Order side types.
Order side types.
All order status types.
All order status types.
chase order.
All order status types.
Order side types.
One-way stop order.
Order side types.
Order side types.
Order side types.
Order side types.
Order side types.
Order side types.
Distance fixed amount away from the market price.
Backtester signal types.
All order status types.
All order status types.
Defined package order types.
All order status types.
Defined package order types.
price types.
All order status types.
Defined package order types.
price types.
Defined package order types.
All order status types.
Defined package order types.
Order side types.
Defined package order types.
market-maker-protection used with portfolio margin mode.
market-maker-protection and post-only mode.
All order status types.
price types.
Order side types.
All order status types.
One-cancels-the-other order.
All order status types.
Defined package order types.
All order status types.
All order status types.
All order status types.
All order status types.
All order status types.
Percentage fixed percentage away from the market price.
Defined package order types.
All order status types.
Order side types.
Order side types.
Defined package order types.
Defined package order types.
Defined package order types.
All order status types.
Defined package order types.
Defined package order types.
Defined package order types.
Order side types.
Defined package order types.
time-weighted average price.
price types.
Order side types.
All order status types.
Defined package tracking modes.
Defined package order types.

# Variables

Public errors for order limits.
Public errors for order limits.
amount is not divisible by its step.
var error definitions.
Public error vars for order package.
var error definitions.
var error definitions.
var error definitions.
Public errors for order limits.
Public errors for order limits.
Public errors for order limits.
Public error vars for order package.
var error definitions.
var error definitions.
Public errors for order limits.
var error definitions.
Public errors for order limits.
Public errors for order limits.
Public errors for order limits.
amount is not divisible by its step for a market order.
var error definitions.
ErrNoRates is returned when no margin rates are returned when they are expected.
Public errors for order limits.
var error definitions.
var error definitions.
Public error vars for order package.
var error definitions.
Public errors for order limits.
Public errors for order limits.
price is not divisible by its step.
var error definitions.
var error definitions.
var error definitions.
var error definitions.
var error definitions.
Public error vars for order package.
Public error vars for order package.
Public error vars for order package.
var error definitions.
var error definitions.

# Structs

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.
CancelAllResponse returns the status from attempting to cancel all orders on an exchange.
CancelBatchResponse returns the status of orders that have been requested for cancellation.
ClassificationError returned when an order status side or type cannot be recognised.
Detail contains all properties of an order Each exchange has their own requirements, so not all fields are required to be populated.
ExecutionLimits defines minimum and maximum values in relation to order size, order pricing, total notional values, total maximum orders etc for execution on an exchange.
Filter contains all properties an order can be filtered for empty strings indicate to ignore the property otherwise all need to match.
MinMaxLevel defines the minimum and maximum parameters for a currency pair for outbound exchange execution.
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.
ModifyResponse is an order modifying return type.
MultiOrderRequest used for GetOrderHistory and GetOpenOrders wrapper functions.
RiskManagement represents a risk management detail information.
RiskManagementModes represents take-profit and stop-loss risk management methods.
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 need to be populated.
SubmitResponse is what is returned after submitting an order to an exchange.
TradeHistory holds exchange history data.

# Type aliases

ByCurrency used for sorting orders by order currency.
ByDate used for sorting orders by order date.
ByOrderSide used for sorting orders by order side (buy sell).
ByOrderType used for sorting orders by order type.
ByPrice used for sorting orders by price.
FilteredOrders defines orders that have been filtered at the wrapper level forcing required filter operations when calling method Filter() on MultiOrderRequest.
PriceType enforces a standard for price types used for take-profit and stop-loss trigger types.
Side enforces a standard for order sides across the code base.
Status defines order status types.
TrackingMode defines how the stop price follows the market price.
Type enforces a standard for order types across the code base.