Monday 2 July 2012

Integrating crucial hierarchical binding feature to the trading applications

Hierarchical binding present in the trading and financial applications offer a variety of features to its users. Most of the .Net grid or MFC grid based applications implement Hierarchical binding. The benefits of using Hierarchical binding are many. For example an application implementing the Hierarchical binding techniques can easily sort and filter data compared to ones that do not. Thus the use of Hierarchical binding techniques is becoming more and more popular. Most of the developers working on the .Net platform and designing trading applications make use of Hierarchical binding benefits. The Hierarchical binding techniques also allow better data integration techniques in case of real time data update. Since most of the modern day trading and financial applications need real time voluminous updates therefore hierarchical binding is necessary to implement performance and security. Most of the hierarchical binding modules can be designed in secured manner to ensure data and application integrity.
public class Order
{
    private readonly string _instrument;
    private readonly double _price;
    private readonly long _quantity;

    public Order(string instrument, double price, long quantity)
    {
        _instrument = instrument;
        _price = price;
        _quantity = quantity;
    }

    public string Instrument
    {
        get { return _instrument; }
    }

    public double Price
    {
        get { return _price; }
    }

    public long Quantity
    {
        get { return _quantity; }
    }
}

public void PopulateGrid(Grid grid)
{
    BindingList<Order> orders = new BindingList<Order>();

    orders.Add(new Order("Instrument1", 10.55, 34));
    orders.Add(new Order("Instrument2", 12.26, 154));
    orders.Add(new Order("Instrument1", 13.16, 14));
    orders.Add(new Order("Instrument5", 9.85, 52));
    orders.Add(new Order("Instrument1", 16.47, 11));

    grid.DataSource = orders;
}
The above code implements the hierarchical binding features. Most of the hierarchical binding modules enable better data integration customizability along with data safety. The hierarchical binding modules also allow the developer to make the application more robust and scalable for regular use.
public void PopulateGrid(Grid grid)
{
    Strategy strategy = new Strategy("Strategy 1");
    strategy.Orders.Add(new Order("SubOrder1", 10.15, 34));
    strategy.Orders.Add(new Order("SubOrder2", 30.51, 43));
    grid.Rows.Add(strategy);

    Strategy strategy = new Strategy("Strategy 2");
    strategy.Orders.Add(new Order("SubOrder1", 10.15, 34));
    strategy.Orders.Add(new Order("SubOrder2", 30.51, 43));
    grid.Rows.Add(strategy);
}

public class Order : INotifyPropertyChanged
{
    ...

    public double Price
    {
        get { return _price; }
        set
        {
            _price = value;
            if(PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Price"));
            }
        }
    }

    public long Quantity
    {
        get { return _quantity; }
        set
        {
            _quantity = value;
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Quantity"));
            }
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}
In the above code the hierarchical binding modules implement two known features of Data binding with multi threading features and the INotifyPropertyChanged feature. The hierarchical binding modules are applied in such a way that these features are used effectively in designing the applications for regular usage. Since most of the applications are financial and trading in such cases therefore the use of these features are crucial for development.

Sunday 1 July 2012

Datagridview: The best thing about Dapfor’s Datagridview

The best thing about using Dapfor’s application is its capability to offers lots of feature and that too with good performance. One of the most important features of Dapfor application is its Datagridview. Datagridview is not only stable but also supports various version of CLR such as 2.0, 3.0, 3.5 and 4.0. This is the main reason that Datagridview is used in many applications of Dapfor. Users can find many others Datagridview from many organizations but they lack the capability to handle event-based model efficiently as Dapfor applications do. Others organizations Datagridview doesn’t face any kind of problem while handling non-event based model but when it comes to event based model there is no better than the Dapfor’s Datagridview. Dapfor’s Datagridview also consumes less system and memory resources which make them among the best in the business. 
For example, take the sorting mechanism on the Datagridview. In such kind of scenario all the relevant information’s are stored in grid headers. Look at the code below which states the sort direction using simple inbuilt methods provided by the Dapfor’s Datagridview.
//Get top-level header
Header header = grid.Headers [0];

header["Product"].SortDirection = SortDirection.Ascending;
header["Price"].SortDirection = SortDirection.Descending;
If the users want to restrict the sorting property from the GUI, they can use the Column.Sortable property. Datagridview implements the IComparable interface for applying sorting on the view. During sorting objects generally returns simple data types such as int, float, string pr Timespan. IComparable interface uses these data types for sorting purposes on the Datagridview. Dapfor’s Datagridview also has the capability to handle sorting for different rows as well for complex type of data types. The task of the IComparable interface is to compare between the simple data types and the complex data types. This interface doesn’t take into account about the stocks which is present on the grid cells. The code below gives you the insight about the Datagridview sorting using the DateTime value.
class AnotherDateSortingExample
{
    private readonly DateTime _date;

    public DateExample(DateTime date)
    {
        _date = date;
    }

    public DateTime Date
    {
        get { return _date; }
    }
}

//Create header and column
grid.Headers.Add(new Header());
grid.Headers[0].Add(new Column("Date"));

//Configure the header
grid.Headers[0].StretchMode = ColumnStretchMode.All;
grid.Headers[0][0].SortDirection = SortDirection.Ascending;
grid.Headers[0]["Date"].Format = new StringFormat("d", new CultureInfo("fr-FR"));

//Populate grid with random data
Random random = new Random();
BindingList<DateExample> source = new BindingList<DateExample>();
for (int i = 0; i < 6; ++i)
{
    source.Add(new DateExample(DateTime.Now + TimeSpan.FromDays(random.Next(1000))));
}
grid.DataSource = source;
Dapfor’s Datagridview provides provision to do user defined sorting technique. This can be achieved using the ICustomSort interface which helps is setting the sorting rules.
//An implementation ICustomSort that sorts values by day of week
class MonthOfYearCustomSort : ICustomSort
{
    public int Compare(Row row1, Row row2, string fieldId, object value1, object value2, int defaultResult)
    {
        if(fieldId == "Date")
        {
            DateTime d1 = (DateTime) value1;
            DateTime d2 = (DateTime) value2;

            if (d1. MonthOfYear != d2. MonthOfYear)
            {
                return d1. MonthOfYear > d2.MonthOfYear? 1 : -1;   
            }
        }
        return defaultResult;
    }
}

//Setup custom sorting
grid.CustomSort = new MonthOfYearCustomSort();

Saturday 16 June 2012

Trading and Finance application on .Net platform for performance benefits

Real time trading and finance applications have to be performance oriented in order to allow the real time updating process along with automatic sorting. The .Net performance enhances this performance for the real time trading and finance applications with the use of many available features. .Net performance features allow techniques like grid update of the real time data which can be sorted based on the needs. Even the .Net performance benefits allow high amount of data to be inserted directly in the rows for further sorting techniques. In trading applications every minute there might be millions of rows which are being updated. Tips and tools of the .Net performance features enable perfect insertion of the data into the rows and the columns of the grid view in the application. Though the general rate of .Net performance might vary for various trading applications in multiple configurations, the general concept of performance enhancement remains the same.
For example while updating the data in a non event model based development might use the .Net performance feature as listed below.
grid.Rows.Add(new object[]{"val1", 153, true, DateTime.Now});
//The required data is updated by calling the Cell.Value property.
Row r1 = ...;
Cell c1 = r1 [0];
c1.Value = "val2";

There are other .Net performance features too which allows multiple different types of data objects to be updates on the grid in real time. For example the .Net performance feature ThreadSafeBindingList is used in place of general BindingList in order to make the application a thread safe one.

grid.Sort.Enabled = false;
grid.DataSource = _datasource_;
//Add one object to the launch of the grid
grid.Nodes.Insert(0, _new_object_);

//Add one object to the start of the binding list
IBindingList bl = ...;
bl.Insert(0, _new_object_);

If in the above .Net performance case “grid.Sort.Enabled = true;” is used then the data is supposed to be automatically updated and sorted. But the .Net performance case is not used in order to avoid issues with large volumes of data. While developing .Net performance based applications not only performance but security of the data also needs to be kept in mind by the developers to avoid disastrous results.
For example it is not a good idea to format the values of the data in .Net performance based applications, directly into the object. 

class DateEx1
{
    ...

    // Not a good idea   
     public string FormattedD1
    {
        get { return string.Format("{0:yyyy-MM-dd}", _date); }
    }

    //Better idea: the property must return a non formatted value
    [Format("yyyy-MM-dd")]
    public DateTime D1
    {
        get { return _date; }
    }
}


Large data volumes can be added easily using the .Net performance features like INotifyPropertyChanged and IBindingList. These two .Net performance features allows the real time data update procedure in much safe and interactive way, so that no data is lost form this huge volume.

Developing effective and performance based trading applications

Trading applications are developed for the organizations which deal with trade on daily basis. There are numerous features that all the effective trading applications must have. Some of these features are handling voluminous data update on routine basis, data security, customizability, robustness etc… Nowadays most of the effective trading applications are developed on the .Net platform in order to support the above features. There are certain very crucial features that professional trading applications must possess. Real time data updating is one such feature of the trading applications. 
//Some data object
public class Service : INotifyPropertyChanged
{
    //Some fields
    private double Cost;
    private TimeDate maturity;

    [DoubleFormat(Precision = 3, ShortForm = true, ShowZero = false)]
    public double Cost
    {
        get { return Cost; }
        set
        {
            Cost = value;
            if(PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Cost"));
            }
        }
    }
    public TimeDate Maturity
    {
        get { return maturity; }
    }
    public event PropertyChangedEventHandler PropertyChanged;
}

//Add a data object to the grid to the trading applications.
Service Service = new Service();
Row row = grid.Rows.Add(Service);

//The grid will automatically sort, filter, group and highlight corresponding row in the trading applications!
//The Service is your business logic and may be placed in any assembly within the trading applications that doesn't need to have references to Dapfor assemblies!
Service.Cost = 123;

//The value in the "Cost" cell should equal to '123'.
Assert.AreEqual(row["Cost"].Value, 123);
The above code demonstrates the real time update feature of the trading applications. Most of the trading applications need to do regular real time data update from sources like stock markets. Thus the trading applications must be secured enough in order to enable voluminous update along with data security.

public void FilterUsing(Grid grid)
{
    //Initialize the grid
    grid.Headers.Add(new Header());
    grid.Headers[0].Add(new Column("Object Title"));
    grid.Headers[0].Add(new Column("Type"));
    grid.Headers[0].Add(new Column("Cost"));

    //Set filter
    grid.Filter = new CustomFilter();

    //Populate the grid
    Row row1 = grid.Rows.Add(new object[] { "Audi", Type.Black, 23000d});
    Assert.IsFalse(row1.Visible);

    Row row2 = grid.Rows.Add(new object[] { "HYUNDAI", Type.White, 35000d });
    Assert.IsTrue(row2.Visible);

    //Set a new Cost for "Audi"
    row1["Cost"].Value = 58000d;
    Assert.IsTrue(row1.Visible);
}

The above code demonstrates the real time data filtering feature of the trading applications. Most of the trading applications need to do regular the real time data filtering feature for the data received from various sources like stock markets. Thus the trading applications must be secured enough in order to enable the real time data filtering feature of the voluminous update along with interactive interface.

The trading applications also must be developed based on other features like hierarchical sorting and binding, thread safe nature, customizability of data handling etc…. Most of the trading applications in the modern day with the use of the .Net grid and MFC grid can incorporate all the above mentioned features. Thus the modern trading applications are effective.

Trading Application: Manage your finances through a application

In the finance industry using software which provides users with real-time data which are not only useful but should also be stable, is very tough to find. Developing a trading application is no child’s play it takes considerable amount of time from the experienced developers so that the users won’t face any kind of difficulty in handling it. Dapfor is one of the organizations which have the experience as well extensive knowledge to do that. Dapfor’s trading application are developed by group of experienced professional who have worked in this filed for many years and know what is needed to develop a perfect software with which user can get maximum benefit. User’s main requirements from a trading application are user interface and its functionality. These two requirements must be easy to use so that any naïve user can operate it without any problem. Dapfor’s trading application is also thread safe which means that deadlock situation doesn’t arise like many other applications. Their trading application tactically uses the synchronized method so that deadlock like situation can be avoided, since it cannot be guaranteed that it won’t happen ever. Another very important aspect while developing a trading application is that it should have provision for further enhancement which in this changing environment is very necessary. Dapfor consider all these factors before developing a perfect trading application for the customers. Performance wise also Dapfor’s trading application is also very good; it consumes least amount of memory as well as system resource. Real time data is the most interesting feature of Dapfor’s trading application. For example in any trading application, change is currency is very common which must be notified to the users about every single change. To handle this Dapfor uses the CurrencyRate Class in their trading application which implements the INotifyPropertyChanged interface. This interface is the main reason behind the notifications about the changes in the currency. Look at the coding below to understand it more clearly.
public class CurrencyRate : INotifyPropertyChanged
{

public IList<string> AvailableCurrencies
{
get { return _availableCurrencies; }
}
public string MainCurrency
{
get { return _mainCurrency; }
}
}
CurrencyRate currencyRate = CurrencyRate(“USD”, Provider.Instance.AvailableCurrencies);
//Get current USD/EUR rate
double rate = currencyRate["EUR"];
//Set a new USD/EUR rate
currencyRate["EUR"] = 1.42; 

All the changes are in real-time so that the user can understand the changes evidently. To display the changes to the user, Dapfor’s trading application uses their proprietary grid which is known as the Grid.Source. The data source is then connected to this grid.
Header header = Header.FromDataType(typeof (CurrencyRate));
grid.Headers.Add(header);
//Bind grid to the collection of CurrencyRate
grid.DataSource = new List<CurrencyRate>(Provider.Instance.CurrencyRates.Values);  

In this way a perfect trading application is developed and there is more to it such as the real-time highlighting, blotting, hierarchical binding and many more.

Hierarchical binding: Bind various data very easily

For every application data binding is an important aspect without it no application is complete. There are various sources from where the application can get data such as array, data set etc. All these data needs to be implemented in the application to get the benefit out of it. One of the ways of binding data is by hierarchical binding. There is always a possibility that a data objects may contain hierarchical data which is to be implemented in the application by using the hierarchical binding technique. This type of hierarchical binding is not easy to achieve but with Dapfor’s features it can be done in a simple and easy manner. For example look at the hierarchical binding code below:
// data objects which implements the hierarchical binding capability
class Author
{
    private readonly IList<Book> _books = new List<Book>();
    private readonly string _name;

    public Author(string name)
    {
        _name = name;
    }

    public IList<Book> Books
    {
        get { return _books; }
    }
    public string Name 
    {
        get { return _name; }
    }
}

class Book
{
    private readonly Author _author;
    private readonly string _name;

    public Book(Author author, string name)
    {
        _author = author;
        _name = name;
    }

    public Author Author
    {
        get { return _author; }
    }
    public string Title 
    {
        get { return _name; }
    }
}
 The IBindingList interface contains all the authors and can be bounded on the grid for the purpose of implementing hierarchical binding by the following code:
//Populate binding list with some authors
BindingList<Author> authors = new BindingList<Author>();
Author author = new Author("Agata Kristi");
author.Books.Add(new Book(author, "Second front"));
author.Books.Add(new Book(author, "Shameful Star"));
authors.Add(author);

author = new Author("Conan Doyle");
author.Books.Add(new Book(author, "The Blanched Soldier"));
author.Books.Add(new Book(author, "The Mazarin Stone"));
authors.Add(author);

//Bind grid to author collection
grid.DataSource = authors;
But if you look carefully hierarchical binding is not formed because the grid doesn’t have the knowledge about the relation between the Author and Book class. This is where the usefulness of Dapfor hierarchical binding feature comes into the picture; it provides an attribute with which it notifies the grid about the hierarchical binding by marking the Author.Book relationship.
class Author
{
    ...

    [HierarchicalField]
    public IList<Book> Books
    {
        get { return _books; }
    }

    ...
}
If any author writes a new book which is to be added to the collection for the purpose of hierarchical binding, you can do use the following code:
/Add a book to a collection
author.Books.Add(new Book(author, "His Last Bow"));
Users won’t find any change because the Book collection implements the IList<Book>. To send notification about the changes users need to implement the BindingList<Book> instead of the IList. This will make the grid receive notification about the changes and displays them automatically. If some kind of sorting, filtering or grouping is required on the application which has hierarchical binding feature, the grid does the checking for the users.
class Author
{
    private readonly IList<Book> _books = new BindingList<Book>();

    ...
}
In this way, Dapfor grid provides the functionality of the hierarchical binding. Implementing the hierarchical binding is achieved very easily and less modification is required on the different classes.  

Saturday 21 April 2012

Trading blotter

For a trading blotter application to be good it needs to incorporate the real time feature to satisfy the needs of the user. Trading blotter application must be able display data that are real time data which are used heavily by the users. For a simple trading blotter application it must have some kind of trading benchmark in this CAC40 Is used and another tab for currencies. CAC40 is used in French stock market. In developing trading blotter application developers needs to create three classes which are Market, Instrument and Feeder classes respectively. In market class all the common and necessary properties are included such as CloseTime, OpenTime, Name and MarketState. Instrument class has different important properties such as Shares, Weight, and Capitalization etc. Instrument class also helps to track different market worldwide such as the NASDAQ, BSE etc. In the Feeder class information of the Instrument class is stored and other important information’s like the price information, information of that particular instrument, history of the change in price and availability of a product. Every change in the instrument like selling or purchasing must be notified to the user with the help of the trading blotter application which is done with the Feeder Class. That’s why Feeder class implements the INotifyPropertyChanged interface. As earlier mentioned that the trading blotter application should be able to access different market wit the help of Instrument class, creation of the CAC40 class is done to put it under the Tab Control. A good trading blotter application must have separate design and data presentation. This trading blotter application makes use of this design. To connect data to the .net grid the following code is added.       
public CAC40Control()
{
    InitializeComponent();
    grid.DataSource = Provider.Instance.Cac40Feeders;
}
Composite objects can also be incorporated in this trading blotter application. Composite objects are nothing but the amalgamation of different properties and the returned object will also be a composite object. In this trading blotter application, feeder class has the reference of the Instrument class so the properties of these classes are combined to form a composite property. This property is marked with the CompositeFieldAttribute attribute.
public class Feeder : INotifyPropertyChanged
{
    private readonly Instrument _instrument;
    ...
    [CompositeField]
    public Instrument Instrument
    {
        get { return _instrument; }
    }
}

public class Instrument
{
   ...
    [Field("InstrumentId")]
    public string Isin
    {
        get { return _isin; }
    }
}
This will display ISIN from the Instrument class on the grid of the trading blotter application. Other type of Instrument can also be incorporated in the trading blotter application with the help of InstrumentId identifier. This will use market object in Feeder class.
public class Feeder : INotifyPropertyChanged
{
    private readonly Market _market;
    ...
    [CompositeField]
    public Market Market
    {
        get { return _market; }
    }
}
  

Get the latest and most updated stock trading quotes

For the organizations dealing in stocks and shares, stock trading quotes are the most valuable data necessary to run the organization. The stock trading quotes depicts the quotes and the prices of the various types of shares in the present stock market. The best part of stock trading quotes is that it keeps on updating almost every minute when the stock market is open. Therefore the trading system an organization is using must be able to update these stock trading quotes as soon it is actually updated. We call it real time updating in terms of computer systems. While handling stock trading quotes and the associated various real time updates, the system needs to use safety features and facilities like data security, thread safe application environment, able to use customized data types, handling the data as and when the user wants etc… Therefore designing almost a perfect trading system with stock trading quotes facility is very essential for such organizations. Dapfor has been in the business of stock trading quotes since 2007. They have managed to develop the most useful technology for stock trading quotes named as .net grid.

//Some data object
public class Product : INotifyPropertyChanged
{
    //Some fields
    private double price;
    private DateTime maturity;

    [DoubleFormat(Precision = 3, ShortForm = true, ShowZero = false)]
    public double Price
    {
        get { return price; }
        set
        {
            price = value;
            if(PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("Price"));
            }
        }
    }
    public DateTime Maturity
    {
        get { return maturity; }
    }
    public event PropertyChangedEventHandler PropertyChanged;
}

//Add a data object to the grid.
Product product = new Product();
Row row = grid.Rows.Add(product);

//The grid will automatically sort, filter, group and highlight corresponding row!
//NOTE, YOU DO NOT TOUCH THE GRID HERE!!!
//The product is your business logic and may be placed in any assembly that
//doesn't need to have references to Dapfor assemblies!
product.Price = 123;

//The value in the "Price" cell should equal to '123'.
Assert.AreEqual(row["Price"].Value, 123)

For example the above code handles the real time updating of the .net grids of the stock trading quotes. This development methodology ensures that the data is not lost due to sudden real time updating process. Most of the stock trading quotes based .net grids are able to handle huge amount of data too. Thus the trading systems with stock trading quotes built by Dapfor are the most popular in the market. The .net grid based stock trading quotes is able to deal with any amount of updated data everyday.      

Thursday 19 April 2012

Get to know more using the Dapfor real time stock quotes API

For developers and software designers API (Application programming interface) is an important concept. But it is real time stock quotes API is crucial too for the people dealing in finance and trade. The real time stock quotes API allows people to deal with the regular aspects of stock trading and the internal tutorials to deal with the trading system better. For a financial organization to flourish, real time stock quotes API must be well read. For the reading purposes real time stock quotes API must be well documented. Dapfor is an organization dealing with real time stock quotes since 2007, and hence has the most comprehensive real time stock quotes API in the trade and finance software industry today. The facilities provided by the real time stock quotes API of Dapfor allows you to learn things effectively, quickly and apply them in the real industry.

public class Product : INotifyPropertyChanged
{
    private double price;

    public double Price
    {
        get { return price; }
        set
        {
            //If the price is not the same, change it and notify about price changing
            if (price != value)
            {
                price = value;
                //The event can be raised from any thread. The grid will synchronize thread with GUI without blocking the calling thread.
                //While painting, sorting or filtering the grid can ask this object in the GUI (!) thread to return the price value.
                if(PropertyChanged != null)
                {
                    PropertyChanged(this, new PropertyChangedEventArgs("Price"));
                }
            }
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;
}

public void CreateFilter(Grid grid)
{
    //Set a filter that hides all rows, that contain products with price less than 10
    grid.Filter = new Filter(delegate(Row row)
    {
        //There are three ways to get price:
        //1. From the Cell through the Value property, which returns a double value: row["Price"].Value
        //2. Through the IDataAccessor and IDataField: row.DataAccessor["Price"].Value
        //3. From the data object itself: ((Product)row.DataObject).Price

        if ((double)row["Price"].Value < 10)
        {
            //Filter the row
            return true;
        }

        //The row is not filtered
        return false;
    });
}

//Populate the grid
public void PopulateGrid(Grid grid)
{
    Product product1 = new Product();
    Product product2 = new Product();

    grid.Rows.Add(product1);
    grid.Rows.Add(product2);

    //Update the product's price
    //Data objects will notify the Grid, and it will display only the product2.
    //The product1 will be hidden
    product1.Price = 9;
    product2.Price = 11;
}

The above comprehensive code of the real time stock quotes API developed by Dapfor allows you to understand the concept of IFilter. The IFilter is called whenever new data is added to the .net grid. Therefore just by studying the real time stock quotes API you will be able to understand how it works. Even the real time stock quotes API are given online as a tutorial on the Dapfor website. So whichever method you feel is convenient you should choose that. The real time stock quotes API also have other features and tutorials enlisted in it. Check the real time stock quotes API online for more on trade related software information.

Wednesday 18 April 2012

Managing market orders with trading system from Dapfor

A trading and finance company is dependent on the market orders. These market orders can be of two types. Generally if an organization produces finished or manufactured goods/services then incoming market orders and market orders for buying raw materials for the product manufacturing process. Based on the size of your company you might have a huge bulk of market orders being utilized every day. Therefore the trading software system that you use, should be able to help you in managing these market orders daily, and should also help you in generating market strategy based on the list of market orders.

Dapfor is one of the biggest names in trading software systems development. Started in the year 2007, Dapfor have fully utilized the experience of its developers in the trading field in order to produce the best and easy to use trading system. This software system is based on the reliable technology of .net grid which allows the data to be updated and viewed as and when required. This trading system developed by Dapfor keeps performance, robustness, data safety, easily usable interactive interface, and customizability in viewpoint. The code below shows you the feature of real time blotting for example.

grid.RowUpdated += delegate(object sender, GridRowUpdateEventArgs e)
{
    Feeder feeder = (Feeder) e.Row.DataObject;
    if (e.DataField != null && feeder != null)
    {
        Color color = grid.Highlighting.Color;
        TimeSpan duration = grid.Highlighting.Interval;

        switch (e.DataField.Id)
        {
            case Feeder.FieldLast:
            case Feeder.FieldLastQty:
                color = feeder.PrevLast < feeder.Last ? Color.FromArgb(128, Color.Green) : Color.FromArgb(128, Color.Red);
                break;

            case Feeder.FieldChange:
                double value = (double) e.Row[e.DataField.Id].Value;
                color = Color.FromArgb(128, value > 0 ? Color.DarkGreen : Color.DarkRed);
                break;


            case Feeder.FieldState:
                FeederState state = (FeederState) e.Row[e.DataField.Id].Value;
                color = (Equals(FeederState.Ok, state))
                            ? Color.FromArgb(128, Color.DarkGreen)
                            : Color.FromArgb(128, Equals(FeederState.Nok, state) ? Color.DarkRed : Color.DarkOrange);
                break;

            case Feeder.FieldBid:
            case Feeder.FieldBidQty:
            case Feeder.FieldAsk:
            case Feeder.FieldAskQty:
            case Feeder.FieldVolume:
            case Feeder.FieldHi:
            case Feeder.FieldLow:
                color = Color.FromArgb(128, Color.Orange);
                duration = TimeSpan.FromMilliseconds(500);
                break;
        }

        e.Row[e.DataField.Id].Highlight(duration, color);
    }
}

During the management of market orders in a real time trading system, real time blotting technology helps a lot in the process of updating data. As soon as a particular field is changed in the market orders form, you are kept updated. In fact based on the needs, you might be able to view all the market orders that are being sent and accepted from within the organization. Thread safety and data binding ensures that the updated market orders data remain safe, and is easily viewed by others without the need to change its format. The market orders is a crucial part of a real time trading system and thus should be given importance.

Thursday 5 April 2012

.NET Framework evolving development within itself

Development field has been producing many clinching artifacts since primitive times. Though support of technology based platform has now been prominent in modern age but innovative ideas have always been in abundance. There are some outlined distinctive developments in this world that proves to be a building asset for many other for their own development. Among such kind of amazing development and innovations comes .NET Framework. Developed by Microsoft Incorporations, it works prominently for Windows operating systems.

Grandeur of this software platform can be seen when developing console based applications and websites. There are many things attached to .NET Framework that sets it apart from others in this genre. User friendly graphical interface is one of the most basic and also important aspects of .NET framework. Since it incorporates many features, it is natural to have a big library to hold all entities in it. Compatibility with different languages for coding purposes along with inter-compatibility option between different languages is induced in this platform.

You can create all Windows application on it including real time software along with co-related console based applications. Website designing is also a part of .NET framework. Inter related synchronization with other base development software like SQL Server makes it even more flexible. One of the most important and unique attribute of .NET Framework is IDE, which stands for Integrated Development Environment. This covers up the whole idea vested behind .NET framework of providing the most user friendly platform for developing other interfaces. It is named as Visual Studio and has updated versions available prominently in market.

Another important part of this framework is CLR i.e. Common Language Runtime which is a run time environment especially designed to execute applications created on it. CLR along with its huge library makes .NET Framework. Importance of this base platform will always remain prominent due to its accessibility and brilliant support to other developments.
We can also use various testing tools which allow us to monitor the status of the program and it helps in keeping a track of the performance meter

Hierarchical Data Binding in .Net

.net provides the programmers with server-side controls to bind the data. In other words, it is used to display the client with the format the control is designed for. Many data binding examples are two dimensional i.e. binding of simple flat data source with the result of queries made to the database. But sometimes there are several occasion when data doesn’t fit into a two dimensional spaces that’s where it fails. Data binding are of three types: Hierarchical data binding, Hierarchical Database data binding and binding with XML data.

The only required condition to bind the data to the server-side control is the control must support the property called DataSource including the method called DataBind(). The data source to which the control is to be attached must implement IEnumerable interface with the exception of DataSet and DataTable which can be bound directly. For nested Hierarchical data binding, developers are required to bind the data on the sub-items of each one of them. In other word, the needed condition for programmers is that another data bound control with the ItemTemplate of the Repeater (this server-side control is needed for the purpose of hierarchical data binding which gives the ItemTemplate that shows the each given item in the enumerable data source).
The tough part is to map the SubItems collection of the Item currently attached to the DataSource property of the nested Repeater. There is also a coding type of declaration in the DataSource property of the nested Repeater to achieve hierarchical data binding. The nested data bind will occur only once per Item in the top level. It is important to note that when the pair of nested data bound control, the expressions are scoped to the closest control. To bind the data from the database is to able defining the relationship within the DataSet for extracting the data hierarchically. For XML hierarchical data binding the provided XML API is used for simplifying the coding. For satisfying all the data bonded controls hierarchical data binding must be used.

Hierarchical data binding is very important in desktop applications and it brings flexibility to all the programs. Hierarchical data binding is used in many other frameworks but in .NET it is very easy to implement.