Articles on: Signals and Automation

Webhook Signals: Testing and Errors

How to test


There are two useful ways to test the webhook signals and code.

In the JSON code, use “test”: true to send the signal as a test signal. This will create Pending orders in Altrady that can be checked. Otherwise, live orders will be created.
Test using a paper trading account.
Test the syntax in Swagger:
First, exclude any Trading View special names e.g. {{ price }}, {{ time }}. These can be replaced with appropriate fixed values, e.g 123.45 and "2024-08-31 03:00:00", respectively. If used, the value of the Signal ID must be unique in every signal, including for test signals in Swagger.
Paste
Use "test": true while testing. If this is not used, the signal will be sent to the bot and potentially a position will be opened/closed etc.
Try it now
See below for error messages when testing in Swagger or sending live signals



Error messages in Swagger and Runtime errors

Successful Result: Response Code = 201 (200, 202, 203 etc)
A 20x response code means the syntax was correct, the bot was found, the secret matched, exchange and symbol matched bot and the signal was received.
Some types of signals do not return a Response Body, e.g. Close, Start and Stop signals.

The Response Body includes success and error messages. Response Code is 20x if successful

Most error messages are self-explanatory.
Check the Signal Bot Settings and JSON code articles for details of how to specific values.
The exception is the first one listed in the table below, which is always the result of a syntax error in the JSON code. Check carefully and make sure if matches our documentation.
Incorrect setting names for optional settings are ignored, instead of resulting in an error. E.g. "adjustfee": false does not result in an error and is instead defaulted to "adjust_fee": true.

Error MessageMeaning
message body does not match declared format\nResolution:\n when specifying application/json as content-type, you must pass valid application/json in the request's 'body'Syntax error in the JSON. Double check commas, brackets, braces, double quotes, etc. This error can also occur if the code was created or edited in a non-text editor.
Signal bot not foundInvalid API key
Invalid secretAPI Key is valid and found, but API secret is incorrect
Market not foundThe value for market does not match any market. Recheck the format for the market or use Altrady's default format "EXCH_QUOTE_BASE", e.g. "KUCN_USDT_BTC"
Exchange missingEither exchange was not specified, or the value was not valid.
side is missing"side": "long" or "side": "short" is required for this signal action
order_type is missing"order_type": "limit" or "order_type": "market" is required for this signal action
price is missingthe setting for "price" is required for this signal action, but is missing. When a Limit order is specified for a Close signal, the signal_price setting must be included
signal_price is invalid, price is missingThis is a double whammy. "signal_price" should not be used for this signal type. And "price" is required but missing.
price is invalid, price must be greater than zeroThe value for the "price" setting is zero, or non-numeric.
404: Not FoundThere were no syntax errors. For a Close signal, this means that no positions were found to Close.


Checking the signal


The signal sent by Trading view can be seen in teh TV Alert Log.
The signal details in Altrady can be viewed on the Overview, Positions and Error Log pages of the Signal Bot, by clicking on the i next to the market name.



Signal Bot Error Log


The SIgnal Bot error log lists errors that occur after the signal is successfully received, but the signal is not actioned.
Common warnings and ewrrors are describer here: Signal Bot Processing, FAQ and Error Log messages


Webhook and Trading View SIgnals: Overview
Webhook: Setting up the Signal Bot
Webhook Signals: Open, Close, Increase or Reverse a Position
Webhook Signals: start or stop a Signal Bot
Valid values for Exchange and Symbol
Webhook Signals: Trading View Setup

Updated on: 21/10/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!