TradersYard Social Trading

GetSharingSourceForTY(Action<IEnumerable<ISocialChannel>, Exception> callback)

Description

This method is used to get the user TraderYard groups list where post can be shared. Can be used in OnInit() and OnCalculate()

Usage

GetSharingSourceForTY(Action<IEnumerable<ISocialChannel>, Exception> callback);

Parameter

callback - method which will be called when will get a list of the user group in ISocialChannel and if some error will arise Exception will contain an explanation.

Return Value none

Example

protected override void OnInit()
{
  GetSharingSourceForTY(GetChenalDes);
}

private void GetChenalDes(IEnumerable<ISocialChannel> channels, Exception exception)
{  
  if (exception == null)
  {
    foreach (var channel in channels)
      if (channel.DisplayName.Equals("My Account"))
        Log(string.Format("You can share post to {0}", channel.DisplayName),InfoLogLevel.Info);
  }
  else
  {
    Log(string.Format("You cant get TY channels list because: {0}", exception.Message), InfoLogLevel.Alert);
  }  
}

GetPost()

Description

This method is used to get post from the current chart. Which will contain a chart image and message with instrument and timeframe.

Usage

Chart.GetPost();

Parameter

none

Return Value SocialNetworkPost - post from the current chart which will contain chart image and message with instrument and timeframe.

Example

protected override void OnCalculate()
{
  var post = Chart?.GetPost();
}

GetChartPostWithAnalytics

Description

This method is used to get post from the current chart with drawings. Which will contain a chart image(with displayed drawings) and a message with instrument and timeframe. This method also can throw “TradersYardException“ exceptions when chart doesn't have a drawing.

Usage

Chart.GetChartPostWithAnalytics();

Parameter

none

Return Value SocialNetworkPost - post from the current chart which will contain chart image with drawings and message with instrument and timeframe.

Example

protected override void OnCalculate()
{
  var post = Chart?.GetChartPostWithAnalytics();
}

GetChartPostWithOrdersSetup

Description

This method is used to get post from the current chart with orders. Which will contain a chart image(include orders) and message with instrument and timeframe. This method also can throw “KeyNotFoundException“ exceptions when the chart doesn't have an open order.

Usage

Chart.GetChartPostWithOrdersSetup();

Parameter

none

Return Value SocialNetworkPost - post from the current chart which will contain chart image with orders and message with instrument and timeframe.

Example

protected override void OnCalculate()
{
  var post = Chart?.GetChartPostWithOrdersSetup();
}

GetChartPostWithAtPlusPlusSetupTool

Description

This method is used to get post from the current chart with drawings. Which will contain a chart image(with displayed orders), a message with instrument and timeframe, and AT Analysis as attached file. This method also can throw “KeyNotFoundException“ exceptions when the chart doesn't have an open order or “TradingAtPlusPlusSetupSharedContent“ when ATpp not running currently.

Usage

Chart.GetChartPostWithAtPlusPlusSetupTool();

Parameter

none

Return Value SocialNetworkPost - post from the current chart which will contain chart image with orders and message with instrument and timeframe.

Example

protected override void OnCalculate()
{
  var post = Chart?.GetChartPostWithAtPlusPlusSetupTool();
}

SharePostToTY(SocialNetworkPost post, ISocialChannel source)

Description

This method uses for sharing posts to TradersYard. For this method, there is a restriction that it can be performed no more than once every 0.5s. Otherwise, the OverflowException will be throw.

Usage

SharePostToTY(post, source);

Parameter

post - a post to be published in TradersYard. One of the fields ImageFunc, Message, Document mast is set it is also possible to set all fields.

source - a group where post will be created. Can be empty if the field Channels of the post are set.

Return Value none

Example

private bool _messageNotSend = true;
private ISocialChannel chanelToShare;

protected override void OnInit()
{
  GetShearingSourceForTY(GetChenalDes);
}

protected override void OnCalculate()
{
  if (_messageNotSend && chanelToShare != null)
  {
    var post = Chart.GetChartPostWithAnalytics();
    SharePostToTY(post, chanelToShare);
    _messageNotSend = false;
  }
}

private void GetChenalDes(IEnumerable<ISocialChannel> channels, Exception exception)
{
  if (exception == null)
  {
    foreach (var channel in channels)
      if (channel.DisplayName.Equals("My Account"))
        chanelToShare = channel;
  }
  else
  {
    Log(string.Format("You cant get TY channels list because: {0}", exception.Message), InfoLogLevel.Alert);
  }
}

Last updated