internal void AddWts(Construct construct_, TraderArgs args_, Trader trader_) { checkedListBox2.Items.Add(new WtsWrapper(construct_,trader_,args_) , true); }
internal static void SaveWeightsFX(TraderArgs args_, ConstructGen<double> wts_, string stratName_) { foreach (DateTime date in wts_.Dates) { Dictionary<Data.Currency, double> wtsToday = new Dictionary<Data.Currency, double>(); for (int i = 0; i < args_.Products.Count; ++i) { Data.Currency ccy = ((ProductFX)args_.Products[i]).CoreProduct; wtsToday.Add(ccy, wts_.GetValue(date, i)); } //FXPositionSaver.SavePortfolio(stratName_, date, args_.ScaleToThisVol, wtsToday); } }
public WtsWrapper(Construct wts_, Trader trdr_, TraderArgs args_) { Weights = wts_; Trader = trdr_; Args = args_; }
private TraderArgs buildArgs() { TraderArgs args = new TraderArgs(); try { btnTrade.Enabled = false; // products if (m_model.ProductType == ProductType.Commods) foreach (var pc in m_model.ComProductList) args.Products.Add(pc); else if (m_model.ProductType == ProductType.FX) foreach (ProductFX pc in m_model.FXProductList) args.Products.Add(pc); else if (m_model.ProductType == ProductType.Dynamic) args.Products.Add(new ProductBbg(tbDynamic.Text)); else if (m_model.ProductType==ProductType.EquityFutures) foreach (ProductGeneric pc in m_model.EquityFutureProductList) args.Products.Add(pc); else if (m_model.ProductType==ProductType.FIFutures) foreach (ProductGeneric pc in m_model.FixedIncomeFuturesProducList) args.Products.Add(pc); /*else if (m_model.ProductType == ProductType.ComSpread) foreach (ProductComSpread pcs in m_model.ComSpreadProductList) args.Products.Add(pcs); else if (m_model.ProductType == ProductType.FXCross) foreach (ProductFXCross pcs in m_model.FXCrossProducts) args.Products.Add(pcs); */ if (args.Products.Count == 0) return null; // rebal args.RebalFrequency = m_model.RebalFreq; args.DayOfWeek = m_model.DayOfWeek; args.MonthlyDayStart = m_model.DayOfMonth; args.DayOffset = m_model.DayOffset; // strat combine method args.CombineWeightArgs = m_combWtArgs; // filter signals foreach (IndicatorBase ind in lbFilters.Items) args.FilterIndicators.Add(ind); // wt signals if (ultraTabControl1.Tabs.Count == 0) { MessageBox.Show("You need to add at least one indicator to trade."); return null; } foreach (UltraTab ut in ultraTabControl1.Tabs) { IndicatorBase indic = (IndicatorBase)ut.Tag; args.WtIndicators.Add(indic); } // scale to vol args.ScaleToVol = m_model.ScaleToVol; args.ScaleToThisVol = m_model.ScaleToThisVol; args.ScaleUsingDiagMatrix = cbDiagCovOnly.Checked; args.VolTypeForScaling = m_model.VolTypeForScaling; args.HistCovWindowLength = m_model.HistCovWindowLength; // constrain weights? args.WtConstraints = (TraderArgs.WeightConstraints)m_weightConstraints.Clone(); //xargs.WtConstraints = m_weightConstraints; //xargs.TriggerArgs = m_triggerARgs; args.TriggerArgs = (TriggerArgs)m_triggerARgs.Clone(); args.UseWeightsForFilter = cbUseSignalsForFilters.Checked; } catch //(Exception ex_) { args = null; } return args; }