private void OnRenameItem(object sender, RoutedEventArgs e) { Kernel.Domain.PeriodInterval selectedItem = GetSelectedPeriodInterval(); if (selectedItem == null) { return; } NamePanel namePanel = new NamePanel(); namePanel.NameLabel.Visibility = System.Windows.Visibility.Visible; namePanel.NameTextBox.Visibility = System.Windows.Visibility.Visible; namePanel.fromDateLabel.Visibility = System.Windows.Visibility.Collapsed; namePanel.toDate.Visibility = System.Windows.Visibility.Collapsed; namePanel.toDateLabel.Visibility = System.Windows.Visibility.Collapsed; namePanel.toDate.Visibility = System.Windows.Visibility.Collapsed; namePanel.Height = 40; Dialog dialog = new Dialog(selectedItem.name, namePanel); dialog.Height = 150; dialog.Width = 300; bool result = (bool)dialog.ShowCenteredToMouse(); if (result == true) { if (!String.IsNullOrWhiteSpace(namePanel.EditedName)) { PeriodInterval parent = selectedItem.parent; selectedItem.name = namePanel.EditedName; parent.UpdateChild(selectedItem); } } }
protected virtual void onSelectPeriodNameFromSidebar(object sender) { if (sender == null) { return; } if (sender is PeriodName) { PeriodName periodName = (PeriodName)sender; ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getReconciliationFilterTemplateEditor().getActivePage(); if (page == null) { return; } page.getReconciliationFilterTemplateForm().setPeriodName(periodName); } else if (sender is PeriodInterval) { PeriodInterval periodInterval = (PeriodInterval)sender; ReconciliationFilterTemplateEditorItem page = (ReconciliationFilterTemplateEditorItem)getReconciliationFilterTemplateEditor().getActivePage(); if (page == null) { return; } page.getReconciliationFilterTemplateForm().setPeriodInterval(periodInterval); } }
/// <summary> /// Remove default nodes from root /// </summary> protected virtual void ForgetDefaultItems(Persistent parent) { if (parent != null) { if (parent is PeriodName) { PeriodName period = (PeriodName)parent; foreach (PeriodInterval interval in period.intervalListChangeHandler.Items.ToArray()) { if (interval.IsDefault) { period.intervalListChangeHandler.Items.Remove(interval); } } } else if (parent is PeriodInterval) { PeriodInterval interval = (PeriodInterval)parent; foreach (PeriodInterval child in interval.childrenListChangeHandler.Items.ToArray()) { if (child.IsDefault) { interval.childrenListChangeHandler.Items.Remove(child); } } } } }
public void SetPeriodInterval(PeriodInterval interval) { if (!forReport) { if (interval.periodName == null) { Kernel.Util.MessageDisplayer.DisplayInfo("Unvalid Period interval", "Period name cannot be null !"); return; } if (GetPeriodItemPanelForInterval(interval.periodName.name) != null) { Kernel.Util.MessageDisplayer.DisplayInfo("Duplicate Period name", "Item named: " + interval.periodName.name + " already exist!"); return; } } PeriodItem item = interval.getFromPeriodItem((forReport ? DateOperator.AFTER_OR_EQUALS.sign : "")); SetPeriodItemValue(item); if (forReport) { item = interval.getToPeriodItem(DateOperator.BEFORE_OR_EQUALS.sign); SetPeriodItemValue(item); } }
protected void onDoubleClickSelectPeriodNameFromSidebar(object sender) { if (sender != null) { if (sender is PeriodName) { PeriodName periodName = (PeriodName)sender; if (periodName.intervalListChangeHandler.Items.Count <= 0) { SetValue(sender); } else { SetValue(periodName.intervalListChangeHandler.Items); } } else if (sender is PeriodInterval) { PeriodInterval periodInterval = (PeriodInterval)sender; if (periodInterval.IsLeaf) { SetValue(sender); } else { SetValue(periodInterval.childrenListChangeHandler.Items); } } } }
/// <summary> /// Add default nodes /// </summary> /// <param name="parent"></param> protected virtual void AddDefaultItems(Persistent parent) { if (parent == null || parent.IsDefault) { return; } if (parent.isCompleted && parent.HasMoreElements()) { PeriodInterval showMore = new PeriodInterval(); showMore.IsShowMoreItem = true; showMore.name = SHOW_MORE_LABEL; if (parent is PeriodName) { PeriodName period = (PeriodName)parent; showMore.periodName = period; period.intervalListChangeHandler.Items.Add(showMore); } else if (parent is PeriodInterval) { PeriodInterval interval = (PeriodInterval)parent; showMore.parent = interval; interval.childrenListChangeHandler.Items.Add(showMore); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> protected void onSelectPeriodFromSidebar(object sender) { if (sender != null && sender is PeriodInterval) { PeriodInterval period = (PeriodInterval)sender; DesignerEditorItem page = (DesignerEditorItem)getDesignerEditor().getActivePage(); if (page == null) { return; } Object value = null; if (period.isStandardPeriod) { value = period.childrenListChangeHandler.Items; } else { value = period; } page.getDesignerForm().DesignerPropertiesPanel.SetValue(value); } if (sender != null && sender is PeriodName) { return; } }
public void setPeriodName(PeriodInterval periodInterval) { UIElement apanel = getActivePanel(); if (apanel is WriteOffFieldValuePanel) { ((WriteOffFieldValuePanel)apanel).setPeriodInterval(periodInterval); } }
/// <summary> /// Gets the unadjusted calculation date schedule. /// </summary> /// <param name="effectiveDate">The effective date.</param> /// <param name="periodToTerminationDate">The period to termination date.</param> /// <param name="periodFrequency">The period frequency.</param> /// <returns></returns> public List <CalculationPeriod> GetUnadjustedCalculationDateSchedule(DateTime effectiveDate, CalculationPeriodFrequency periodToTerminationDate, CalculationPeriodFrequency periodFrequency) { CalculationPeriodDates = null; PeriodInterval = CalculationPeriodHelper.CalculationPeriodFrequencyToInterval(periodFrequency); _effectiveDate = effectiveDate; _termDate = PeriodInterval.Add(effectiveDate); RollConvention = periodFrequency.rollConvention; _unadjustedDateScheduleList = CalculationPeriodHelper.GenerateUnadjustedCalculationDates(effectiveDate, periodToTerminationDate, periodFrequency); return(_unadjustedDateScheduleList); }
/// <summary> /// Load no complete object. /// </summary> /// <param name="parent"></param> protected virtual void Load(Persistent parent) { if (parent == null || parent.IsDefault) { return; } if (!parent.isCompleted && parent.oid.HasValue) { if (parent.DataFilter == null) { parent.DataFilter = new BrowserDataFilter(); parent.DataFilter.groupOid = parent.oid.Value; parent.DataFilter.page = 0; parent.DataFilter.pageSize = PAGE_SIZE; } if (parent is PeriodName) { PeriodName period = (PeriodName)parent; ForgetDefaultItems(period); period.DataFilter.page++; BrowserDataPage <PeriodInterval> page = this.Service.getRootIntervalsByPeriodName(period.DataFilter); period.intervalListChangeHandler.Items.Clear(); foreach (PeriodInterval interval in page.rows) { interval.periodName = period; period.intervalListChangeHandler.Items.Add(interval); } period.isCompleted = true; period.DataFilter.page = page.currentPage; period.DataFilter.totalPages = page.pageCount; AddDefaultItems(period); } else if (parent is PeriodInterval) { PeriodInterval interval = (PeriodInterval)parent; ForgetDefaultItems(interval); interval.DataFilter.page++; BrowserDataPage <PeriodInterval> page = this.Service.getPeriodIntervalChildren(interval.DataFilter); interval.childrenListChangeHandler.Items.Clear(); foreach (PeriodInterval child in page.rows) { child.parent = interval; child.periodName = interval.periodName; interval.childrenListChangeHandler.Items.Add(child); } interval.isCompleted = true; interval.DataFilter.page = page.currentPage; interval.DataFilter.totalPages = page.pageCount; AddDefaultItems(interval); } parent.isCompleted = true; } }
private void RefreshParent(PeriodInterval item) { if (item != null) { foreach (PeriodInterval child in item.GetItems()) { child.SetParent(item); child.IsExpanded = true; RefreshParent(child); } } }
public static List <PeriodInterval> buildWeekPeriods(PeriodName periodName) { List <PeriodInterval> periods = new List <PeriodInterval>(0); int position = 0; DateTime to = periodName.periodToTime; DateTime from = periodName.periodFromTime; PeriodInterval parentPeriod = null; List <PeriodInterval> parents = new List <PeriodInterval>(0); if (periodName.showMonth) { periods = buildMonthPeriods(periodName); parents = getLeafs(periods); } else if (periodName.showYear) { periods = buildYearPeriods(periodName); parents = getLeafs(periods); } while (from <= to) { if (periodName.showMonth) { parentPeriod = getLeafPeriodContaining(parents, from); } else if (periodName.showYear) { parentPeriod = getLeafPeriodContaining(parents, from); } position++; string name = "WEEK " + from.Year.ToString() + " " + ((from.Month < 10 ? "0" : " ") + from.Month) + " " + ((from.Day < 10 ? "0" : "") + from.Day); int dayToAdd = 7 * periodName.incrementationCount; DateTime localto = from.AddDays(dayToAdd).AddDays(-1); if (localto > to) { localto = to; } if (parentPeriod == null) { periods.Add(new PeriodInterval(position, name, from, localto)); } else { parentPeriod.AddChild(new PeriodInterval(position, name, from, localto)); } from = localto.AddDays(1); } return(periods); }
public virtual void SetPeriod(object period, bool setToFilter = false) { if (period is PeriodInterval) { PeriodInterval periodInterval = (PeriodInterval)period; getForm().SetPeriodInterval(periodInterval, setToFilter); } else if (period is PeriodName) { PeriodName name = (PeriodName)period; getForm().SetPeriodName(name, setToFilter); } }
private void OnPreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { EO.Wpf.TreeViewItem treeViewItem = VisualUpwardSearch(e.OriginalSource as DependencyObject); if (treeViewItem != null) { treeViewItem.Focus(); e.Handled = true; } else { PeriodInterval period = GetSelectedPeriodInterval(); //if (period != null) period.IsSelected = false; periodTreeview.Focus(); } }
private static PeriodInterval getPeriodByName(List <PeriodInterval> periods, string yearName) { foreach (PeriodInterval period in periods) { if (period.name.Equals(yearName)) { return(period); } PeriodInterval p = getPeriodByName(period, yearName); if (p != null) { return(p); } } return(null); }
/// <summary> /// Perform default action /// </summary> /// <param name="action"></param> protected virtual void PerformDefaultAction(Persistent action) { if (action == null || !action.IsShowMoreItem) { return; } if (action is PeriodInterval) { PeriodInterval selection = (PeriodInterval)action; PeriodInterval parent = selection.parent; PeriodName period = selection.periodName; BrowserDataPage <PeriodInterval> page = null; if (parent != null) { ForgetDefaultItems(parent); parent.DataFilter.page++; page = this.Service.getPeriodIntervalChildren(parent.DataFilter); foreach (PeriodInterval interval in page.rows) { interval.parent = parent; interval.periodName = parent.periodName; parent.childrenListChangeHandler.Items.Add(interval); } parent.isCompleted = true; parent.DataFilter.page = page.currentPage; parent.DataFilter.totalPages = page.pageCount; AddDefaultItems(parent); } else if (period != null) { ForgetDefaultItems(period); period.DataFilter.page++; page = this.Service.getRootIntervalsByPeriodName(period.DataFilter); foreach (PeriodInterval interval in page.rows) { interval.periodName = period; period.intervalListChangeHandler.Items.Add(interval); } period.isCompleted = true; period.DataFilter.page = page.currentPage; period.DataFilter.totalPages = page.pageCount; AddDefaultItems(period); } } }
public virtual void SetPeriod(object period) { if (getInputGridForm().SelectedIndex == 1) { getInputGridForm().InputGridSheetForm.InputGridPropertiesPanel.SetValue(period); } else { if (period is PeriodInterval) { PeriodInterval periodInterval = (PeriodInterval)period; getInputGridForm().SetPeriodInterval(periodInterval); } else if (period is PeriodName) { getInputGridForm().SetPeriodItemName(((PeriodName)period).name); } } }
public void UpdateInterval(PeriodInterval interval, int position) { String name = interval.periodName.name; bool add = false; if (this.ItemPanel1.PeriodItem == null) { this.ItemPanel1.PeriodItem = new PeriodItem(position++); add = true; } this.ItemPanel1.PeriodItem.name = name; this.ItemPanel1.PeriodItem.formula = null; this.ItemPanel1.PeriodItem.operatorSign = DateOperator.AFTER_OR_EQUALS.sign; this.ItemPanel1.PeriodItem.valueDateTime = interval.periodFromDateTime; this.ItemPanel1.Display(this.ItemPanel1.PeriodItem); if (add) { OnAdd(this.ItemPanel1); } else { OnUpdate(this.ItemPanel1); } if (this.ItemPanel2.PeriodItem == null) { this.ItemPanel2.PeriodItem = new PeriodItem(position++); } this.ItemPanel2.PeriodItem.name = name; this.ItemPanel2.PeriodItem.formula = null; this.ItemPanel2.PeriodItem.operatorSign = DateOperator.BEFORE_OR_EQUALS.sign; this.ItemPanel2.PeriodItem.valueDateTime = interval.periodToDateTime; this.ItemPanel2.Display(this.ItemPanel2.PeriodItem); if (add) { OnAdd(this.ItemPanel2); } else { OnUpdate(this.ItemPanel2); } }
private static PeriodInterval getLeafPeriodContaining(List <PeriodInterval> leafs, DateTime date) { PeriodInterval period = null; foreach (PeriodInterval leaf in leafs) { if (leaf.Containts(date)) { if (period == null) { period = leaf; } else if (period.Containts(leaf.periodFromDateTime)) { period = leaf; } } } return(period); }
private static PeriodInterval getPeriodByName(PeriodInterval interval, string yearName) { if (interval.name.Equals(yearName)) { return(interval); } foreach (PeriodInterval period in interval.childrenListChangeHandler.Items) { if (period.name.Equals(yearName)) { return(period); } PeriodInterval p = getPeriodByName(period, yearName); if (p != null) { return(p); } } return(null); }
public void SetPeriodInterval(PeriodInterval interval) { if (interval.periodName == null) { Kernel.Util.MessageDisplayer.DisplayInfo("Unvalid Period interval", "Period name cannot be null !"); return; } String name = interval.periodName.name; RPeriodNamePanel panel = GetPeriodNamePanel(name); if (panel != null) { int position = Period != null ? Period.itemListChangeHandler.Items.Count : 0; panel.UpdateInterval(interval, position); } else { int position = Period != null ? Period.itemListChangeHandler.Items.Count : 0; List <PeriodItem> items = new List <PeriodItem>(0); PeriodItem item = new PeriodItem(); item.name = name; item.position = position++; item.value = interval.periodFromDateTime.ToShortDateString(); item.operatorSign = DateOperator.AFTER_OR_EQUALS.sign; items.Add(item); item = new PeriodItem(); item.name = name; item.position = position++; item.value = interval.periodToDateTime.ToShortDateString(); item.operatorSign = DateOperator.BEFORE_OR_EQUALS.sign; items.Add(item); panel = new RPeriodNamePanel(name, items); AddNamePanel(panel); OnAdded(panel.ItemPanel1); OnAdded(panel.ItemPanel2); } }
/// <summary> /// Initialize chidren's parent /// </summary> /// <param name="item"></param> public virtual void RefreshParent(Persistent parent) { if (parent is PeriodName) { PeriodName period = (PeriodName)parent; foreach (PeriodInterval interval in period.intervalListChangeHandler.Items) { interval.periodName = period; RefreshParent(interval); } } else if (parent is PeriodInterval) { PeriodInterval interval = (PeriodInterval)parent; foreach (PeriodInterval child in interval.childrenListChangeHandler.Items) { child.parent = interval; child.periodName = interval.periodName; RefreshParent(child); } } }
private void OnMouseRightClick(object sender, MouseEventArgs e) { this.Timer.Stop(); if (sender is TreeViewItem) { Object tag = ((TreeViewItem)sender).Header; if (tag is Domain.PeriodInterval) { PeriodFilterDialog dialog = new PeriodFilterDialog(); dialog.Display((Domain.PeriodInterval)tag); dialog.SearchTextBox.Focus(); WindowPositioner.ShowCenteredToMouse(dialog); PeriodInterval value = dialog.Selection; if (value != null && Click != null) { Click(value); } e.Handled = true; } } }
private void onDoubleClickPeriodFromSidebar(object sender) { if (sender != null && sender is PeriodInterval) { PeriodInterval period = (PeriodInterval)sender; if (period.childrenListChangeHandler.Items.Count <= 0) { onSelectPeriodFromSidebar(period); return; } DesignerEditorItem page = (DesignerEditorItem)getDesignerEditor().getActivePage(); if (page == null) { return; } page.getDesignerForm().DesignerPropertiesPanel.SetValue(period.childrenListChangeHandler.Items); } if (sender != null && sender is PeriodName) { return; } }
public virtual void SetPeriodInterval(PeriodInterval interval, bool setToFilter = false) { if (this.SelectedIndex == 0) { } else if (this.SelectedIndex == 1) { this.ConfigurationPanel.WriteOffConfigPanel.setPeriodName(interval); } else if (this.SelectedIndex == 2) { if (setToFilter) { this.LeftGrid.GrilleBrowserForm.filterForm.periodFilter.SetPeriodInterval(interval); } else { this.LeftGridProperties.InputGridPropertiesPanel.SetValue(interval); } } else if (this.SelectedIndex == 3) { if (setToFilter) { this.RightGrid.GrilleBrowserForm.filterForm.periodFilter.SetPeriodInterval(interval); } else { this.RightGridProperties.InputGridPropertiesPanel.SetValue(interval); } } else if (this.SelectedIndex == 4) { this.BottomGridProperties.InputGridPropertiesPanel.SetValue(interval); } }
/// <summary> /// Gets Taker Buy/Sell Volume Ratio /// </summary> /// <param name="symbol">The symbol to get the data for</param> /// <param name="period">The period timespan</param> /// <param name="limit">Max number of results</param> /// <param name="startTime">Start time to get taker buy/sell volume ratio</param> /// <param name="endTime">End time to get taker buy/sell volume ratio</param> /// <param name="ct">Cancellation token</param> /// <returns>Taker Buy/Sell Volume Ratio info</returns> public async Task <WebCallResult <IEnumerable <BinanceFuturesBuySellVolumeRatio> > > GetTakerBuySellVolumeRatioAsync(string symbol, PeriodInterval period, int?limit = null, DateTime?startTime = null, DateTime?endTime = null, CancellationToken ct = default) { limit?.ValidateIntBetween(nameof(limit), 1, 500); var parameters = new Dictionary <string, object> { { "symbol", symbol }, { "period", JsonConvert.SerializeObject(period, new PeriodIntervalConverter(false)) } }; parameters.AddOptionalParameter("limit", limit?.ToString(CultureInfo.InvariantCulture)); parameters.AddOptionalParameter("startTime", startTime != null ? BinanceClient.ToUnixTimestamp(startTime.Value).ToString(CultureInfo.InvariantCulture) : null); parameters.AddOptionalParameter("endTime", endTime != null ? BinanceClient.ToUnixTimestamp(endTime.Value).ToString(CultureInfo.InvariantCulture) : null); return(await BaseClient.SendRequestInternal <IEnumerable <BinanceFuturesBuySellVolumeRatio> >(FuturesClient.GetUrl(takerBuySellVolumeRatioEndpoint, tradingDataApi), HttpMethod.Get, ct, parameters).ConfigureAwait(false)); }
/// <summary> /// Gets Taker Buy/Sell Volume Ratio /// </summary> /// <param name="symbol">The symbol to get the data for</param> /// <param name="period">The period timespan</param> /// <param name="limit">Max number of results</param> /// <param name="startTime">Start time to get taker buy/sell volume ratio</param> /// <param name="endTime">End time to get taker buy/sell volume ratio</param> /// <param name="ct">Cancellation token</param> /// <returns>Taker Buy/Sell Volume Ratio info</returns> public WebCallResult <IEnumerable <BinanceFuturesBuySellVolumeRatio> > GetTakerBuySellVolumeRatio(string symbol, PeriodInterval period, int?limit = null, DateTime?startTime = null, DateTime?endTime = null, CancellationToken ct = default) => GetTakerBuySellVolumeRatioAsync(symbol, period, limit, startTime, endTime, ct).Result;
/// <summary> /// Gets Open Interest History /// </summary> /// <param name="symbol">The symbol to get the data for</param> /// <param name="period">The period timespan</param> /// <param name="limit">Max number of results</param> /// <param name="startTime">Start time to get open interest history</param> /// <param name="endTime">End time to get open interest history</param> /// <param name="ct">Cancellation token</param> /// <returns>Open Interest History info</returns> public WebCallResult <IEnumerable <BinanceFuturesOpenInterestHistory> > GetOpenInterestHistory(string symbol, PeriodInterval period, int?limit = null, DateTime?startTime = null, DateTime?endTime = null, CancellationToken ct = default) => GetOpenInterestHistoryAsync(symbol, period, limit, startTime, endTime, ct).Result;
/// <summary> /// Gets Global Long/Short Ratio (Accounts) /// </summary> /// <param name="symbolPair">The symbol or pair to get the data for</param> /// <param name="period">The period timespan</param> /// <param name="limit">Max number of results</param> /// <param name="startTime">Start time to get global long/short ratio (accounts)</param> /// <param name="endTime">End time to get global long/short ratio (accounts)</param> /// <param name="ct">Cancellation token</param> /// <returns>Global Long/Short Ratio (Accounts) info</returns> public WebCallResult <IEnumerable <BinanceFuturesLongShortRatio> > GetGlobalLongShortAccountRatio(string symbolPair, PeriodInterval period, int?limit = null, DateTime?startTime = null, DateTime?endTime = null, CancellationToken ct = default) => GetGlobalLongShortAccountRatioAsync(symbolPair, period, limit, startTime, endTime, ct).Result;
public void setPeriodInterval(PeriodInterval periodInterval) { this.ActiveItem.setPeriodInterval(periodInterval); }