private void ShowSignallerStat(Contract.Entity.Subscription cat) { // получить счет перформера по кат. сигнала PerformerStat stat = null; try { stat = TradeSharpAccountStatistics.Instance.proxy.GetPerformerStatBySignalCatId(cat.Service); } catch (Exception ex) { MessageBox.Show(Localizer.GetString("MessageCannotGetSubscribersInfo")); Logger.Info("ShowSignallerStat", ex); return; } if (stat == null) { return; } var form = new SubscriberStatisticsForm(stat); //form.EnterRoomRequested += OnEnterRoomRequested; form.Show(this); }
public List <PerformerSearchCriteria> GetFilters() { var stat = new PerformerStat(); var result = new List <PerformerSearchCriteria>(); if (fioCheckBox.Checked) { result.Add(new PerformerSearchCriteria { propertyName = stat.Property(t => t.FullName), compradant = fioTextBox.Text, ignoreCase = !fioCSCheckBox.Checked }); } if (emailCheckBox.Checked) { result.Add(new PerformerSearchCriteria { propertyName = stat.Property(t => t.Email), compradant = emailTextBox.Text, ignoreCase = !emailCSCheckBox.Checked }); } if (accountCheckBox.Checked) { result.Add(new PerformerSearchCriteria { propertyName = stat.Property(t => t.Account), compradant = accountNumericUpDown.Value.ToString(), ignoreCase = true, checkWholeWord = true }); } return(result); }
public static double Calculate(ExpressionResolver resolver, PerformerStat stat) { var ptrVal = new Dictionary <string, double>(); try { foreach (var varName in resolver.GetVariableNames()) { var val = PerformerCriteriaFunctionCollection.Instance.propertyByVariable[varName].GetValue(stat, null); double dVal = val is float ?(float)val : val is double ?(double)val : val is int?(int)val : val is decimal ? (float)(decimal)val : 0; ptrVal.Add(varName, dVal); } double rst; resolver.Calculate(ptrVal, out rst); return(rst); } catch (Exception ex) { Logger.Error("Ошибка в Calculate(" + stat.Account + ")", ex); return(0); } }
public void InvestInPAMM(PerformerStat performer) { if (investInPAMM != null) { investInPAMM(performer); } }
public SubscriberStatisticsForm(PerformerStat performer) : this() { performerStatistic.DataBindCompleted += PerformerStatisticDataBindCompleted; performerStatistic.EnterRoomRequested += OnEnterRoomRequested; performerStatistic.DataBindAsynch(performer); performerStatistic.pageTargeted += OnPageTargeted; }
/// <summary> /// Расчёт только максимальной просадки /// </summary> public float CalculateMaxDrawdown(List <EquityOnTime> listProfit1000) { this.listProfit1000 = listProfit1000; if (Statistics == null) { Statistics = new PerformerStat(); } CalculateMaxDrawdown(); return(Statistics.MaxRelDrawDown); }
private void UpdateServiceTypeInSelectedFunction() { var stat = new PerformerStat(); var serviceTypeFiled = PerformerStatField.fields.FirstOrDefault(f => f.PropertyName == stat.Property(p => p.ServiceType)); SelectedFunction.Filters.RemoveAll(f => f.a == serviceTypeFiled); if (signalsToolStripMenuItem.Checked || pammsToolStripMenuItem.Checked) { SelectedFunction.Filters.Add( new Cortege3 <PerformerStatField, ExpressionOperator, double>(serviceTypeFiled, ExpressionOperator.Equal, ((signalsToolStripMenuItem.Checked ? 1 : 0) + (pammsToolStripMenuItem.Checked ? 2 : 0)))); } topFilterControl.SetExpression(SelectedFunction); }
private static void AddFakeSubscribers(PerformerStat s) { // иногда от программиста требуют написать такое var fakeSubscriberStats = AppConfig.GetStringParam("FakeSubscribers", "").ToIntArrayUniform(); var fakeDeltaSubs = new Dictionary <int, int>(); for (var i = 0; i < fakeSubscriberStats.Length / 2; i++) { fakeDeltaSubs.Add(fakeSubscriberStats[i * 2], fakeSubscriberStats[i * 2 + 1]); } int delta; fakeDeltaSubs.TryGetValue(s.Account, out delta); s.SubscriberCount += delta; }
// x == y ? 0 : (x > y ? 1 : -1) private static int ComparePerformerStats(PerformerStat x, PerformerStat y) { if (x == null) { if (y == null) { return(0); } return(-1); } if (y == null) { return(1); } return(x.UserScore.CompareTo(y.UserScore)); }
public void OpenInvestInPAMMDialog(PerformerStat performer, bool invest) { ScheduleTaskOnSynchronizationCompleted(state => { if (walletExplicitDetail == null || performer == null) { return; } var performerAccount = new Account { ID = performer.Account, Currency = performer.DepoCurrency, Balance = (decimal)performer.Equity, Equity = (decimal)performer.Equity }; // сколько можно вывести средств? var userShare = walletExplicitDetail.realAccounts.FirstOrDefault(a => a.AccountId == performer.Account); performerAccount.Balance = userShare == null ? 0 : userShare.ShareMoneyWallet; // окно пополнения - снятия var dlg = new WalletWithdrawForm(walletExplicitDetail.wallet, gridAccount.GetRowValues <AccountShared>(false) .Select(a => a.Account) .ToList(), performerAccount, true); if (dlg.ShowDialog() != DialogResult.OK) { return; } if (dlg.TargetWithdrawal > 0) { InvestInPAMM(performer, dlg.TargetWithdrawal, false, dlg.WithdrawAll); } if (dlg.TargetDespoit > 0) { InvestInPAMM(performer, dlg.TargetDespoit, true, dlg.WithdrawAll); } }); }
public void InvestInPAMM(PerformerStat performer, decimal amount, bool investNotWithdraw, bool withdrawAll) { var accountData = AccountStatus.Instance.AccountData; if (accountData == null) { return; } var status = investNotWithdraw ? TradeSharpWalletManager.Instance.proxy.InvestInPAMM( CurrentProtectedContext.Instance.MakeProtectedContext(), AccountStatus.Instance.Login, performer.Account, amount) : TradeSharpWalletManager.Instance.proxy.WithdrawFromPAMM( CurrentProtectedContext.Instance.MakeProtectedContext(), AccountStatus.Instance.Login, performer.Account, amount, withdrawAll); if (status == RequestStatus.OK) { var msg = investNotWithdraw ? "Сумма {0} {1} зачислена на счет №{2}" : "Сумма {0} {1} списана со счета №{2}"; MessageBox.Show(string.Format(msg, amount.ToStringUniformMoneyFormat(), accountData.Currency, performer.Account), investNotWithdraw ? "Зачисление проведено" : "Списание проведено", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var opStatusName = EnumFriendlyName <RequestStatus> .GetString(status); var msgFail = investNotWithdraw ? "Сумма {0} {1} не зачислена на счет: {2}" : "Сумма {0} {1} не списана со счета: {2}"; MessageBox.Show(string.Format(msgFail, amount.ToStringUniformMoneyFormat(), accountData.Currency, opStatusName), investNotWithdraw ? "Зачисление не проведено" : "Списание не проведено", MessageBoxButtons.OK, MessageBoxIcon.Warning); }
private void UpdateExpression() { // если что-то изменили в таблице, то формула обновляется; // если таблица в предыдущей итерации не смогла представить ее, то старая формула стирается, // и новая начинает формироваться по таблице var expression = ""; foreach (var fiterObject in filterObjects) { if (!fiterObject.Selected) { continue; } expression = fiterObject.UpdateExpression(expression); } // избегаем ошибки парсинга в PerformerStatField.ParseSimpleFormula, задавая поле для сортировки if (SortField == null) { var blank = new PerformerStat(); SortField = PerformerStatField.fields.FirstOrDefault(f => f.PropertyName == blank.Property(p => p.Profit)); if (SortField == null) { return; } } expression = (!string.IsNullOrEmpty(expression) ? "(" + expression + ")*" : "") + SortField.ExpressionParamName; SelectedFunction = new PerformerCriteriaFunction { Function = expression, PreferredSortOrder = SortOrder, MarginValue = 0 }; expressionLabel.Text = SelectedFunction.Function; if (PerformerCriteriaFunctionChanged != null) { PerformerCriteriaFunctionChanged(this, new EventArgs()); } }
public PerformerStatRecord(PerformerStat record) : base(record) { }