大数:交易员术语大数:圣经地名, 以下是为大家整理的关于大数据编办2篇 , 供大家参考选择。
大数据编办2篇
【篇一】大数据编办
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Collections;
using DevExpress.Xpf.Editors.Settings;
using DevExpress.Xpf.Grid;
using DevExpress.Xpf.Editors;
using System.Threading;
using System.Windows.Threading;
using DevExpress.Utils;
using DevExpress.XtraGrid;
using DevExpress.Data.Browsing;
using PropertyDescriptor = DevExpress.Data.Browsing.PropertyDescriptor;
namespace GridDemo {
///
/// Interaction logic for LargeDataSet.xaml
///
public partial class LargeDataSet : GridDemoModule {
VirtualList vList = new VirtualList();
public LargeDataSet() {
InitializeComponent();
AssignDataSource();
}
void AssignDataSource() {
setRowColumnCountButton.Cursor = Cursors.Wait;
vList.RecordCount = ((CountInfo)rowCountListBox.SelectedItem).Value;
vList.ColumnCount = ((CountInfo)columnCountListBox.SelectedItem).Value;
grid.ItemsSource = null;
grid.Columns.Clear();
grid.Columns.BeginUpdate();
PropertyDescriptorCollection properties = ((ITypedList)vList).GetItemProperties(null);
foreach(PropertyDescriptor propertyDescriptor in properties) {
GridColumn column = new GridColumn();
column.FieldName = propertyDescriptor.Name;
if(column.FieldName.Contains("Subject"))
column.EditSettings = new MemoEditSettings() {
PopupWidth = 300,
ShowIcon = false,
MemoTextWrapping=TextWrapping.Wrap,
MemoVerticalScrollBarVisibility = ScrollBarVisibility.Auto
};
if(column.FieldName.Contains("Priority")) {
column.SortMode = ColumnSortMode.Value;
}
if(column.FieldName.Contains("Size")) {
column.BestFitArea = BestFitArea.Header;
}
column.AllowEditing = ((propertyDescriptor.Name == "ID(1)") ? DefaultBoolean.False : DefaultBoolean.Default);
column.Header = ((propertyDescriptor.Name == "ID(1)") ? "ID(1)" : null);
column.AllowColumnFiltering = ((propertyDescriptor.Name == "ID(1)") ? DefaultBoolean.False : DefaultBoolean.True);
BaseEditSettings settings = CreateEditSettings(propertyDescriptor.Name);
if(settings != null)
column.EditSettings = settings;
grid.Columns.Add(column);
}
grid.Columns.EndUpdate();
grid.ItemsSource = vList;
Dispatcher.BeginInvoke(
new Action(ClearCursorProperty));
}
void ClearCursorProperty() {
setRowColumnCountButton.ClearValue(FrameworkElement.CursorProperty);
}
BaseEditSettings CreateEditSettings(string propertyName) {
if(propertyName == "ID(1)")
return new TextEditSettings() {
DisplayFormat = "#,0",
HorizontalContentAlignment = EditSettingsHorizontalAlignment.Right
};
if(propertyName.StartsWith("Size"))
return new TextEditSettings() { Mask = "## ##0",
MaskType = MaskType.Numeric,
MaskUseAsDisplayFormat = true,
HorizontalContentAlignment = EditSettingsHorizontalAlignment.Right
};
if(propertyName.StartsWith("Priority")) {
return new ComboBoxEditSettings() {
ItemsSource = DevExpress.Data.Mask.EnumHelper.GetValues(typeof(Priority)),
IsTextEditable = false
};
}
return null;
}
private void setRowColumnCountButton_Click(object sender, RoutedEventArgs e) {
AssignDataSource();
}
private void view_CustomBestFit(object sender, CustomBestFitEventArgs e) {
if(e.Column.FieldName != "ID(1)")
return;
List largestIDHandles = new List();
for(int i = vList.Count - 1; i >= 0; i--) {
int rowHanle = grid.GetRowHandleByListIndex(i);
if(rowHanle != GridControl.InvalidRowHandle)
largestIDHandles.Add(rowHanle);
if(largestIDHandles.Count >= 100)
break;
}
e.BestFitRows = largestIDHandles;
}
}
public class CountInfo {
public int Value { get; set; }
public string Description { get; set; }
}
public class VirtualPropertyDescriptor : PropertyDescriptor {
string propertyName;
Type propertyType;
bool isReadOnly;
VirtualList list;
int index;
public VirtualPropertyDescriptor(VirtualList list, int index, string propertyName, Type propertyType, bool isReadOnly)
: base(propertyName, null) {
this.propertyName = propertyName;
this.propertyType = propertyType;
this.isReadOnly = isReadOnly;
this.list = list;
this.index = index;
}
public override bool CanResetValue(object component) {
return false;
}
public override object GetValue(object component) {
return list.GetPropertyValue((int)component, index);
}
public override void SetValue(object component, object val) {
list.SetPropertyValue((int)component, index, val);
}
public override bool IsReadOnly { get { return isReadOnly; } }
public override string Name { get { return propertyName; } }
public override Type ComponentType { get { return typeof(VirtualList); } }
public override Type PropertyType { get { return propertyType; } }
public override void ResetValue(object component) {
}
public override bool ShouldSerializeValue(object component) { return true; }
}
public struct Location {
public int Row { get; set; }
public int Column { get; set; }
public override bool Equals(object obj) {
Location l = (Location)obj;
return l.Row == Row && l.Column == Column;
}
public override int GetHashCode() {
return Row ^ Column;
}
}
public class VirtualList : IList, ITypedList {
const int BaseColumnCount = 7;
int recordCount;
int columnCount;
Dictionary fValues = new Dictionary();
PropertyDescriptorCollection columnCollection;
public VirtualList() {
recordCount = 1000;
columnCount = 1000;
CreateColumnCollection();
}
public void SetPropertyValue(int rowIndex, int columnIndex, object value) {
fValues[new Location() { Column = columnIndex, Row = rowIndex }] = value;
}
public object GetPropertyValue(int rowIndex, int columnIndex) {
object value = null;
if(fValues.TryGetValue(new Location() { Column = columnIndex, Row = rowIndex }, out value)) {
return value;
}
if(columnIndex == 0)
return rowIndex + 1;
switch((columnIndex - 1) % BaseColumnCount) {
case 0: //From
return OutlookData.Users[GetPseudoRandomValue(rowIndex, columnIndex, OutlookData.Users.Length)].Name;
case 1: //To
return OutlookData.Users[GetPseudoRandomValue(rowIndex, columnIndex, OutlookData.Users.Length)].Name;
case 2: //Sent
return DateTime.Today.AddDays(GetPseudoRandomValue(rowIndex, columnIndex, 30));
case 3: //HasAttachment
return GetPseudoRandomValue(rowIndex, columnIndex, 2) == 0 ? true : false;
case 4: //Size
return GetPseudoRandomValue(rowIndex, columnIndex, 10000);
case 5: //Priority
return (Priority)GetPseudoRandomValue(rowIndex, columnIndex, DevExpress.Data.Mask.EnumHelper.GetValues(typeof(Priority)).Length);
case 6: //Subject
return OutlookDataGenerator.Subjects[GetPseudoRandomValue(rowIndex, columnIndex, OutlookDataGenerator.Subjects.Length)];
}
throw new NotImplementedException();
}
public string GetPropertyName(int columnIndex) {
if(columnIndex == 0)
return "ID(1)";
switch((columnIndex - 1) % BaseColumnCount) {
case 0: //From
return GetFullPropertyName("From", columnIndex);
case 1: //To
return GetFullPropertyName("To", columnIndex);
case 2: //Sent
return GetFullPropertyName("Sent", columnIndex);
case 3: //HasAttachment
return GetFullPropertyName("HasAttachment", columnIndex);
case 4: //Size
return GetFullPropertyName("Size", columnIndex);
case 5: //Priority
return GetFullPropertyName("Priority", columnIndex);
case 6: //Subject
return GetFullPropertyName("Subject", columnIndex);
}
throw new NotImplementedException();
}
string GetFullPropertyName(string name, int columnIndex) {
return name + "(" + (columnIndex + 1) + ")";
}
public Type GetPropertyType(int columnIndex) {
if(columnIndex == 0)
return typeof(int);
switch((columnIndex - 1) % BaseColumnCount) {
case 0: //From
return typeof(string);
case 1: //To
return typeof(string);
case 2: //Sent
return typeof(DateTime);
case 3: //HasAttachment
return typeof(bool);
case 4: //Size
return typeof(int);
case 5: //Priority
return typeof(Priority);
case 6: //Subject
return typeof(string);
}
throw new NotImplementedException();
}
int GetPseudoRandomValue(int rowIndex, int columnIndex, int maxValue) {
return (rowIndex + columnIndex) % maxValue;
}
public int RecordCount {
get { return recordCount; }
set {
if(value < 1) value = 0;
if(RecordCount == value) return;
recordCount = value;
}
}
public int ColumnCount {
get { return columnCount; }
set {
if(value < 1) value = 0;
if(ColumnCount == value) return;
columnCount = value;
CreateColumnCollection();
}
}
protected virtual void CreateColumnCollection() {
VirtualPropertyDescriptor[] pds = new VirtualPropertyDescriptor[ColumnCount];
for(int n = 0; n < ColumnCount; n++) {
pds[n] = new VirtualPropertyDescriptor(this, n, GetPropertyName(n), GetPropertyType(n), false);
}
columnCollection = new PropertyDescriptorCollection(pds);
}
#region ITypedList Interface
PropertyDescriptorCollection ITypedList.GetItemProperties(PropertyDescriptor[] descs) { return columnCollection; }
string ITypedList.GetListName(PropertyDescriptor[] descs) { return ""; }
#endregion
#region IList Interface
public virtual int Count {
get { return RecordCount; }
}
public virtual bool IsSynchronized {
get { return true; }
}
public virtual object SyncRoot {
get { return true; }
}
public virtual bool IsReadOnly {
get { return false; }
}
public virtual bool IsFixedSize {
get { return true; }
}
public virtual IEnumerator GetEnumerator() {
return null;
}
public virtual void CopyTo(System. array, int fIndex) {
}
public virtual int Add(object val) {
throw new NotImplementedException();
}
public virtual void Clear() {
throw new NotImplementedException();
}
public virtual bool Contains(object val) {
throw new NotImplementedException();
}
public virtual int IndexOf(object val) {
throw new NotImplementedException();
}
public virtual void Insert(int fIndex, object val) {
throw new NotImplementedException();
}
public virtual void Remove(object val) {
throw new NotImplementedException();
}
public virtual void RemoveAt(int fIndex) {
throw new NotImplementedException();
}
object IList.this[int fIndex] {
get { return fIndex; }
set { }
}
#endregion
}
}
【篇二】大数据编办
从金融大数据到大数据金融
作者:冯永昌
来源:《财经国家周刊》2014年第22期
伴随着阿里集团在美国上市,互联网金融的大戏进入高潮,大数据、云计算以及互联网金融等几年前对公众还很陌生的技术术语,迅速成为社会热点。这些底层技术以移动互联的用户体验呈现出来,不仅通过互联网产品改变了人们的衣食住行,更通过互联网金融产品开始冲击“智力博弈巅峰”的金融业。
不管你恐惧还是欣喜,大数据金融时代已经来临。
如何理解由技术创新逐渐引领的金融创新?何谓大数据金融?我们选取三个最有代表性的例子来解答。
何谓大数据?大数据没有严格定义,顾名思义就是“很多数据”。可以从三个层面来解析这个特别的称谓——
从生产来看,不需要特别的采集过程,因为监管要求、业务逻辑或者技术便利,具有“自生产”特征,比如搜索数据、交易数据等;从存储来看,相对于传统数据库的数据规模,量变引起质变,需要新的数据库技术来支持存储和访问;从使用来看,分析方法从基于概率论的抽样理论过渡到人工智能、统计学习等讲求高维、高效率分析技术。
从行业细分角度,大数据金融业主要有大数据银行金融和大数据证券金融,分别和银行业务、证券业务相关。当然,保险业天然就和大数据相关。
信用卡自動授信是典型的大数据银行金融。从银行角度是否应该对申请者授信、发授多少信用额度,是个重要问题。传统方式是人工审核申请资料,然后根据大致的档位发放额度或拒绝申请。但是当银行积累了足够多的用卡客户数据,可以把是否违约,违约概率,有效使用额度等指标作为被评价对象,然后调用与此相关的各种客户信息建立统计模型,自动计算授信结果。
机器人投资是大数据证券金融的代表形式,股票价格波动受各种因素影响,传统的投资方式一般人工收集信息,手动交易。机器人投资可以建立多因素模型,自动选择股票或寻找交易时机,在适当的风控模型下建立机器人投资云交易模式。