本文整理汇总了C#中BarType类的典型用法代码示例。如果您正苦于以下问题:C# BarType类的具体用法?C# BarType怎么用?C# BarType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BarType类属于命名空间,在下文中一共展示了BarType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add(InstrumentList instruments, BarType barType, long barSize)
{
foreach (Instrument current in instruments)
{
this.Add(current, barType, barSize);
}
}
示例2: BarDataTypeItem
public BarDataTypeItem(BarType barType, long barSize)
: base(DataType.Bar)
{
this.barType = barType;
this.barSize = barSize;
this.key = string.Format("{0}{1}", (object) barType, (object) barSize);
}
示例3: BarTypeSizeToString
public static string BarTypeSizeToString(BarType barType, long barSize)
{
switch (barType)
{
case BarType.Time:
if (barSize == 86400L)
return "Daily";
if (barSize % 86400L == 0L)
return string.Format("{0} day", barSize / 86400);
if (barSize % 3600L == 0L)
return string.Format("{0} hour", (object)(barSize / 3600L));
if (barSize % 60L == 0L)
return string.Format("{0} min", (object)(barSize / 60L));
else
return string.Format("{0} sec", (object)barSize);
case BarType.Tick:
return string.Format("{0} tick", (object)barSize);
case BarType.Volume:
return string.Format("{0} vol", (object)barSize);
case BarType.Range:
return string.Format("{0} range", (object)((double)barSize / 10000.0));
default:
throw new ArgumentException(string.Format("Unknown bar type - {0}", barType));
}
}
示例4: BarFactoryItem
protected BarFactoryItem(Instrument instrument, BarType barType, long barSize)
{
this.factory = null;
this.instrument = instrument;
this.barType = barType;
this.barSize = barSize;
}
示例5: BarSeries
///<summary>
/// Gets bar series by instrument, bar type and bar size
///</summary>
public BarSeries this [Instrument instrument, BarType barType, long barSize]
{
get
{
return new BarSeries(FreeQuant.Instruments.DataManager.Bars[Map.OQ_FQ_Instrument[(object)instrument] as FreeQuant.Instruments.Instrument, EnumConverter.Convert(barType), barSize]);
}
}
示例6: CreateNewBar
protected void CreateNewBar(BarType barType, DateTime beginTime, DateTime endTime, double price)
{
if (barType == BarType.Time && this.newBarSize == 86400)
this.bar = new Bar(new FreeQuant.Data.Daily(beginTime, price, price, price, price, 0));
else
this.bar = new Bar(new FreeQuant.Data.Bar(EnumConverter.Convert(barType), this.newBarSize, beginTime, endTime, price, price, price, price, 0, 0));
}
示例7: TryGetBarTypeSize
public static bool TryGetBarTypeSize(string seriesName, out BarType barType, out long barSize)
{
DataSeriesInfo dataSeriesInfo = DataSeriesHelper.GetDataSeriesInfo(seriesName);
barType = dataSeriesInfo.BarType;
barSize = dataSeriesInfo.BarSize;
return dataSeriesInfo.DataType == DataType.Bar;
}
示例8: CreateNewBar
protected void CreateNewBar(BarType barType, DateTime beginTime, DateTime endTime, double price)
{
if (barType == BarType.Time && this.barSize == 86400)
this.bar = new Daily(beginTime, price, price, price, price, 0);
else
this.bar = new Bar(barType, this.barSize, beginTime, endTime, price, price, price, price, 0, 0);
}
示例9: GetHistoricalBars
public static BarSeries GetHistoricalBars(Instrument instrument, DateTime begin, DateTime end, BarType barType, long barSize)
{
FreeQuant.Instruments.Instrument instrument1 = Map.OQ_FQ_Instrument[(object)instrument] as FreeQuant.Instruments.Instrument;
if (barSize == 86400)
return new BarSeries((FreeQuant.Series.BarSeries)FreeQuant.Instruments.DataManager.GetDailySeries(instrument1, begin, end));
else
return new BarSeries(FreeQuant.Instruments.DataManager.GetBarSeries(instrument1, begin, end, EnumConverter.Convert(barType), barSize));
}
示例10: BarSeries
public BarSeries this[Instrument instrument, BarType barType, long barSize]
{
get
{
SmartQuant.Instruments.Instrument instrument2 = Map.OQ_SQ_Instrument[instrument] as SmartQuant.Instruments.Instrument;
return new BarSeries(SmartQuant.Instruments.DataManager.Bars[instrument2, EnumConverter.Convert(barType), barSize]);
}
}
示例11: GetBarPrefab
private Bar GetBarPrefab(BarType barType) {
if (barType == BarType.PlainBar) return plainBarPrefab;
else if (barType == BarType.ButtonBar) return buttonBarPrefab;
else {
Debug.LogError("invalid bar type: " + barType.ToString());
return null;
}
}
示例12: GetHistoricalBars
public static BarSeries GetHistoricalBars(Instrument instrument, DateTime begin, DateTime end, BarType barType, long barSize)
{
SmartQuant.Instruments.Instrument instrument2 = Map.OQ_SQ_Instrument[instrument] as SmartQuant.Instruments.Instrument;
if (barSize == 86400L)
{
return new BarSeries(SmartQuant.Instruments.DataManager.GetDailySeries(instrument2, begin, end));
}
return new BarSeries(SmartQuant.Instruments.DataManager.GetBarSeries(instrument2, begin, end, EnumConverter.Convert(barType), barSize));
}
示例13: Contains
public bool Contains(BarType barType, long barSize)
{
foreach (BarRequest barRequest in this.list)
{
if (barSize == barRequest.BarSize && barType == barRequest.BarType)
return true;
}
return false;
}
示例14: Contains
public bool Contains(BarType barType, long barSize)
{
if (!this.Enabled) return true;
foreach (BarFilterItem item in this.Items)
{
if (item.BarType == barType && item.BarSize == barSize)
return item.Enabled;
}
return false;
}
示例15: SeriesNameToBarTypeSize
private static bool SeriesNameToBarTypeSize(string name, out BarType barType, out long barSize)
{
barType = BarType.Range;
barSize = -1L;
string[] strArray = name.Split(new char[1]
{
'.'
});
if (strArray.Length >= 4 && strArray[strArray.Length - 3] == "Bar" && Enum.IsDefined(typeof(BarType), (object)strArray[strArray.Length - 2]))
{
barType = (BarType)Enum.Parse(typeof(BarType), strArray[strArray.Length - 2]);
if (long.TryParse(strArray[strArray.Length - 1], out barSize))
return true;
}
return false;
}