Settings API Guide (Swagger API)

This API functionality can be used to make changes to your configuration files without opening the GUI. It is intended for use with external scripts allowing you to automate some aspects of configuration changes based on your own external signals.

You can access the API for your bot by visiting http://localhost:8081/swagger-ui.html.

Upon loading you will see this screen.

From the drop down in the header you have two options. Select settings-api (/v2/api-docs?group=settings-api) or api (/v2/api-docs?group=api).

The Settings-API must be validated using the ProfitTrailer license.

Click the Show/Hide Toggle or List Operations to display the available options. You can individually click on an operation to expand it or use Expand Operations to expand them all.

  • - Delete a named Configuration.
  • - List all Configurations tied to the license.
  • - Switch the active Configuration.
  • - Display the contents of the selected configuration file.
  • - Overwrite the contents of the selected configuration file.

Delete

The delete operation allows you to delete a configuration based on it's unique name.

Parameters:

  • configName - The name of the configuration you wish to delete
  • license - Your ProfitTrailer license

Fill in the two parameters and click to delete the chosen configuration.


List

The list operation lists all named configurations connected to the default API key in use.

Parameters:

  • license - Your ProfitTrailer license

Fill in the license and click to see the list of named configurations.

Here is an example of the output:


Switch

The switch operation changes from one named configuration to another.

Parameters:

  • configName - The name of the configuration you wish to make active
  • license - Your ProfitTrailer license

Fill in the two parameters and click to make the chosen configuration the active configuration.


Load

The load operation allows you to view the contents of a particular configuration file.

Parameters:

  • fileName - The name of the particular configuration file
  • configName - The name of the configuration
  • license - Your ProfitTrailer license

Select the desired fileName, fill in the three parameters and click to view the chosen configuration file.

Here is an example of the output:


Save

Unfortunately at the moment Swagger API does not permit us to enter the required line breaks to successfully save an entire configuration file. The save function can only be used successfully for Hotconfig entries until this is resolved.

The save operation allows you to overwrite the contents of a particular configuration file. It replaces the entire file.

Parameters:

  • fileName - The name of the particular configuration file
  • configName - The name of the configuration
  • saveData - The contents (settings) you wish to overwrite the file with.
  • license - Your ProfitTrailer license

Select the desired fileName, fill in the three parameters and click to overwrite the configuration file.

Curl Example

you have to encode the special signs like =, ' ', \n

equal-sign = %3D
whitespace = %20
linebreak = %0A

using curl it looks like this:

curl -d "license=xxx&fileName=INDICATORS&saveData=#BB_candle_period%20%3D%20300%0A#BB_sma%20%3D%202%0A%0A" http://localhost:8081/settingsapi/settings/save

would set

#BB_candle_period = 300
#BB_std = 2


The API requires server.api_token to authenticate the calls.

Click the Show/Hide Toggle or List Operations to display the available options. You can individually click on an operation to expand it or use Expand Operations to expand them all.

Example Usage: http://localhost:8081/api/sales/log?token=[server.api_token]

Enter your comment:
 
  • swagger_api.txt
  • Last modified: 8 weeks ago
  • by t1m3c