version 3.12

This commit is contained in:
Ichinga Samuel
2024-01-01 05:25:41 +01:00
parent 0dad24f38e
commit 4b5f267509
29 changed files with 995 additions and 513 deletions
+10 -10
View File
@@ -1,7 +1,7 @@
## <a id="bot_builder"></a> Bot Builder
```python
class Bot()
class Bot
```
The bot class. Create a bot instance to run your strategies.
### Attributes:
@@ -25,27 +25,27 @@ Prepares the bot by signing in to the trading account and initializing the symbo
```python
def execute()
```
Execute the bot. This method calls start internally. To enable you run your bot outside of an async function.
Execute the bot.
### start
```python
async def start()
```
Starts the bot by calling the initialize method and running the strategies in the executor.
Initialize the bot and execute it. Similar to calling `execute` method but is a coroutine.
### add_coroutine
```python
def add_coroutine(coro: Coroutine, **kwargs)
```
#### Arguments:
#### Parameters:
|Name|Type|Description|
|---|---|---|
|**coro**|**Coroutine**|A coroutine to run in the executor|
### add_function
```python
def add_coroutine(func: Callable, **kwargs)
def add_function(func: Callable, **kwargs)
```
#### Arguments:
#### Parameters:
| Name | Type | Description |
|----------|--------------|-----------------------------------|
| **func** | **Callable** | A function to run in the executor |
@@ -55,7 +55,7 @@ def add_coroutine(func: Callable, **kwargs)
def add_strategy(strategy: Strategy)
```
Add a strategy to the executor. An added strategy will only run if it's symbol was successfully initialized.
#### Arguments:
#### Parameters:
|Name|Type|Description|
|---|---|---|
|**strategy**|**Strategy**|A Strategy instance to run on bot|
@@ -65,7 +65,7 @@ Add a strategy to the executor. An added strategy will only run if it's symbol w
def add_strategies(strategies: Iterable[Strategy])
```
Add multiple strategies at the same time
#### Arguments:
#### Parameters:
|Name|Type|Description|
|---|---|---|
|**strategies**|**Iterable[Strategy]**|An iterable of Strategy instances|
@@ -76,7 +76,7 @@ def add_strategy_all(*, strategy: Type[Strategy], params: dict | None = None)
```
Use this to run a single strategy on all available instruments in the market using the default parameters
i.e one set of parameters for all trading symbols
#### Arguments
#### Parameters:
|Name|Type|Description|
|---|---|---|
|**strategy**|**Type[Strategy]**|A Strategy class|
@@ -95,7 +95,7 @@ async def init_symbol(symbol: Symbol) -> Symbol
Initialize a symbol before the beginning of a trading session.
Removes it from the list of symbols if it was not successfully initialized or not available
for the account.
#### Arguments:
#### Parameters:
|Name|Type|Description|
|---|---|---|
|**symbol**|**Symbol**|A Symbol instance|