Skip to main content

Possible trend data providers

Social Media

• X/Twitter accounts• YouTube channels• Telegram channels• Reddit subreddits

News / Feeds

• Financial news websites• RSS feeds

External Alerts/Signals

• TradingView alerts• Custom alerts via Webhook

Using realtime trend data providers

You can register multiple trend data providers.
Here is an example that demonstrates how to use the SDK to register to multiple trend data providers:

Register the trend data providers in the init function of your signal:

// register a trend data provider for Elon Musk's X/Twitter account
$this->_elonMuskX = $this->addTrendDataProvider("elonMuskX", new XTrendDataProvider("elonmusk"));
// register a trend data provider for Telegram channel CatfishcallsbyPoe
$this->_catfishcallsByPoeTelegram = $this->addTrendDataProvider("catfishcallsByPoeTelegram", new TelegramTrendDataProvider("CatfishcallsbyPoe"));

Use the trend data in the getSignalInfo function of your signal:

function getSignalInfo(TradeContext $tradeContext):?TradeSignalInfo
{
	if ($this->_elonMuskX->hasNewData())
	{
		$xPost = $this->_elonMuskX->getLatestContent();

		if (str_contains($xPost, "DOGE"))
		{
			// do something
		}
	}

	if ($this->_catfishcallsByPoeTelegram->hasNewData())
	{
		$telegramMessage = $this->_catfishcallsByPoeTelegram->getLatestContent();

		if (str_contains($telegramMessage, "BAI"))
		{
			// do something
		}
	}

	...
}

Full example class

class MultiTrendDataExample extends UserTradeSignalBase
{
	private ?XTrendDataProvider $_elonMuskX = null;
	private ?TelegramTrendDataProvider $_catfishcallsByPoeTelegram = null;

	protected function init(?ParamValues $params = null)
	{
		// register a trend data provider for Elon Musk's X/Twitter account
		$this->_elonMuskX = $this->addTrendDataProvider("elonMuskX", new XTrendDataProvider("elonmusk"));
		// register a trend data provider for Telegram channel CatfishcallsbyPoe
		$this->_catfishcallsByPoeTelegram = $this->addTrendDataProvider("catfishcallsByPoeTelegram", new TelegramTrendDataProvider("CatfishcallsbyPoe"));
	}

	function getSignalInfo(TradeContext $tradeContext):?TradeSignalInfo
	{
		if ($this->_elonMuskX->hasNewData())
		{
			$xPost = $this->_elonMuskX->getLatestContent();

			if (str_contains($xPost, "DOGE"))
			{
				// do something
			}
		}

		if ($this->_catfishcallsByPoeTelegram->hasNewData())
		{
			$telegramMessage = $this->_catfishcallsByPoeTelegram->getLatestContent();

			if (str_contains($telegramMessage, "BAI"))
			{
				// do something
			}
		}

		...
	}
}

SDK Classes

We currently support the following trend data providers:
new XTrendDataProvider(twitterUsername); // hasNewData() triggers on new tweets
new YouTubeTrendDataProvider(channelName); // hasNewData() triggers on new video uploads
new TelegramTrendDataProvider(channelName); // hasNewData() triggers on new messages
new RedditTrendDataProvider(subredditName); // hasNewData() triggers on new posts
new WebsiteTrendDataProvider(websiteUrl); // hasNewData() is not supported. Call getLatestContent() to crawl the website's content
new RSSTrendDataProvider(feedUrl); // hasNewData() triggers on new feed items
new TradingViewTrendDataProvider(alertName); // hasNewData() triggers on new alerts
new WebhookTrendDataProvider(webhookUrl); // hasNewData() triggers on new webhook calls

Class interface

interface ITrendDataProvider
{
	// returns true if new data is available
	function hasNewData():bool;

	// returns the latest content
	// NOTE: there could be multiple new contents available since the last call to hasNewData().
	// Use getPreviousContentId() to get the content id of the last fetched content and getContent(x) to iterate over all new contents if needed.
	function getLatestContent():string;

	// returns the content id of the getLatestContent() content
	function getLatestContentId():int

	// returns the content id of the last call to hasNewData()
	function getPreviousContentId():string;

	// returns the content of the specified id
	function getContent(int $id):int;
}
Missing a data provider you would like to use? Feel free to contact us. Adding a new trend data provider is easy due to our plugin based technology.