Login Page - Create Account

Market Depth Data File Structures Used

The market depth data file header file is as follows. The size of this data structure is 64 bytes. This header is at the beginning of a market depth data file.

struct s_MarketDepthFileHeader
{
    //--- Static Members ---------------------------------------------

    // This is the minimum number of bytes that must be read in order
    // to verify the file as a depth file and read in the rest of the
    // header.
    static const int MINIMAL_HEADER_SIZE = 16;

    static const uint32_t UNIQUE_HEADER_ID = 0x44444353;  // "SCDD"

    //--- Members ----------------------------------------------------

    uint32_t FileTypeUniqueHeaderID;  // "SCDD"
    uint32_t HeaderSize;
    uint32_t RecordSize;
    uint32_t Version;

    char Reserve[48];

    //--- Methods ----------------------------------------------------

    s_Header()
    : FileTypeUniqueHeaderID(UNIQUE_HEADER_ID)
    , HeaderSize(sizeof(s_Header))
    , RecordSize(sizeof(s_Record))
    , Version(1)
    {
        memset(Reserve, 0, sizeof(Reserve));
    }

};
    

The market depth data file record structure is as follows. The size of this data structure is 24 bytes.

A market depth data file consists of a single header at the beginning of the file followed by records of the s_MarketDepthFileRecord structure type.

struct s_MarketDepthFileRecord
{

    //--- Types ------------------------------------------------------

    enum CommandEnum : t_Byte
    { NO_COMMAND = 0
    , COMMAND_CLEAR_BOOK = 1
    , COMMAND_ADD_BID_LEVEL = 2
    , COMMAND_ADD_ASK_LEVEL = 3
    , COMMAND_MODIFY_BID_LEVEL = 4
    , COMMAND_MODIFY_ASK_LEVEL = 5
    , COMMAND_DELETE_BID_LEVEL = 6
    , COMMAND_DELETE_ASK_LEVEL = 7
    };
    
    //This flag indicates the end of a batch of market depth updates. 
    static const uint8_t FLAG_END_OF_BATCH = 0x01;

    //--- Members ----------------------------------------------------

    SCDateTimeMS DateTime;

    CommandEnum Command = NO_COMMAND;
    uint8_t Flags = 0;
    uint16_t NumOrders = 0;

    float Price = 0.0f;
    uint32_t Quantity = 0;
    uint32_t Reserved = 0;  // Not used, but exists due to byte padding.

    //--- Methods ----------------------------------------------------

    s_Record()
    {

    }

};
    

s_MarketDepthFileRecord Structure Member Descriptions

DateTime

The DateTime member variable is a SCDateTimeMS variable. It represents the timestamp of the market depth data record command.

This is a 64-bit integer. It represents the number of microseconds since the SCDateTime epoch of December 30, 1899.

Versions prior to 2151, use a double precision floating point type variable to represent Date-Time values. For a complete explanation of the Date component of this value, refer toDate Value. The date value is the integer portion of the double. The fractional portion is the Time value which is represented as a fraction of one day where 1/86400000 is 1 ms. 86400000 is the number of milliseconds in a day.

This Date and Time value must be in the UTC time zone.

Sierra Chart provides the /ACS_Source/SCDateTime.h file with various functions for working with these Date-Time values.


*Last modified Wednesday, 29th September, 2021.