MetaLib .NET SDK 5.0.0.10 » Developer.Team - Developers Paradise!

MetaLib .NET SDK 5.0.0.10

MetaLib .NET SDK 5.0.0.10
MetaLib .NET SDK 5.0.0.10 | 881 kB


The MetaLib .NET SDK includes functions for reading, writing, editing, inserting, sorting and deleting MetaStock price data. It is perfect for software developers wanting to create powerful add-on modules for MetaStock users. You have no complexities of accessing MetaStock data files from your program. As a result, your development time will be shorter.

Main features
Converts MetaStock Data e. g. directly into Excel spreadsheets - it is just a matter of seconds. Stock Data (Date, Open, High, Low, Close, Volume, Open interest) of 2000 trading days (around 3000 calendar days, e.g. more than 8 years) are converted and pasted into Excel within a few seconds.

Supports Visual Basic .NET, C++ .NET, C# .NET or any other programming language supporting .NET assemblies

65500 price data records can be stored per security

Supports the latest MetaStock format version 11.0

Use the following code to display all security details (name, symbol, periodicity, etc.) of a MetaStock directory in a console window.

private void ShowSecurityDetails()
{
  MetaLib m = new MetaLib();
  m.OpenDirectory("C:\\MetaStock", System.IO.FileAccess.ReadWrite);
 
  int nrSec = m.Securities.Count;
  if (nrSec == 0)
  {
    Console.WriteLine("No securities are stored in the directory!");
    return;
  }
  for (int i = 0; i < nrSec; i++)
  {
    Console.WriteLine("Security name: " + m.Securities[i].Name);
    Console.WriteLine("Security symbol: " + m.Securities[i].Symbol);
    Console.WriteLine("Start date: " + m.Securities[i].StartDate.MLDate);
    Console.WriteLine("Last date: " + m.Securities[i].LastDate.MLDate);
    Console.WriteLine("Periodicity: " + m.Securities[i].Periodicity.ToString());
    Console.WriteLine("Interval: " + m.Securities[i].Interval.ToString ());
    Console.WriteLine("Price record file: " + m.Securities[i].FileName);
  }
  m.CloseDirectory();
}


Reading all price records of a MetaStock directory
With following code you are able to read the price records of all securities that are stored in the "C:\MetaStock" directory.

private void ReadAllSecurities()
{
  MetaLib m = new MetaLib();
  m.OpenDirectory("C:\\MetaStock", System.IO.FileAccess.ReadWrite);
 
  int nrSec = m.Securities.Count; // Get number of securities that are
                                  // stored in the directory
  if (nrSec == 0)
  {
    Console.WriteLine("No securities are stored in the directory!");
    return;
  }
 
  for (int i = 0; i < nrSec; i++)
  {
    m.OpenSecurity(m.Securities[i]); // Open all securities in the
                                     // directory
    while (m.PriceRecordsLeft > 0)   // Read all price records
    {
      PriceRecord pr = m.ReadPriceRecord();
      Console.WriteLine(pr.Date.MLDate + ", " + pr.Open + ", " + pr.High + ", " + pr.Low + ", " + pr.Close);
    }
  }
  m.CloseDirectory();
}


Adding a new security and price records to a MetaStock directory
With following code a security with the symbol "MSFT" will be added to the "C:\MetaStock" directory. Furthermore, a price record (OHLC) will be added for the new symbol.

MetaLib m = new MetaLib();
m.OpenDirectory("C:\\MetaStock", System.IO.FileAccess.ReadWrite);
m.AppendSecurity("MSFT", "Microsoft", Periodicity.Daily);
m.AppendPriceRecord(new PriceRecord(new MetaLibDate(20120828),
                   (float)30.7, (float)30.8, (float)30.52, (float)30.63,
                   (float)23947900));
m.CloseDirectory();


How to add MetaLib .NET to your .NET projects
Start Visual Studio and create a new .NET project
Click on the "Projects->Add Reference..." menu item
In the "Add Reference" dialog select the "Browse" tab and go the directory where the MetaLib.dll file is stored (Normally C:\Program Files\MetaLib .NET). Afterwards, double-click on the "MetaLib.dll" file.

Technical Specifications
MetaLib .NET supports the latest compatible MetaStock version 11.0 data format.

Data for up to 6000 securities can be stored in each directory. However, the fewer securities you have in a folder, the better the performance of programs that access the data (e.g., MetaStock) will be. Some programs still will not recognize more than 255 securities in a directory, the limit for previous versions of the MetaStock data format.

A maximum of 65500 records can be saved for each security. This is a MetaStock limitation. If MetaLib would allow to store more than 65500 records in a file no other programs would be able to read those records.

Supported Date Range: January 1, 1910 to December 31, 2199

Only for V.I.P
Warning! You are not allowed to view this text.