GetDataSource

Modified on 2013/05/11 11:50 by Eugene — Categorized as: Community Components

Syntax


public static DataSource GetDataSource(this WealthScript obj)
public static DataSource GetDataSource(this string dataSetName)
public static DataSource GetDataSource(this int barInterval, string staticProviderString)

public DataSource GetDataSource() public DataSource GetDataSource(string dataSetName) public DataSource GetDataSource(int barInterval, string staticProviderString)

Parameter Description

dataSetNameName of the DataSet associated with the DataSource to be returned
barIntervalBar Interval of the DataStore
staticProviderStringName of the Static Provider

Description

GetDataSource is a Utility class function that returns the current DataSource object or the one that will by identified by the specified parameters. GetDataSource is used by the PositionHelper class in order to facilitate locating the WL data files, which are read by the SetTimeOfDayPriority method.

Example

Example using C# extension methods:


using System;
using System.Text;
using WealthLab;
using WealthLab.Indicators;

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // Call the method DataSource ds = this.GetDataSource(); // The name of this DataSource Provider PrintDebug( ds.ProviderName ); } } }

Legacy syntax example:


using System;
using System.Text;
using WealthLab;
using WealthLab.Indicators;
using Community.Components; /*** Requires installation of Community.Components Extension from www.wealth-lab.com > Extensions ***/

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { /* Create an instance of the Utility class that holds the method, passing it a WealthScript object (required) as "this" */ Community.Components.Utility u = new Community.Components.Utility(this);

// Call the method DataSource ds = u.GetDataSource(); // The name of this DataSource Provider PrintDebug( ds.ProviderName ); } } }