本文整理汇总了C#中ConstructGen.RemoveValues方法的典型用法代码示例。如果您正苦于以下问题:C# ConstructGen.RemoveValues方法的具体用法?C# ConstructGen.RemoveValues怎么用?C# ConstructGen.RemoveValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstructGen
的用法示例。
在下文中一共展示了ConstructGen.RemoveValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getOHLCSeriesFromBbg
public static ConstructGen<double> getOHLCSeriesFromBbg(DateTime firstDate_, string ticker_, bool insertNan_ = true)
{
var ret = new ConstructGen<double>(new string[] { "PX_OPEN", "PX_HIGH", "PX_LOW", "PX_CLOSE_1D" });
DateTime[] bbgDates = null;
for (int i = 0; i < ret.ColumnHeadings.Length; ++i)
{
DateTime start;
if (i == 3)
start = firstDate_.AddDays(1);
else
start = firstDate_;
var b = BbgTalk.HistoryRequester.GetHistory(start, ticker_, ret.ColumnHeadings[i], false);
if (b == null || b.Length == 0)
{
throw new Exception(string.Format("No data retrieved for given ticker '{0}'", ticker_.ToUpper()));
}
else
b = HelperMethods.ensureAllWeekdays(b, insertNan_);
if (i == 3)
{
var closeData = bbgDates.Length > b.Dates.Length ? b.Data : b.Data.Skip(1).ToArray();
ret.SetColumnValues(i, bbgDates.SkipLast().ToArray(), closeData);
}
else
{
ret.SetColumnValues(i, b.Dates, b.Data);
bbgDates = b.Dates;
}
}
foreach (var d in ret.Dates.OrderByDescending(d => d))
{
if (ret.GetValue(d, 3) == 0)
{
ret.RemoveValues(d);
}
else break;
}
return ret;
}
示例2: processToTrigger
//.........这里部分代码省略.........
int numProp = Convert.ToInt32(Convert.ToDouble(validCount) * args_.TriggerArgs.ChangeSignOnThisProportion);
changeOnThisNumber = Math.Min(changeOnThisNumber, numProp);
}
if (countChanged >= changeOnThisNumber)
remove = false;
}
// proportion of portfolio turnover
if (remove && args_.TriggerArgs.TurnoverEnabled)
{
double sumOfTurnover = 0.0;
double sumOfPositions = 0.0;
for (int j = 0; j < wts_.ArrayLength; ++j)
{
sumOfTurnover += Math.Abs(wtsToday[j] - (before[j]));
sumOfPositions += Math.Abs(before[j]);
}
double propChanged = sumOfTurnover / sumOfPositions;
if (propChanged >= args_.TriggerArgs.TurnoverThreshold/* TAG:MA32DaysMin && daysSinceRebal>1*/)
remove = false;
}
// trade the flipped positions but don't re-scale everything else
if (remove==false &&
args_.TriggerArgs.DontTopLevelScaleIntraWeek == true &&
args_.TriggerArgs.AlwaysRebalOnDayOfWeekEnabled && args_.TriggerArgs.AlwayRebalOnThisDayOfWeek != wts_.Dates[i].DayOfWeek)
{
double[] newArray = new double[before.Length];
for (int j = 0; j < wts_.ArrayLength; ++j)
{
if (Statistics.AreSameSign(before[j], wtsToday[j]))
newArray[j] = before[j];
else
newArray[j] = wtsToday[j];
}
wts_.SetValues(wts_.Dates[i], newArray);
wtsToday = newArray;
}
// var flips
if (remove &&
args_.TriggerArgs.DoVarFlipsTrigger)
{
int numFlipped = 0;
foreach (int index in varContTopIndices)
if (Statistics.AreSameSign(before[index], wtsToday[index]) == false)
++numFlipped;
if (numFlipped >= args_.TriggerArgs.VarFlipsTrigger.NumFlipsTrigger)
remove = false;
}
// top in size flips
if (remove &&
args_.TriggerArgs.DoTopInSizeTrigger)
{
int numFlipped = 0;
foreach (int index in topWtPos)
if (Statistics.AreSameSign(before[index], wtsToday[index]) == false)
++numFlipped;
if (numFlipped >= args_.TriggerArgs.TopInSizeTrigger.NumFlipsTrigger)
remove = false;
}
if (remove)
{
removeTheseDates.Add(wts_.Dates[i]);
++daysSinceRebal;
}
else
{
before = wtsToday;
//varContBefore = (trader_ == null || args_.TriggerArgs.VarFlipsTrigger == null || args_.TriggerArgs.VarFlipsTrigger.Enabled == false) ? null : trader_.GetContToVar(before, wts_.Dates[i], args_);
daysSinceRebal = 0;
if (args_.TriggerArgs.DoVarFlipsTrigger)
{
varContBefore = trader_.GetContToVar(before, wts_.Dates[i], args_);
getTopVarIndicies(varContTopIndices, varContBefore, args_.TriggerArgs.VarFlipsTrigger.ConsiderTopVarNumber);
}
if (args_.TriggerArgs.DoTopInSizeTrigger)
getTopPosSizeIndicies(topWtPos, before, args_.TriggerArgs.TopInSizeTrigger.ConsiderTopInSizeNumber);
}
}
foreach (DateTime date in removeTheseDates)
wts_.RemoveValues(date);
}
示例3: removeDate
private void removeDate(ConstructGen<double> con_, DateTime date_)
{
if (con_ != null)
con_.RemoveValues(date_);
}