Skip to content

SymbolSentiment.Updated

event · SymbolSentiment · cAlgo.API Since 5.3

DesktopCLICloud

Occurs when symbol sentiment data is updated.

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

event Action<SymbolSentimentUpdatedEventArgs> Updated;
symbolSentiment.Updated += handler  # handler(obj: SymbolSentimentUpdatedEventArgs)

Examples

protected override void OnStart()
{
    Symbol.Sentiment.Updated += OnSentimentUpdated;
}

private void OnSentimentUpdated(SymbolSentimentUpdatedEventArgs args)
{
    Print("{0} sentiment, buy: {1}%, sell: {2}%", args.SymbolName, args.Sentiment.BuyPercentage, args.Sentiment.SellPercentage);
}
def on_start(self):
    api.Symbol.Sentiment.Updated += self.on_sentiment_updated

def on_sentiment_updated(self, args):
    api.Print(f"{args.SymbolName} sentiment, buy: {args.Sentiment.BuyPercentage}%, sell: {args.Sentiment.SellPercentage}%")