verion 3.0.4

This commit is contained in:
Ichinga Samuel
2023-10-17 05:21:43 +01:00
parent e285610fe5
commit 21043dd326
11 changed files with 167 additions and 3753 deletions
+11 -9
View File
@@ -8,14 +8,16 @@ class Session()
A session is a time period between two datetime.time objects specified in utc.
### Attributes:
|Name|Type|Description|Default|
|---|---|---|---|
|**start**|**datetime.time**|The start time of the session.|None|
|**end**|**datetime.time**|The end time of the session.|None|
|**on_start**|**str**|The action to take when the session starts. Default is None.|None|
|**on_end**|**str**|The action to take when the session ends. Default is None.|None|
|**custom_start**|**Callable**|A custom function to call when the session starts. Default is None.|None|
|**custom_end**|**Callable**|A custom function to call when the session ends. Default is None.|None|
|Name| Type | Description | Default |
|---|----------------|------------------------------------------------------------------------|----|
|**start**| **datetime.time** | The start time of the session. | None |
|**end**| **datetime.time** | The end time of the session. | None |
|**on_start**| **Literal['close_all', 'close_win', 'close_loss', 'custom_start']** | The action to take when the session starts. Default is None. | None |
|**on_end**| **Literal['close_all', 'close_win', 'close_loss', 'custom_end']** | The action to take when the session ends. Default is None. | None |
|**custom_start**| **Callable** | A custom function to call when the session starts. Default is None. | None |
|**custom_end**| **Callable** | A custom function to call when the session ends. Default is None. | None |
|**name**| **str** | The name of the session. Default is a combination of start and finish. | |
|**seconds**| **set[int]** | The set of seconds in the session. | None |
### Methods:
|Name|Description|
@@ -23,7 +25,6 @@ A session is a time period between two datetime.time objects specified in utc.
|**begin**|Call the action specified in on_start or custom_start.|
|**close**|Call the action specified in on_end or custom_end.|
|**action**|Used by begin and close to call the action specified.|
|**delta**|Get the timedelta of a datetime.time object.|
|**until**|Get the seconds until the session starts from the current time.|
### \_\_init\_\_
@@ -49,6 +50,7 @@ Create a session.
|**on_end**| **Literal['close_all', 'close_win', 'close_loss', 'custom_end']** | The action to take when the session ends. Default is None. | None |
|**custom_start**| **Callable** | A custom function to call when the session starts. Default is None. | None |
|**custom_end**| **Callable** | A custom function to call when the session ends. Default is None. | None |
|**name**| **str** | The name of the session. Default is None. | None |
### begin
```python
+17 -5
View File
@@ -162,11 +162,12 @@ This is a dummy method that returns the minimum volume of the symbol. It is mean
Checkout Forex Symbol implementation in [ForexSymbol](#forexsymbol)
#### Arguments:
|Name| Type | Description | Default |
|---|--------------------|-----------------------------|-------------------|
|**amount**| **float** | Amount to risk in the trade | None |
|**pips**| **float** | Number of pips to target | None |
|**use_minimum**| **bool** | If True, the minimum volume is returned if the computed volume is less than the minimum volume. | True |
| Name | Type | Description | Default |
|----------------|--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| **amount** | **float** | Amount to risk in the trade | None |
| **pips** | **float** | Number of pips to target | None |
| **use_limits** | **bool** | If True, the minimum volume is returned if the computed volume is less than the minimum volume and the maximum volume is returned if the computed volume is greater than the maximum volume for the symbol | False |
#### Returns:
|Type|Description|
|---|---|
@@ -308,3 +309,14 @@ Get ticks for the specified date range from the MetaTrader 5 terminal.
|Exception|Description|
|---|---|
|**ValueError**|If request was unsuccessful and None was returned|
### compute_volume
```python
async def compute_volume(*,
amount: float,
pips: float,
use_limits: bool = True) -> float
```
Computes the volume of a trade based on the amount and the number of pips to target.
This is a dummy method that returns the minimum volume of the symbol. It is meant to be overridden by a subclass
Checkout Forex Symbol implementation in [ForexSymbol](#forexsymbol)