display-custom-stats
Display custom stats
Strategies can display custom metrics next to a trading chart. They can be set like in this snippet:
gb.data.pairLedger.sidebarExtras = [
{
label: `Item 1`, // string
value: `Your label`, // string
tooltip: `Tooltip text for this element`, // optional, can be omitted
valueColor: '#e7e7', // optional string with valid css color (hex, rgb, etc)
},
{
label: `Item 2`, // string
value: `Your label`, // string
},
]
GUI Notifications
Custom strategies in Gunbot can send real-time notifications to the GUI for enhanced monitoring.
Use by defining an array of notification objects in your strategy code (normally one item at a time):
gb.data.pairLedger.notifications = [
{ text: 'custom success notification', variant: 'success', persist: true },
{ text: 'custom error notification', variant: 'error' },
{ text: 'custom info notification', variant: 'info', persist: false },
{ text: `multi-line notification\nallows for more info`, variant: 'error', persist: true }
];
Notification Attributes
text
: Message contentvariant
: Color (e.g., 'success' = green, 'error' = red)persist
: Stays visible until dismissed (true
/false
)
Usage & Display
- Add notifications to
pairLedger
in your strategy. - Notifications appear in the GUI and are managed automatically, no need to modify the array after first 'sending' a notification.