Skip to main content

Send Notifications to Gunbot GUI

In Gunbot, custom strategies can send notifications directly to the graphical user interface (GUI). This feature enhances the monitoring of trading activities by providing real-time communication between your strategies and the GUI.

How to Create Notifications

To create notifications, you need to structure an array of notification objects in your custom strategy code. Each object represents a unique message. Here's an example:

gb.data.pairLedger.notifications = [
{
text: 'custom success notification',
variant: 'success', // green
persist: true // notification stays visible until dismissed
},
{
text: 'custom error notification',
variant: 'error', // red
},
{
text: 'custom info notification',
variant: 'info', // blue
persist: false
},
{
text: `multi-line notification

allows for more information spread over
multiple lines of text`,
variant: 'error',
persist: true,
}
];

Attributes of Notification Objects

Each notification object can include:

  • text: The message for display.
  • variant: The notification color (e.g., 'success' for green, 'error' for red).
  • persist: Indicates if the notification should stay visible until dismissed.

Implementing Notifications in Custom Strategies

Incorporate these notification objects into your custom strategy code to facilitate real-time updates and alerts within the GUI.

Viewing Notifications in the GUI

Notifications added to the pair ledger are visible in the GUI. The GUI manages their lifecycle, removing them once acknowledged.

Example of a GUI Notification

Example of a GUI notification