SymbolSentiment
interface cAlgo.API Since 5.3
DesktopCLICloud
Represents a symbol sentiment.
Environment behaviour
Cloud — not supported. Reading BuyPercentage/SellPercentage or subscribing Updated blocks the cBot up to 1 minute, then fails with a wait-timeout error.
Definition
public interface SymbolSentiment
Namespace: cAlgo.API · Group: Symbols
Examples
using cAlgo.API;
namespace cAlgo.Robots;
public partial class Test : Robot
{
protected override void OnStart()
{
Print($"Symbol {SymbolName} traders sentiment Buy Percentage: {Symbol.Sentiment.BuyPercentage} and Sell Percentage: {Symbol.Sentiment.SellPercentage}");
}
}
import clr
clr.AddReference("cAlgo.API")
from cAlgo.API import *
class Test():
def on_start(self):
self.print_symbol_sentiment()
api.Symbol.Sentiment.Updated += lambda _: self.print_symbol_sentiment()
def print_symbol_sentiment(self):
print(f"Symbol {api.SymbolName} traders sentiment Buy Percentage: {api.Symbol.Sentiment.BuyPercentage} and Sell Percentage: {api.Symbol.Sentiment.SellPercentage}")
{
"AccessRights": "None"
}
Properties
| Name | Description |
|---|---|
BuyPercentageDesktopCLIClouddouble | Gets buy percentage if available otherwise 0. |
SellPercentageDesktopCLIClouddouble | Gets sell percentage if available otherwise 0. |
Events
| Name | Description |
|---|---|
UpdatedDesktopCLICloudAction<SymbolSentimentUpdatedEventArgs> | Occurs when symbol sentiment data is updated. |