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

The save function can only be used successfully for Hotconfig entries.

Parameters:

  • fileName - The name of the particular configuration file
  • configName - Currently only `HOTCONFIG` allowed
  • saveData - The `HOTCONFIG` lines you want to save
  • license - Your ProfitTrailer license

Select the desired fileName, fill in the three parameters and click to save your setting.

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=HOTCONFIG&saveData=XXX_bought_price%20%3D%200.01" http://localhost:8081/settingsapi/settings/save

would send

`XXX_bought_price = 0.1`


SaveAll

Unfortunately at the moment Swagger API UI does not permit us to enter the required line breaks to successfully save an entire configuration file. But use your programming language of choice to do so.

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
  • pairsData - The contents (settings) you wish to overwrite the PAIRS config with (cannot be empty).
  • dcaData - The contents (settings) you wish to overwrite the DCA config with (cannot be empty).
  • indicatorsData - The contents (settings) you wish to overwrite the INDICATORS config with (cannot be empty).
  • license - Your ProfitTrailer license

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


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]

  • swagger_api.txt
  • Last modified: 6 weeks ago
  • by armchairguru