quantpylib.gateway.master
Gateway
__init__(config_keys={'binance': {'alias': 'binance', 'key': None, 'secret': None}, 'hyperliquid': {'alias': 'hyperliquid', 'key': None, 'secret': None}, 'bybit': {'key': None, 'secret': None}})
Initialize the Gateway class with the provided configuration keys.
The configuration keys are passed in as dictionaries with the appropriate key-value pair.
An example of the valid key-value format is shown as default arguments.
You can create a .env
file and place your keys there, or set it as environment variables.
All the gateways are available through this master gateway,
by accessing the attribute values gateway.account
, gateway.executor
and so on.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_keys |
dict
|
A dictionary containing configuration keys for different exchange clients.
The key-pair dictionary is formatted as
|
{'binance': {'alias': 'binance', 'key': None, 'secret': None}, 'hyperliquid': {'alias': 'hyperliquid', 'key': None, 'secret': None}, 'bybit': {'key': None, 'secret': None}}
|
Attributes:
Name | Type | Description |
---|---|---|
account |
Account
|
An instance of Account for account related endpoints. |
exchange |
Exchange
|
An instance of Exchange for exchange related endpoints. |
executor |
Executor
|
An instance of Executor for execution related endpoints. |
orders |
Orders
|
An instance of Orders for order related endpoints. |
positions |
Positions
|
An instance of Positions for position related endpoints. |
trades |
Trades
|
An instance of Trades for trades related endpoints. |
transactions |
Transactions
|
An instance of Transactions for transaction related endpoints. |
cleanup_clients()
async
Cleanup all exchange clients that have a cleanup
method.
This method iterates through all the exchange clients and calls their cleanup
method, if it exists.
This is useful for performing any necessary cleanup actions, such as closing connections or releasing resources.
Returns:
Name | Type | Description |
---|---|---|
list |
A list of results from the |
init_clients()
async
Initialize all exchange clients that have an init_client
method.
This method iterates through all the exchange clients and calls their init_client
method, if it exists.
This is useful for setting up any necessary initializations before using the clients.
Returns:
Name | Type | Description |
---|---|---|
list |
A list of results from the |