api.strategies

api.strategies

Functions

Name Description
create_strategy Create a new strategy object.
delete_strategy Delete a strategy from the database.
get_strategies Get all strategies from the database.
get_strategy Get a strategy from the database by name.
save_strategy Save a strategy object to the database.

create_strategy

api.strategies.create_strategy(attrs)

Create a new strategy object.

Parameters

Name Type Description Default
attrs dict[str, Any] The attributes of the strategy object to create. Should adhere to the StrategyModel schema. required

Returns

Name Type Description
IStrategy The strategy object

Raises

Name Type Description
ValueError If the strategy with the given name does not exist. If attrs does not adhere to the StrategyModel schema.

delete_strategy

api.strategies.delete_strategy(name)

Delete a strategy from the database.

Parameters

Name Type Description Default
name str The name of the strategy to delete. required

Raises

Name Type Description
ValueError If the strategy does not exist.

get_strategies

api.strategies.get_strategies()

Get all strategies from the database.

Returns

Name Type Description
dict[str, Any] A dictionary containing all strategies. Includes keys: ‘name’, ‘description’, ‘path’, ‘last_modification_date’, ‘objects’ Each value is a list of the corresponding attribute for each strategy.

get_strategy

api.strategies.get_strategy(name)

Get a strategy from the database by name.

Parameters

Name Type Description Default
name str The name of the strategy to retrieve. required

Returns

Name Type Description
IStrategy The strategy object with the given name.

Raises

Name Type Description
ValueError If the strategy with the given name does not exist.

save_strategy

api.strategies.save_strategy(strategy)

Save a strategy object to the database.

Parameters

Name Type Description Default
strategy IStrategy The strategy object to save. required

Raises

Name Type Description
ValueError If the strategy object is not valid. If the strategy object already exists.
Back to top