Constants¶
pdmt5.constants ¶
MetaTrader 5 constant parsing helpers.
COPY_TICKS_MAP
module-attribute
¶
ORDER_TYPE_MAP
module-attribute
¶
TIMEFRAME_MAP
module-attribute
¶
__all__
module-attribute
¶
__all__ = [
"COPY_TICKS_MAP",
"ORDER_TYPE_MAP",
"TIMEFRAME_MAP",
"get_copy_ticks_name",
"get_copy_ticks_value",
"get_order_type_name",
"get_order_type_value",
"get_timeframe_name",
"get_timeframe_value",
"list_copy_ticks_names",
"list_copy_ticks_values",
"list_order_type_names",
"list_order_type_values",
"list_timeframe_names",
"list_timeframe_values",
"parse_copy_ticks",
"parse_order_type",
"parse_timeframe",
]
get_copy_ticks_name ¶
Return the MT5 COPY_TICKS name for an integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
COPY_TICKS integer value. |
required |
prefer_alias
|
bool
|
Return the short alias instead of the official name. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The matching COPY_TICKS name. |
Source code in pdmt5/constants.py
get_copy_ticks_value ¶
Return the integer value for an MT5 COPY_TICKS name or alias.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Official COPY_TICKS name or short alias. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The matching COPY_TICKS integer. |
Source code in pdmt5/constants.py
get_order_type_name ¶
Return the MT5 ORDER_TYPE name for an integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
ORDER_TYPE integer value. |
required |
prefer_alias
|
bool
|
Return the short alias instead of the official name. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The matching ORDER_TYPE name. |
Source code in pdmt5/constants.py
get_order_type_value ¶
Return the integer value for an MT5 ORDER_TYPE name or alias.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Official ORDER_TYPE name or short alias. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The matching ORDER_TYPE integer. |
Source code in pdmt5/constants.py
get_timeframe_name ¶
Return the MT5 timeframe name for an integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
int
|
Timeframe integer value. |
required |
prefer_alias
|
bool
|
Return the short alias instead of the official name. |
False
|
Returns:
| Type | Description |
|---|---|
str
|
The matching timeframe name. |
Source code in pdmt5/constants.py
get_timeframe_value ¶
Return the integer value for an MT5 timeframe name or alias.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Official timeframe name or short alias. |
required |
Returns:
| Type | Description |
|---|---|
int
|
The matching timeframe integer. |
Source code in pdmt5/constants.py
list_copy_ticks_names ¶
Return MT5 COPY_TICKS names for JSON schema generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_aliases
|
bool
|
Include short aliases such as |
True
|
Returns:
| Type | Description |
|---|---|
list[str]
|
Accepted COPY_TICKS names. |
Source code in pdmt5/constants.py
list_copy_ticks_values ¶
Return valid MT5 COPY_TICKS integer values for JSON schema generation.
Returns:
| Type | Description |
|---|---|
list[int]
|
Valid COPY_TICKS integer values. |
list_order_type_names ¶
Return MT5 ORDER_TYPE names for JSON schema generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_aliases
|
bool
|
Include short aliases such as |
True
|
Returns:
| Type | Description |
|---|---|
list[str]
|
Accepted ORDER_TYPE names. |
Source code in pdmt5/constants.py
list_order_type_values ¶
Return valid MT5 ORDER_TYPE integer values for JSON schema generation.
Returns:
| Type | Description |
|---|---|
list[int]
|
Valid ORDER_TYPE integer values. |
list_timeframe_names ¶
Return MT5 timeframe names for JSON schema generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
include_aliases
|
bool
|
Include short aliases such as |
True
|
Returns:
| Type | Description |
|---|---|
list[str]
|
Accepted timeframe names. |
Source code in pdmt5/constants.py
list_timeframe_values ¶
Return valid MT5 timeframe integer values for JSON schema generation.
Returns:
| Type | Description |
|---|---|
list[int]
|
Valid timeframe integer values. |
parse_copy_ticks ¶
Parse a MetaTrader 5 COPY_TICKS name, alias, or integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
Official name ( |
required |
Returns:
| Type | Description |
|---|---|
int
|
The validated MetaTrader 5 COPY_TICKS integer. |
Source code in pdmt5/constants.py
parse_order_type ¶
Parse a MetaTrader 5 ORDER_TYPE name, alias, or integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
Official name ( |
required |
Returns:
| Type | Description |
|---|---|
int
|
The validated MetaTrader 5 ORDER_TYPE integer. |
Source code in pdmt5/constants.py
parse_timeframe ¶
Parse a MetaTrader 5 timeframe name, alias, or integer value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
object
|
Official name ( |
required |
Returns:
| Type | Description |
|---|---|
int
|
The validated MetaTrader 5 timeframe integer. |