39
API documentation for Mflib.dll http://meta-all.sourceforge.net/

MFLib DLL API Documentation

Embed Size (px)

DESCRIPTION

Metastock

Citation preview

Page 1: MFLib DLL API Documentation

API documentationfor Mflib.dll

http://meta-all.sourceforge.net/

Page 2: MFLib DLL API Documentation

Table of ContentsLicense.......................................................................................................................................................4Introduction................................................................................................................................................4Background................................................................................................................................................4Class Overview..........................................................................................................................................6How to Add Mflib.dll to my Project..........................................................................................................8

Reference w/o Source Code..................................................................................................................8Reference w/ Source Code..................................................................................................................10

PortfolioGroup.........................................................................................................................................14Methods...............................................................................................................................................14

Public Sub add(ByVal Path As String, ByVal IsExisting As Boolean)..........................................14Public Sub add(ByRef portf As MFLib.Portfolio).........................................................................14

Properties.............................................................................................................................................15Public ReadOnly Property Portfolio(ByVal index As Integer) As MFLib.Portfolio......................15Public ReadOnly Property Portfolio(ByVal dir As String) As MFLib.Portfolio............................15Public ReadOnly Property Count() As Integer...............................................................................15

Portfolio...................................................................................................................................................17Methods...............................................................................................................................................18

Public Sub New(ByVal Path As String, ByVal IsExisting As Boolean, Optional ByVal AdjustForSplits As Boolean = False).............................................................................................18Public Function NewSecurity(ByVal Symbol As String, ByVal Desc As String, ByVal StartDate As Date) As MFLib.Metafile..........................................................................................................18Public Sub Save(Optional ByVal path As String = "", Optional ByVal CreateDir As Boolean = False)..............................................................................................................................................18Public Function Exists(ByVal symbol As String) As Boolean.......................................................19Public Function FindSecurityByName(ByVal name As String) As Integer...................................19Public Function FindSecurityBySymbol(ByVal symbol As String) As Integer.............................20Public Sub Delete(ByVal index As Integer)...................................................................................20Public Sub Delete(ByVal symbol As String)..................................................................................20Public Function Update(Optional ByVal UseThreading As Boolean = True) As Long.................21Public Sub StopUpdate()................................................................................................................21

Properties.............................................................................................................................................21Public Property DataProvider(ByVal DataSource As Object) As MFLib.DataProviders.Service. 21Public ReadOnly Property Path() As String...................................................................................22Public ReadOnly Property QuotesUpdated() As Long...................................................................22Public ReadOnly Property Security(ByVal index As Integer) As MFLib.Metafile........................23Public ReadOnly Property Security(ByVal symbol As String) As MFLib.Metafile......................23Public ReadOnly Property SecurityCount() As Integer..................................................................23Public Property ThreadCount() As Integer.....................................................................................24Public ReadOnly Property UpdatePercentage() As Decimal..........................................................24Public ReadOnly Property UpdatingSecurities() As String().........................................................24Public Property Use20Min() As Boolean.......................................................................................25

Metafile....................................................................................................................................................26Methods...............................................................................................................................................27

Public Function AddQuote(ByVal QDate As String, ByVal QClose As Single, ByVal QHigh As Single, ByVal QLow As Single, ByVal QOpen As Single, ByVal QInterest As Single, ByVal QVolume As Single) As Object......................................................................................................27Public Function AddQuote(ByVal QDate As String, ByVal QTime As Single, ByVal QClose As Single, ByVal QHigh As Single, ByVal QLow As Single, ByVal QOpen As Single, ByVal QInterest As Single, ByVal QVolume As Single) As Object..........................................................27

Page 3: MFLib DLL API Documentation

Public Sub LoadQuotes()................................................................................................................28Public Function RecordNumber() As Integer.................................................................................28Public Sub Save(Optional ByVal OverrideLocks As Boolean = True, Optional ByVal SaveTo As String = "")......................................................................................................................................28Public Sub Sort(ByRef DeleteDuplicates As Boolean)..................................................................29Public Sub UnloadQuotes()............................................................................................................29Public Function Update(ByVal Service As MFLib.DataProviders.Service, ByVal AdjustSplits As Boolean, ByVal Delayed20min As Boolean) As Long...................................................................29

Properties.............................................................................................................................................30Public ReadOnly Property CountQuotes() As Object....................................................................30Public ReadOnly Property FileName() As String...........................................................................30Public ReadOnly Property GetName() As String...........................................................................30Public ReadOnly Property GetQuote(ByVal Qdate As Date) As MFLib.Quote............................31Public ReadOnly Property GetQuote(ByVal index As Integer) As MFLib.Quote.........................31Public ReadOnly Property GetSymbol() As String........................................................................31Public ReadOnly Property HasDelayed() As Object......................................................................31Public ReadOnly Property IsUpToDate() As Boolean...................................................................32Public ReadOnly Property QuotesAreLoaded() As Boolean..........................................................32

Appendix A - MASTER...........................................................................................................................34Appendix B - EMASTER........................................................................................................................35Appendix C - XMASTER........................................................................................................................37Appendix D – F*.DAT (or F*.MWD)......................................................................................................39

Page 4: MFLib DLL API Documentation

LicenseThis work is licensed under the Creative Commons Attributions-NonCommerical-ShareAlike 2.5 License.

To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/deed.en

IntroductionThe purpose of this document is to provide the user/developer with an understanding of the classes used in the DLL.

The Document will try to show examples and use scenarios to help budding programmers learn the MFLib.dll to create their own applications.

The Document will also try to provide a high level view of the DLL to give experienced developers a better understanding of the code and the opportunity to contribute to the project instead of trying to wade through the code.

BackgroundThe main function of the DLL is to provide the ability to read and write to the Metastock/Computrac file format.

In a Metastock directory it is likely that there will be several different files. The following files may be present in the directory.

● MASTER

● EMASTER

● XMASTER(only if there are more than 255 security records)

● F*.DAT files(or F*.WMD where * is greater than 255)

First lets discuss these files, and what they are.

MASTER – The MASTER files contains a list of securities and information about the securities, as well as the index number for the DAT file which contains all the quote information for a respective security. This file can contain up to 255 securities. See the masterfiledescriptor.vb file and/or Appendix A for further detail on the construction of this file.

EMASTER – The EMASTER files contains the same list of securities as in the MASTER file, with some additional information, that the MASTER does not provide. See the emasterfiledescriptor.vb file and/or Appendix B for further detail on the construction of this file.

XMASTER – The XMASTER file contains a list of securities and information about the securities similar to the EMASTER. The XMASTER is used to store securities from index number 256 and up to 65535. This file automatically gets created when a new security needs to

Page 5: MFLib DLL API Documentation

get added and the MASTER and EMASTER files are full. See the xmasterfiledescriptor.vb file and/or Appendix C for further detail on the construction of this file.

F*.DAT – The F*.DAT file where * is the index number as defined in the MASTER/EMASTER or XMASTER file is the data file that stores the quotes for a particular security. See the Appendix D for further detail on the construction of this file.

Page 6: MFLib DLL API Documentation

Class Overview

The above class diagram gives a basic functional hierarchy of the MFLib.dll and its functionality.

PortfolioGroup class is an object for holding multiple Portfolios.

Portfolio class pertains to an object that holds all or most of the data pertaining to a particular Metastock directory.

Metafile class is an object for holding information about a particular security

Therefore a Portfolio Object can contain many MetaFile Objects. Where the Portfolio object contains the list of all the securities(as defined by the MASTER, EMASTER and XMASTER files) and the Metafile objects contain all the information pertaining to those securities which is a combination of security configuration defined in the MASTER files and the Quote data as defined by the F*.DAT files.

Page 7: MFLib DLL API Documentation

The Purpose of the PortfolioGroup object is to house multiple Metastock directories/Portfolio Objects, which gives the developer the ability to load, read, write, update and manipulate multiple sets of data.

Under the Metafile class are several helper type classes and objects.

The Quote Classes are used to retrieve quote data from particular websites.

The Quote object is used to hold the quote data. Where each quote object contains a public varible for Date, Time, Open, High, Low Close, Volume and Open Interest which can be used as required.

The Fields Class holds the information received from the EMASTER or XMASTER pertaining to the Securities configuration information, whether the security has a time field or Open Interest Field etc.

The SUTC class provides the Multi threading, which is actually used by the Portfolio class to call the Metafile functions.

The FileRecord and FileDescriptor classes are used to define how the MASTER, EMASTER and XMASTER are configured and how the data is read.

The Functions Module contains many low level functions for reading and writing to files, performing common math functions, and for creating byte arrays required for writing to files.

The Symbol List Classes are used to define how the Metastock symbol list files are configured and how the data is read.

Page 8: MFLib DLL API Documentation

How to Add Mflib.dll to my ProjectPrior to Starting it is probably best to download the latest copy of the source code.

First create a new .NET project or open an existing .NET project.

Reference w/o Source CodeIf you are only interested in using the API and are not interested in the underlying code in the API follow these directions for adding the DLL to the project.

Right click on your solution in the solution explorer and select properties.

With the Properties tab open select the references button on the left side.

Page 9: MFLib DLL API Documentation

Next click on the Add->Reference button.

Once the Add Reference file dialog is open click on the browse tab and locate the mflib.dll. This can either be found in the source code that is downloaded or with the Meta-All installation, under program files.

Page 10: MFLib DLL API Documentation

Then click OK. Mflib.dll should now be listed as a reference and you can begin coding.

Reference w/ Source CodeTo add the mflib.dll code to your project follow the procedure below.

With your application open, click File - > Add - > Existing Project on the file menu.

Page 11: MFLib DLL API Documentation

Locate the Mflib.vproj file and click open.

The MFLib.dll project will now be visible in the solution explorer window. Right click on the windows application in the solution explorer and click on properties.

Page 12: MFLib DLL API Documentation

When the Properties tab open select references on the left side of the properties tab.

Next click on the Add->Reference button.

Page 13: MFLib DLL API Documentation

With the add Reference File dialog open click on the Projects tab, and select Mflib.

Then click the OK button.Mflib.dll should now be listed as a reference and you can begin coding.

Please feel free to contribute code changes ;)

Page 14: MFLib DLL API Documentation

PortfolioGroupThe PortfolioGroup resides in the PortfolioHolder.vb file. The function of the PortfolioGroup is to hold an array of Metastock Portfolios where a Portfolio consists of a Metastock Directory.

Methods

Public Sub add(ByVal Path As String, ByVal IsExisting As Boolean)

Member of: MFLib.PortfolioGroup

Summary:Creates and adds a Portfolio to the Portfolio Group.

Parameters:path: The file or directory where Metastock Data Located (MASTER/EMASTER and XMASTER )IsExisting: True if the directory contains Metastock Data, false if new files need to be created

Return Values:none.

Example:Dim PFG As New MFLib.PortfolioGroup

PFG.add("C:\MetaStock Data\Index\", True)

Public Sub add(ByRef portf As MFLib.Portfolio)

Member of: MFLib.PortfolioGroup

Summary:Adds a existing Portfolio to the Portfolio Group.

Parameters:portf : The existing portfolio object to be added to the PortfolioGroup

Return Values:none.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim PFG As New MFLib.PortfolioGroupPFG.add(PF)

PortfolioGroupC lass

Fields

tab

Properties

CountPortfolio (+ 1 not …

Methods

add (+ 1 overload)Remove

Page 15: MFLib DLL API Documentation

Properties

Public ReadOnly Property Portfolio(ByVal index As Integer) As MFLib.Portfolio

Member of: MFLib.PortfolioGroup

Summary:Returns a Portfolio object specified by index number for the given PortfolioGroup.

Parameters:index : The index number of the Portfolio within the PortfolioGroup.

Return Values:Returns a Portfolio Object.

Example:

Dim PFG As New MFLib.PortfolioGroupPFG.add("C:\MetaStock Data\Index\", True)PFG.add("C:\MetaStock Data\Test\", True)

Dim PF As MFLib.PortfolioPF = PFG.Portfolio(1)

Public ReadOnly Property Portfolio(ByVal dir As String) As MFLib . Portfolio

Member of: MFLib.PortfolioGroup

Summary:Returns a Portfolio object specified by the directory for the Portfolio in a given PortfolioGroup.

Parameters:dir : The directory of the Portfolio within the PortfolioGroup.

Return Values:Returns a Portfolio Object.

Example:

Dim PFG As New MFLib.PortfolioGroupPFG.add("C:\MetaStock Data\Index\", True)PFG.add("C:\MetaStock Data\Test\", True)

Dim PF As MFLib.PortfolioPF = PFG.Portfolio("C:\MetaStock Data\Test\")

Public ReadOnly Property Count() As Integer

Member of: MFLib.PortfolioGroup

Summary:Returns an integer count on the number of Portfolios in the Portfolio Group.

Parameters:none.

Return Values:Returns a Integer.

Page 16: MFLib DLL API Documentation

Example:

Dim PFG As New MFLib.PortfolioGroupPFG.add("C:\MetaStock Data\Index\", True)PFG.add("C:\MetaStock Data\Test\", True)Dim iCount As Integer iCount = PFG.Count

Page 17: MFLib DLL API Documentation

PortfolioThe portfolio code resides in the portfolio.vb file. The function of the Portfolio object to house the data pertaining to a particular Metastock data directory. This would consist of the MASTER/EMASTER/XMASTER data file information and an array of Metafile Objects which contain the security information.

PortfolioC lass

Fields

AdjustSplitsDefaultServicedirMaxThreadsSecCountSecUpdStocksUCountUDoneURunningUse20MinutesUThread

Properties

DataProviderPathQuotesUpdatedSecurity (+ 1 not …SecurityCountThreadCountUpdatePercentageUpdatingSecuritiesUse20Min

Methods

Delete (+ 1 overl…ExistsF indSecurityByNa…FindSecurityBySy…NewNewSecuritySaveStopUpdateUpdateUpdateThreaded

Page 18: MFLib DLL API Documentation

Methods

Public Sub New(ByVal Path As String, ByVal IsExisting As Boolean, Optional ByVal AdjustForSplits As Boolean = False)

Member of: MFLib.Portfolio

Summary:Creates a Portfolio Object, reads the MASTER,EMASTER and XMASTER, stores pertinent information in private variables, and then builds the Metafile objects from the data found in the master files and stores them as part of the portfolio Object.

Parameters:path: The file or directory where Metastock Data Located (MASTER/EMASTER and XMASTER )IsExisting: True if the directory contains Metastock Data, false if new files need to be created.

AdjustForSplits: True if the user would like to use split adjusted data from Yahoo

Return Values:none.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)

Public Function NewSecurity(ByVal Symbol As String, ByVal Desc As String, ByVal StartDate As Date) As MFLib.Metafile

Member of: MFLib.Portfolio

Summary:Creates a MetaFile object, appends it to the Portfolio Object. The function also writes the appropriate security data to the MASTER/EMASTER or XMASTER file.

Parameters:Symbol: The String to be used for the Security SymbolDesc: The String to be used for the Security Description.

StartDate: The Date used to define when the first quote date should be. Is used when downloading data. Though the startdate could be defined as 1/1/1900, data may not be available, but the date will not affect the data.

Return Values:returns a Metafile object.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim MySec As MFLib.Metafile

MySec = PF.NewSecurity("YHOO", "Yahoo Security", New Date(1900, 1, 1))

Public Sub Save(Optional ByVal path As String = "", Optional ByVal CreateDir As Boolean = False)

Member of: MFLib.Portfolio

Summary:The Save function saves all the security data received. The Save function essential uses the MetaFile Object save function to update each each security. It updates the MASTER/EMASTER or XMASTER and stores any Quote data into the appropriate F*.DAT file. Optionally it can be used to save all the files to a new directory. This function would be useful after manually adding multiple quotes to various securities.

Page 19: MFLib DLL API Documentation

Alternately the Metafile.vb Save method could be used to save each individual security.

Parameters:path: (Optionally) The file or directory where Metastock Data is to be Saved (MASTER/EMASTER and XMASTER )CreateDir: True if the directory needs to be created.

Return Values:none.

Example:

''Save the Security Data for a given Portfolio. This adds the quote to the first Security and the Second Security''A Security Index number is being used or a Symbol as shown in the example below.Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security(“YHOO”).AddQuote(New Date(1900, 1, 1), 1, 2, 1, 1, 0, 10000)PF.Security(“GOOG”).AddQuote(New Date(1900, 1, 1), 1, 2, 1, 1, 0, 10000)PF.Save()

Public Function Exists(ByVal symbol As String) As Boolean

Member of: MFLib.Portfolio

Summary:Given a ascii symbol the Exist function checks the portfolio for a security with a matching symbol. If a Security with a matching symbol is found, the function returns a boolean True.

Parameters:symbol: The symbol to search for in the current Portfolio.

Return Values:returns a boolean true if a security with a matching symbol is found.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim IsMySymExist As BooleanIsMySymExist = PF.Exists("YHOO")

Public Function FindSecurityByName(ByVal name As String) As Integer

Member of: MFLib.Portfolio

Summary:Searches through the descriptions of the all the securities in the Portfolio for a match. If a match is found the function returns the index number of the security.

Parameters:name: The Ascii String used in the search through security descriptions.

Return Values:Returns the Index of the security held in the Portfolio if a match is found. If nothing is found returns -1.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim WhatIsMySecIndexNum As IntegerWhatIsMySecIndexNum = PF.FindSecurityByName("YAHOO")

Page 20: MFLib DLL API Documentation

Public Function FindSecurityBySymbol(ByVal symbol As String) As Integer

Member of: MFLib.Portfolio

Summary:Searches through the Symbols of the all the securities in the Portfolio for a match. If a match is found the function returns the index number of the security.

Parameters:symbol: The Ascii Symbol used in the search through the securities in the Portfolio.

Return Values:Returns the Index of the security held in the Portfolio if a match is found. If nothing is found returns -1.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim WhatIsMySecIndexNum As IntegerWhatIsMySecIndexNum = PF.FindSecurityBySymbol("YHOO")

Public Sub Delete(ByVal index As Integer)

Member of: MFLib.Portfolio

Summary:Permanently deletes the security from the Portlio, MASTER/EMASTER or XMASTER given an index number.

Parameters:index: The index number of the security to be deleted.

Return Values:none.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Delete(1)

Public Sub Delete(ByVal symbol As String)

Member of: MFLib.Portfolio

Summary:Permanently deletes the security from the Portlio, MASTER/EMASTER or XMASTER given an Ascii Symbol.

Parameters:symbol: The Symbol of the security to be deleted.

Return Values:none.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Delete("YHOO")

Page 21: MFLib DLL API Documentation

Public Function Update(Optional ByVal UseThreading As Boolean = True) As Long

Member of: MFLib.Portfolio

Summary:The update function updates the securities in the Portfolio using one of the available DataProviders as defined in the DataProviders.vb file. The Update function cycles through the Securities in the Portfolio by downloading the data, updating the master files, and then updating the Quote Data. The Function allows the user to optionally disable the Threading and perform the update sequentially. By Default the Update function performs the update in a multi-threaded fashion. Prior to using the Update function be sure to assign the right dataprovider to the Portfolio.

Parameters:UseThreading: (Optional)True by default. If set to false the securities will be updated in a sequential fashion.

Return Values:Returns a Long containing the total Number of Quotes added to all the securities.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim myDataProviderService As MFLib.DataProviders.ServiceDim NumOfQuotesAdded As LongmyDataProviderService = MFLib.DataProviders.Service.BSEEOD 'Set the Service to BSEEODPF.DataProvider(0) = myDataProviderService 'Set the Portfolio Service to BSEEODNumOfQuotesAdded = PF.Update(True) 'Update all the securities in the Portfolio

Public Sub StopUpdate()

Member of: MFLib.Portfolio

Summary:Cleanly Halts the Update process by waiting for the current threads running to complete.

Parameters:none.

Return Values:none.

Example:

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim myDataProviderService As MFLib.DataProviders.ServiceDim NumOfQuotesAdded As LongmyDataProviderService = MFLib.DataProviders.Service.BSEEOD 'Set the Service to BSEEODPF.DataProvider(0) = myDataProviderService 'Set the Portfolio Service to BSEEODNumOfQuotesAdded = PF.Update(True) 'Update all the securities in the Portfolio

PF.StopUpdate() 'Halts the Update Process

Properties

Public Property DataProvider(ByVal DataSource As Object) As MFLib.DataProviders.Service

Member of: MFLib.Portfolio

Page 22: MFLib DLL API Documentation

Summary:Its important to set this property prior to running the portfolio update function. This sets the Data provider property in the Portfolio Object which tells the security update function where to retrieve the data from. This property can also return DataProvider.

Parameters:DataSource. - Set to 0

Return Values:Will return the DataProvider service for the portfolio.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim myDataProviderService As MFLib.DataProviders.ServicePF.DataProvider(0) = MFLib.DataProviders.Service.BSEEOD 'set the Data Provider as BSEEOD

myDataProviderService = PF.DataProvider(0) 'Get the Function to return the DataProvider

Public ReadOnly Property Path() As String

Member of: MFLib.Portfolio

Summary:This is a readonly property which can be used to retrieve the path of the current portfolio.

Parameters:none.

Return Values:Returns the Portfolio File Path.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim WhatisthePath As StringWhatisthePath = PF.Path 'Should return "C:\MetaStock Data\Index\"

Public ReadOnly Property QuotesUpdated() As Long

Member of: MFLib.Portfolio

Summary:The QuotesUpdated function returns the current number of quotes added to the securities that have been updated. This number reflects all securities during that update process that have completed their update process. This can be used in a Timer to process and number of quotes entered.

Parameters:none.

Return Values:Returns a Long reflecting all quotes added across all securities that have been completed.

Example:'This shows an example of a timer which updates the text in a Label with QuotesUpdated Value'Start this timer before the Update Function is called, stop the timer when PF.UpdatePercentage = 1 using a while loopPrivate Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

lblQuotesDown.Text = PF.QuotesUpdatedEnd Sub

Page 23: MFLib DLL API Documentation

Public ReadOnly Property Security(ByVal index As Integer) As MFLib.Metafile

Member of: MFLib.Portfolio

Summary:This function returns the Metafile object for a particular security in the portfolio Object given an Index Number. This Property can also be used to access the Metafile objects methods and properties.

Parameters:index. The function requires an index number for the Metafile object.

Return Values:Returns the Metafile object or provides access to the Metafile objects methods and properties.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim SecTimeFrame As String'Method 1Dim mySecurity As MFLib.MetafilemySecurity = PF.Security(0)SecTimeFrame = mySecurity.TimeFrame'Method 2 (prefered Method)SecTimeFrame = PF.Security(0).TimeFrame

Public ReadOnly Property Security(ByVal symbol As String) As MFLib.Metafile

Member of: MFLib.Portfolio

Summary:This function returns the Metafile object for a particular security in the portfolio Object given an Ascii Symbol String. This Property can also be used to access the Metafile objects methods and properties.

Parameters:symbol . The function requires a Symbol for the Metafile Object.

Return Values:Returns the Metafile object or provides access to the Metafile objects methods and properties.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim SecTimeFrame As String'Method 1Dim mySecurity As MFLib.MetafilemySecurity = PF.Security(“YHOO”)SecTimeFrame = mySecurity.TimeFrame'Method 2 (prefered Method)SecTimeFrame = PF.Security(“YHOO”).TimeFrame

Public ReadOnly Property SecurityCount() As Integer

Member of: MFLib.Portfolio

Summary:The SecurityCount Property is a readonly property that returns the number of securities stored in the Portfolio object as metafile objects.

Parameters:none.

Return Values:This Property returns an Integer as the number of Securities in the Portfolio.

Example:

Page 24: MFLib DLL API Documentation

Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim howManySec As IntegerhowManySec = PF.SecurityCount

Public Property ThreadCount() As Integer

Member of: MFLib.Portfolio

Summary:This property can be used to set or get the number of threads to be used when running the Update function in multithreaded mode.

Parameters:none.

Return Values:Returns an integer indicating the number of threads being used by the update function.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim NumOfQuotesAdded As LongPF.DataProvider(0) = MFLib.DataProviders.Service.BSEEODPF.ThreadCount = 6 'Set the number of threads to 6NumOfQuotesAdded = PF.Update(True) 'Update all the securities in the Portfolio

Dim howManyThreads As IntegerhowManyThreads = PF.ThreadCount 'Read back the number of threads

Public ReadOnly Property UpdatePercentage() As Decimal

Member of: MFLib.Portfolio

Summary:This readonly proper returns a decimal value indicating the % completion of the update process.

Parameters:none.

Return Values:returns % complete in decimal form.

Example:'This shows an example of a timer which updates the text in a Label with UpdatePercentage Value'Start this timer before the Update Function is called, stop the timer when PF.UpdatePercentage = 1 using a while loopPrivate Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

lblUpdatePercentage.Text = PF.UpdatePercentageEnd Sub

Public ReadOnly Property UpdatingSecurities() As String()

Member of: MFLib.Portfolio

Summary:This property returns an array of symbols (stings()) that are currently being updated by the update function while running multithreaded.

Parameters:none.

Return Values:Returns an Array of strings.

Page 25: MFLib DLL API Documentation

Example:'This shows an example of a timer which updates the text in a Label with Symbols of the Securities being updated'Start this timer before the Update Function is called, stop the timer when PF.UpdatePercentage = 1 using a while loop'This shows a loop to build a comma delimited string of the symbols to post in a label on the formPrivate Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Dim temp() As String = PfG.Portfolio(GblPortfolioIndex).UpdatingSecuritiesIf (Not (temp Is Nothing)) Then

lblSecurity.Text = ""Dim i As IntegerFor i = 0 To temp.Length - 1 Step 1

If (temp(i) <> "") ThenIf (lblSecurity.Text = "") ThenlblSecurity.Text = temp(i)ElselblSecurity.Text = lblSecurity.Text & "," & temp(i)End If

End IfNext

End IfEnd Sub

Public Property Use20Min() As Boolean

Member of: MFLib.Portfolio

Summary:The Use20Min property is used to get or set a boolean which tells the Update function whether to use 20minute delayed data when updating a security. This can be useful as often times Yahoo is extremely slow at updating their EOD Data. The Update function will replace the 20min data stored from previous days with proper EOD data that it downloads. This should be set prior to running the Update function.

Parameters:none.

Return Values:Returns the Boolean value for determining whether the portfolio update uses 20min quotes.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim WhatsMyUse20min As BooleanDim NumOfQuotesAdded As LongPF.DataProvider(0) = MFLib.DataProviders.Service.BSEEOD 'Set the Service to BSEEODPF.Use20Min = True 'Set Use20min delay quotes to TrueNumOfQuotesAdded = PF.Update(True) 'Update all the securities in the Portfolio

WhatsMyUse20min = PF.Use20Min 'Get boolean value of Use20Min

Page 26: MFLib DLL API Documentation

MetafileThe purpose of the Metafile object is store and hold data specific to a security. Any data related to the security which was stored in the MASTER/EMASTER or XMASTER will be stored in the securities Metafile Object. The Metafile object is also responsible for updating and managing the Quote Data. Though an individual Metafile object can be created and used it seems to make more logical sense to interact with the Metafile objects housed within a portfolio Object.

MetafileC lass

Fields

AutoRunDataLoadedDefaultServiceFDateFileFileNumFileTypeFirstDateLngHas20MinuteIDATimeIsXLastUpdQuoteCo…LastVolumeLDateNameQuotecountQuoteDataRecCountRecLenRecNumberStarttimeStoptimeStoredFieldsSymbolTimeFramev28

Properties

CountQuotesFileNameGetNameGetQuote (+ 1 n…GetSymbolHasDelayedIsUpToDateLastUpdateQuote…QuotesAreLoaded

Methods

AddQuote (+ 1 o…DeleteLoadQuotesNew (+ 4 overloa…RecordNumberSaveSetLDateFromQu…SortUnloadQuotesUpdate

Page 27: MFLib DLL API Documentation

MethodsAll examples shown will access the Metafile objects through the portfolio Object.

Public Function AddQuote(ByVal QDate As String, ByVal QClose As Single, ByVal QHigh As Single, ByVal QLow As Single, ByVal QOpen As Single, ByVal QInterest As Single, ByVal QVolume As Single) As Object

Member of: MFLib.Metafile

Summary:This Method adds a EOD quote to a Security Metafile Object. The quote data must be specified as the parameters of the function. The Metafile Save Method must be called after the addquote function is called in order to save the data to the security files.

Parameters:QDate . The date must be a string in the following format “MM/DD/YYYY”.QClose . The Close parameter is the closing value for the security on the specified date.QHigh . The High parameter is the Daily high for the security on the specified date.QLow . The Low parameter is the Daily Low for the security on the specified date.QOpen . The open parameter is the Open value of the security on the specified date.QInterest .The Interest Parameter is the Open Interest of a commodity on the specified date.QVolume . The volume Parameter is the Volume of the security on the specified date..

Return Values:Returns 1 if the quote is added and 0 if the quote is not added.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security("YHOO").AddQuote("12/25/2007", 900, 1200, 300, 100, 0, 1000000)PF.Security("YHOO").Save() 'Save the Data to the F*.dat and MASTER/EMASTER or XMASTER

Public Function AddQuote(ByVal QDate As String, ByVal QTime As Single, ByVal QClose As Single, ByVal QHigh As Single, ByVal QLow As Single, ByVal QOpen As Single, ByVal QInterest As Single, ByVal QVolume As Single) As Object

Member of: MFLib.Metafile

Summary:This Method adds a Intraday quote to a Security Metafile Object. The quote data must be specified as the parameters of the function. The Metafile Save Method must be called after the addquote function is called in order to save the data to the security files.

Parameters:QDate . The date must be a string in the following format “MM/DD/YYYY”.QTime . The Time must be provided as a Single. Eg 9:30am is 930, Eg. 4Pm is 1600QClose . The Close parameter is the closing value for the security on the specified date.QHigh . The High parameter is the Daily high for the security on the specified date.QLow . The Low parameter is the Daily Low for the security on the specified date.QOpen . The open parameter is the Open value of the security on the specified date.QInterest .The Interest Parameter is the Open Interest of a commodity on the specified date.QVolume . The volume Parameter is the Volume of the security on the specified date..

Return Values:Returns 1 if the quote is added and 0 if the quote is not added..

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security("YHOO").AddQuote("12/25/2007", 930, 900, 1200, 300, 100, 0, 1000000)PF.Security("YHOO").Save() 'Save the Data to the F*.dat and MASTER/EMASTER or XMASTER

Page 28: MFLib DLL API Documentation

Public Sub LoadQuotes()

Member of: MFLib.Metafile

Summary:The LoadQuotes function loads the quotes for the Metafile Security into memory. By default the quotes are not loaded into the Metafile Object. Calling this function will load the Quotes into the Metafile Object, allowing the user to read all the quotes out of the Metafile object for a particular security. When the Quotes are no longer loaded it is good practice to call the UnloadQuotes function to free the memory that the application is utilizing.

Parameters:none.

Return Values:none.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security("YHOO").LoadQuotes()

Public Function RecordNumber() As Integer

Member of: MFLib.Metafile

Summary:The RecordNumber function returns the record number as defined by the MASTER/EMASTER or XMASTER file. The Record number can then be used to locate F#.dat file where # represents the record number

Parameters:none.

Return Values:Returns an Integer which represents the Record Number for specified Security.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security(2).RecordNumber()

Public Sub Save(Optional ByVal OverrideLocks As Boolean = True, Optional ByVal SaveTo As String = "")

Member of: MFLib.Metafile

Summary:The Save Function updates the MASTER/EMASTER or XMASTER with the appropriate last date, and writes any quotes that have been added to the quotes in memory to the F#.dat file for that particular security.

Parameters:OverrideLocks . - Writes to the files even if Metastock has the files locked.SaveTo . - Writes to the quote data to an alternate location if a master file exists.

Return Values:none.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security("YHOO").AddQuote("12/25/2007", 900, 1200, 300, 100, 0, 1000000)PF.Security("YHOO").Save() 'Save the Data to the F*.dat and MASTER/EMASTER or XMASTER

Page 29: MFLib DLL API Documentation

Public Sub Sort(ByRef DeleteDuplicates As Boolean)

Member of: MFLib.Metafile

Summary:The Sort Function, loads all quotes into memory, and then sorts them by date and time. If the Parameter DeleteDuplicates is set to true, any duplicate date/ time entries will be removed.

Parameters:DeleteDuplicates . - noneSet to True to delete duplicate date/ time entries .

Return Values:none.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security(2).Sort(True)PF.Security(2).Save()

Public Sub UnloadQuotes()

Member of: MFLib.Metafile

Summary:The UnloadQuotes function unloads the quotes from memory for the respective Metafile Object.This function should be used when the quote data for the Metafile object is no longer need in memory.

Parameters:none.

Return Values:none.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim myquote As MFLib.QuotePF.Security("YHOO").LoadQuotes()myquote = PF.Security("YHOO").GetQuote(0) 'Get the first quote in the data filePF.Security("YHOO").UnloadQuotes()

Public Function Update(ByVal Service As MFLib.DataProviders.Service, ByVal AdjustSplits As Boolean, ByVal Delayed20min As Boolean) As Long

Member of: MFLib.Metafile

Summary:The Metafile Update function updates an individual security metafile object with EOD or Intraday backfill data. A data provider must be specified in the parameters to indicate where the source of the data will come from. AdjustSplits parameters indicates that when using Yahoo EOD data use the data that has already been adjusted for splits. The delayed 20 min parameter indicates that 20min data is to be used if the EOD data is not available yet. The last two Data records are always over written with EOD data to prevent having 20min delayed data in the data files. Rerunning this function using 20min delayed data will updated the last record with the lastest 20min delayed data that was downloaded. To permanently save the data to file the Save function must be called after the update function.

Parameters:Service . - This parameter indicates what the source of the data should be.AdjustSplits . - The AdjustSplits parameter indicates that when using Yahoo EOD data that the data adjusted for stock splits should be used..Delayed20min . - This parameter indicates that 20min delayed data should be used if EOD data is not available.

Return Values:

Page 30: MFLib DLL API Documentation

Returns the number of quotes added to the Data Record.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security("YHOO").Update(MFLib.DataProviders.Service.YahooEOD, True, True)PF.Security("YHOO").Save(True)

Properties

Public ReadOnly Property CountQuotes() As Object

Member of: MFLib.Metafile

Summary:The CountQuotes Property returns the number of quotes that a specific security has stored in its F#.dat file.

Parameters:none.

Return Values:Returns the Length of the Quote Array.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim whatsNumofQuotes As IntegerwhatsNumofQuotes = PF.Security("YHOO").CountQuotes

Public ReadOnly Property FileName() As String

Member of: MFLib.Metafile

Summary:The FileName Property returns the F#.dat file filename in that format. Eg wil return “F1.dat”.

Parameters:none.

Return Values:Returns the filename for the security which holds the securities quote data.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim myfilenamestore As Stringmyfilenamestore = PF.Security("YHOO").FileName

Public ReadOnly Property GetName() As String

Member of: MFLib.Metafile

Summary:The GetName property returns the description of the security as provided when the security was created..

Parameters:none.

Return Values:

Page 31: MFLib DLL API Documentation

Returns a string value which is the description of the security.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim mysecDescription As StringmysecDescription = PF.Security("YHOO").GetName

Public ReadOnly Property GetQuote(ByVal Qdate As Date) As MFLib.Quote

Member of: MFLib.Metafile

Summary:This GetQuote Property returns the quote specified by the date passed in by the parameter.

Parameters:Qdate . - The Date of the quote specified to be returned.

Return Values:Returns a Quote object.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim myquote As MFLib.QuotePF.Security("YHOO").LoadQuotes()myquote = PF.Security("YHOO").GetQuote(New Date(1900, 1, 1)) 'Get the quote with date 1/1/1900PF.Security("YHOO").UnloadQuotes()

Public ReadOnly Property GetQuote(ByVal index As Integer) As MFLib.Quote

Member of: MFLib.Metafile

Summary:This GetQuote Property returns the quote specified by the index number passed in by the parameter.

Parameters:index . - The index number of the quote to be returned.

Return Values:Returns a Quote Object.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim myquote As MFLib.QuotePF.Security("YHOO").LoadQuotes()myquote = PF.Security("YHOO").GetQuote(0) 'Get the first quote in the data filePF.Security("YHOO").UnloadQuotes()

Public ReadOnly Property GetSymbol() As String

Member of: MFLib.Metafile

Summary:Returns the Symbol of the specified security.

Parameters:none.

Page 32: MFLib DLL API Documentation

Return Values:Returns the String value of the specified security.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim mysecSymbol As StringmysecSymbol = PF.Security(1).GetSymbol

Public ReadOnly Property HasDelayed() As Object

Member of: MFLib.Metafile

Summary:Add Here.

Parameters:none.

Return Values:none.

Example:

Public ReadOnly Property IsUpToDate() As Boolean

Member of: MFLib.Metafile

Summary:The IsUpToDate property returns a boolean true if the security has a quote for the last business day. This does not take into account holidays

Parameters:none.

Return Values:Returns a Boolean True if the security has the latest quote.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim mysecUpToDate As BooleanmysecUpToDate = PF.Security("YHOO").IsUpToDate

Public ReadOnly Property LastUpdateQuoteCount() As Long

Member of: MFLib.Metafile

Summary:This property returns the number of quotes received in the last update.

Parameters:none.

Return Values:Returns a long representing the number of quotes received in the last update.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)PF.Security("YHOO").Update(MFLib.DataProviders.Service.YahooEOD, True, True)

Page 33: MFLib DLL API Documentation

PF.Security("YHOO").Save(True)Dim numofquotesreclastupdate As Longnumofquotesreclastupdate = PF.Security("YHOO").LastUpdateQuoteCount

Public ReadOnly Property QuotesAreLoaded() As Boolean

Member of: MFLib.Metafile

Summary:The QuotesAreLoaded property returns a boolean true if the Metafile Object has the quotes loaded into memory.

Parameters:none.

Return Values:Returns a boolean true if the quotes are loaded into memory for the respective security.

Example:Dim PF As New MFLib.Portfolio("C:\MetaStock Data\Index\", True, True)Dim areLoaded As BooleanPF.Security("YHOO").LoadQuotes()areLoaded = PF.Security("YHOO").QuotesAreLoaded 'Will return Boolean TruePF.Security("YHOO").UnloadQuotes()areLoaded = PF.Security("YHOO").QuotesAreLoaded 'Will return Boolean False

Page 34: MFLib DLL API Documentation

Appendix A - MASTERThis Appendix describes the format of the MASTER file.

Each Record in the Master file is 53 bytes in Length. The first 53 bytes in the file contains some information regarding index numbers, and all remaining 53 byte records contain security information. The Master file record can contain no more than 255 security records.

The following shows the Byte Configuration for reading and writing to the MASTER File.

This shows the configuration for the first 53 byte record.

Field Name Format Start(Position Byte#)

Length(# of Bytes) Function

# of Records

UB 1 2 Stores the # of records stored in the MASTER file

Next Record #

UB 3 2 Stores the last # used for a F#.dat file

Blank Space

5 48

The following shows the 53 Byte configuration for the security records which would consist of all remaining 53Byte records found in this file.

Field Name Format Start(Position Byte#)

Length(# of Bytes) Function

Record # UB 1 1 Stores the index # for the F#.dat fileFile Type 2 2 This is always written as 25856(Int). Not

sure what function this provides

Record Length

4 1

Record Count

5 1 # of 4 byte fields in the F#.dat file. Dependant on whether its Intraday, has Open Price, Open Interest and High and low.

Unknown 6 2Issue Name

8 16 Description provide for the security

Unknown 24 1CT_V2_8_FLAG

25 1 If this is 89(Int) then V28 is true, if this is 42(Int) then Autorun is True. (I have no clue what this is used for, but it doesn seem to affect anything)

First Date MBF 26 4 This is the date defined when the security is created. Is used to determine how far back to capture security data.

Last Date MBF 30 4 This is the date of the last quote on

Page 35: MFLib DLL API Documentation

record.Time Frame

A 34 1 This is the timeframe for the security defined when the security is created. 'I' for Intraday, 'D' for Daily, 'W' for Weekly, Etc.

Intraday Timeframe

35 2 This is the Intraday Time base defined when the security is created. 1Min,5min, 10min

Symbol A 37 14 Ascii symbol defined when the security is created.

Unknown 51 1Flag 52 1 Always set to 0.Unknown 53 1

See MasterFileRecord.vb for further details on how each security record is read, and the functions used to convert the bytes to useful data. See Functions.vb for how a MasterByteArray is constructed. The MasterFileRecord.vb class uses the MasterFileDescriptor.vb to provide the byte locations for each record.

Appendix B - EMASTERThis Appendix describes the format of the EMASTER file.

Each Record in the EMaster file is 192 bytes in Length. The first 192 bytes in the file contains some information regarding index numbers, and all remaining 192 byte records contain security information. The EMaster file contains some duplicate data of the the MASTER, and like the Master file contains no more than 255 security records

The following shows the Byte Configuration for reading and writing to the EMASTER File.

This shows the configuration for the first 192 byte record.

Field Name Format Start(Position Byte#)

Length(# of Bytes) Function

# of Records

UB 1 2 Stores the # of records stored in the EMASTER file

Next Record #

UB 3 2 Stores the last # used for a F#.dat file

Blank Space

5 187

The following shows the 192 Byte configuration for the security records which would consist of all remaining 192Byte records found in this file.

Field Name Format Start(Position Byte#)

Length(# of Bytes) Function

ID Code 1 1

Page 36: MFLib DLL API Documentation

Record # 2 1 Stores the index # for the F#.dat fileUnknown 3 2Record Count

5 1 # of 4 byte fields in the F#.dat file. Dependant on whether its Intraday, has Open Price, Open Interest and High and low.

Fields 6 1 Tells which fields are active, MSB- Time,OI,OP,HighorLow,HighorLow,Unknown,Uknown – LSB

Unknown 7 8AutoRun 10 1 Unsure what this is used forUnknown 11 1Symbol Ascii 12 13 Ascii symbol defined when the security

is created.Unknown 26 6Issue Name

Ascii 33 16 Security description defined when the security is created.

Unknown 50 11Time Frame

Ascii 61 1 This is the timeframe for the security defined when the security is created. 'I' for Intraday, 'D' for Daily, 'W' for Weekly, Etc.

Unknown 62 3First Date CVS -

4 byte single precision real

65 4 This is the date defined when the security is created. Is used to determine how far back to capture security data. YYMMDD

Uknown 70 3Last Date CVS - 4

byte single precision real

73 4 The is the date of the Last quote on Record. YYMMDD

Unknown 78 3Start Time CVS - 4

byte single precision real

81 4 Defines the start time for an Intraday Security

End Time CVS - 4 byte single precision real

85 4 Defines the stop time for an Intraday Security.

Page 37: MFLib DLL API Documentation

Unknown 89 38First Date Long

CVL - 4 byte long integer

127 4 This is the date of the Last Quote in Long Format YYYYMMDD

Unknown 131 1Dividend Date

CVL - 4 byte long integer

132 4 Not sure how this is used.

Dividend Date

CVS - 4 byte single precision real

136 4 Not sure how this is used.

Unknown 141 52

See EMasterFileRecord.vb for further details on how each security record is read, and the functions used to convert the bytes to useful data. See Functions.vb for how a EMasterByteArray is constructed. The EMasterFileRecord.vb class uses the EMasterFileDescriptor.vb to provide the byte locations for each record.

Appendix C - XMASTERThis Appendix describes the format of the XMASTER file.

Each Record in the XMaster file is 150 bytes in Length. The first 150 bytes in the file contains some information regarding index numbers, and all remaining 150 byte records contain security information. The XMaster file is used after the MASTER and EMASTER have been populated with 255 security records, the Limit of the MASTER and EMASTER files. The XMaster can house Index Number 256 to 65535, and its respective information.

The following shows the Byte Configuration for reading and writing to the MASTER File.

This shows the configuration for the first 150 byte record.

Field Name Format Start(Position Byte#)

Length(# of Bytes) Function

Unknown 1 1 Always seems to be 0x5DUnknown 2 1 Always seems to be 0xFEUnknown 3 2 Always seems to be Ascii “XM”Unknown 5 6# of Records

11 2 Number of records stored in the XMASTER

Unknown 13 2# of Records

15 2 Number of records stored in the XMASTER(seems to be the same)

Page 38: MFLib DLL API Documentation

Unknown 17 2Next Record #

19 2 Stores the last # used for a F#.dat file

Unknown 21 129

The following shows the 150 Byte configuration for the security records which would consist of all remaining 150Byte records found in this file.

Field Name Format Start(Position Byte#)

Length(# of Bytes) Function

Uknown 1 1Symbol Ascii 2 14 Ascii symbol defined when the security

is created.Issue Name

Ascii 17 23 Security description defined when the security is created.

Unknown 41 1Unknown 42 1 Always seems to be 0xFF. Unsure of

function.Unknown 43 5Unknown 47 1 Always seems to be 0x7F. Unsure of

functionUnknown 48 13Time Frame

Ascii 62 1 This is the timeframe for the security defined when the security is created. 'I' for Intraday, 'D' for Daily, 'W' for Weekly, Etc.

Unknown 63 1Record # 66 2 Stores the index # for the F#.dat fileUnknown 68 2Fields 71 1 Tells which fields are active, MSB-

Time,OI,OP,HighorLow,HighorLow,Unknown,Uknown – LSB

Unknown 72 7Start Date CVL -

4 byte long integer

81 4

Short Start Date

85 3

Unknown 87 16First Date Long

CVL - 4 byte long

105 4 This is the date of the Last Quote in Long Format YYYYMMDD

Page 39: MFLib DLL API Documentation

integerLast Date CVL -

4 byte long integer

109 4 The is the date of the Last quote on Record. Long Format YYYYMMDD

Unknown 113 3Last Date CVL -

4 byte long integer

117 4 The is the date of the Last quote on Record. Long Format YYYYMMDD (seems to repeat)

Unknown 121 29

See XMasterFileRecord.vb for further details on how each security record is read, and the functions used to convert the bytes to useful data. See Functions.vb for how a XMasterByteArray is constructed. The XMasterFileRecord.vb class uses the XMasterFileDescriptor.vb to provide the byte locations for each record.

Appendix D – F*.DAT (or F*.MWD)This Appendix describes the format of the .DAT or .MWD file.

The .dat file contains a Dummy record at the beginning of the file. In the Dummy record the Number of quotes records stored .dat file are recorded/stored at the 3rd and 4th byte of that .dat file.

The byte configuration is a little flexible in that it changes depending on the # of Fields defined by the MASTER/EMASTER or XMASTER files. The “Fields” byte in the EMASTER or XMASTER determine how many 4 byte fields will make up a record.

In the case of Tick data a record could have as few as 4 by 4 byte fields making up a record which would consist of Date, Time, Close and Volume for a total of 16 bytes per record.

In the case of an Intraday Commodity, you could have as many as 8 by 4 byte fields making up a record which would consist of Date, Time, Open, High, Low, Close, Volume, Open Interest for a total of 32 bytes per record.

Each 4 byte record goes in the following sequential order : Date, Time, Open, High, Low, Close, Volume, Open Interest.

If any field is not present it is removed from the order in order to make up that particular record.

See the if statements in the LoadQuotes function in the Metafile.vb for the possible combinations.