You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this payload, the signal_type field uniquely identifies the bot. So, for handling the signals from Pionex (or any other crypto exchange like Binance, Bybit, OKX, etc.), you can create a subclass of the Signal class. In your subclass, set the IDENTIFIER_PATH to the key that holds the unique signal identifier - in this case, "signal_type" like the shown in the following example:
fromquantium_signalimportSignalclassPionexSignal(Signal):
IDENTIFIER_PATH="signal_type"if__name__=="__main__":
Signal.run([
# first botPionexSignal(
"signal_type_1",
"https://www.pionex.com/signal/api/v1/signal_listener/trading_view?token=token1"
),
# second botPionexSignal(
"signal_type_2",
"https://www.pionex.com/signal/api/v1/signal_listener/trading_view?token=token2"
),
# other bots of any exchange
])
In the above example, PionexSignal class inherits from Signal and sets IDENTIFIER_PATH to "signal_type", ensuring that your program knows where to find the unique identifier in the incoming JSON and the Signal.run() method takes a list of Signal instances where each instance is configured with a unique identifier (e.g., "signal_type_1") and its corresponding webhook URL. This setup lets you handle signals for multiple bots by simply creating additional subclass instances.
To ensure your signal handler runs continuously, you can set it up as a service using systemd. This will ensure that your signal handler runs in the background continuously, even if you disconnect from your server.
Create a Service File
Create a file named tradingview.service in the /etc/systemd/system directory with the following content:
[Unit]Description=TradingView Signal Handler Service
[Service]WorkingDirectory=/var/www/tradingview
ExecStart=python3 tradingview.py
[Install]WantedBy=multi-user.target
Deploy Your Script
Copy your tradingview.py file to the /var/www/tradingview directory.
Start the Service
Run the following command to start your service:
sudo service tradingview start
Check the Service Status
Verify that everything is running smoothly by checking the service status:
sudo service tradingview status
If you have any questions after reading this guide, please create a new discussion providing the details on what you have done and what went wrong.
documentationImprovements or additions to documentation
1 participant
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
When you create a signal bot on Pionex, the exchange provides a webhook URL and a JSON message that looks like this:
In this payload, the
signal_type
field uniquely identifies the bot. So, for handling the signals from Pionex (or any other crypto exchange like Binance, Bybit, OKX, etc.), you can create a subclass of theSignal
class. In your subclass, set theIDENTIFIER_PATH
to the key that holds the unique signal identifier - in this case,"signal_type"
like the shown in the following example:In the above example,
PionexSignal
class inherits fromSignal
and setsIDENTIFIER_PATH
to"signal_type"
, ensuring that your program knows where to find the unique identifier in the incoming JSON and theSignal.run()
method takes a list ofSignal
instances where each instance is configured with a unique identifier (e.g.,"signal_type_1"
) and its corresponding webhook URL. This setup lets you handle signals for multiple bots by simply creating additional subclass instances.To ensure your signal handler runs continuously, you can set it up as a service using
systemd
. This will ensure that your signal handler runs in the background continuously, even if you disconnect from your server.Create a Service File
Create a file named
tradingview.service
in the/etc/systemd/system
directory with the following content:Deploy Your Script
Copy your
tradingview.py
file to the/var/www/tradingview
directory.Start the Service
Run the following command to start your service:
Check the Service Status
Verify that everything is running smoothly by checking the service status:
If you have any questions after reading this guide, please create a new discussion providing the details on what you have done and what went wrong.
Beta Was this translation helpful? Give feedback.
All reactions