Order
Table of contents
Order
Trade order related functions and attributes. Subclass of TradeRequest.
__init__
Initialize the order object with keyword arguments, symbol must be provided.
Provides default values for action, type_time and type_filling if not provided.
Arguments
| Name |
Type |
Description |
Default |
action |
TradeAction |
Trade action |
TradeAction.DEAL |
type_time |
OrderTime |
Order time |
OrderTime.DAY |
type_filling |
OrderFilling |
Order filling |
OrderFilling.FOK |
Get the total number of active orders.
Returns
| Type |
Description |
int |
total number of active orders |
get_order
Get an active trade order by ticket.
get_orders
Get active trade orders. If ticket is provided, it will return the order with the specified ticket.
If symbol is provided, it will return all orders for the specified symbol.
If group is provided, it will return all orders for the specified group.
Parameters
| Name |
Type |
Description |
Default |
ticket |
int |
Order ticket |
0 |
symbol |
str |
Symbol name |
'' |
group |
str |
Group name |
'' |
Returns
| Type |
Description |
tuple[TradeOrder] |
A Tuple of active trade orders as TradeOrder objects |
Raises
| Exception |
Description |
OrderError |
If not successful |
check
Check funds sufficiency for performing a required trading operation and the possibility of executing it at the current market price.
Returns
| Type |
Description |
OrderCheckResult |
An OrderCheckResult object |
Raises:
| Exception |
Description |
OrderError |
If not successful |
send
Send a request to perform a trading operation from the terminal to the trade server.
Returns
| Type |
Description |
OrderSendResult |
An OrderSendResult object |
Raises:
| Exception |
Description |
OrderError |
If not successful |
calc_margin
Return the required margin in the account currency to perform a specified trading operation.
Returns
| Type |
Description |
float |
Returns float value if successful |
Raises
| Exception |
Description |
OrderError |
If not successful |
calc_profit
Return profit in the account currency for a specified trading operation.
Returns
| Type |
Description |
float |
Returns float value if successful |
None |
If not successful |