cefi.main.CexTrader#
- class cefi.main.CexTrader[source]#
Bases:
objectCEX Object to support multiple centralized exchanges and broker APIs.
- Parameters:
None
- Returns:
None
Initializes the class instance by creating and appending clients based on the configuration in settings.cex.
Checks if the module is enabled by looking at settings.myllm_enabled. If the module is disabled, no clients will be created.
Creates a mapping of library names to client classes. This mapping is used to create new clients based on the configuration.
If a client’s configuration exists in settings.cex_enabled and is truthy, it will be created. Clients are not created if their name is “template” or empty string.
If a client is successfully created, it is appended to the clients list.
If a client fails to be created, a message is logged with the name of the client and the error that occurred.
- Parameters:
None
- Returns:
None
Methods
Retrieves all client classes from the myllm.provider module.
Return account balance.
get_info()Retrieves information about the exchange and the account.
get_pnls(**kwargs)Return account pnl.
return account position.
get_quotes(symbol)Return a list of quotes.
modify_position(order_params)Modify order
submit_order(order_params)Execute order
- get_all_client_classes()[source]#
Retrieves all client classes from the myllm.provider module.
This function imports the cefi.provider module and retrieves all the classes defined in it.
The function returns a dictionary where the keys are the names of the classes and the values are the corresponding class objects.
- Returns:
A dictionary containing all the client classes from the cefi.provider module.
- Return type:
dict
- async get_info()[source]#
Retrieves information about the exchange and the account.
- Returns:
A formatted string containing
the exchange name and the account information. :rtype: str