Support Board
Date/Time: Thu, 02 May 2024 19:09:00 +0000
[Programming Help] - getting historical depth via ACSIL
View Count: 905
[2020-02-04 18:37:49] |
Chad - Posts: 231 |
Hi all, looking for tips on how to complete this script draft for extracting historical market depth, stored in .depth files on my local PC, via ACSIL. I plan to then access that data via Python, perhaps using Google Protocol Buffers for later expansion into some DTC operations. Here's what I've got so far: // This line is required. Change the text within the quote
// marks to what you want to name your group of custom studies. SCDLLName("DepthBarsToGPB") //This is the basic framework of a study function. Change the name 'TemplateFunction' to what you require. SCSFExport scsf_DepthBarsToGPB(SCStudyInterfaceRef sc) { int& isRunOnce = sc.GetPersistentInt(1); // Section 1 - Set the configuration variables and defaults if (sc.SetDefaults) { sc.GraphName = "Depth Bars To GPB Convertor"; sc.AutoLoop = 0; //Automatic looping is disabled. //sc.Subgraph[0].Name = ""; //sc.Subgraph[0].DrawStyle = DRAWSTYLE_LINE; //sc.Subgraph[0].PrimaryColor = RGB (0, 255, 0); sc.Input[0].Name = "Float Input"; sc.Input[0].SetFloat(0.0f); sc.MaintainHistoricalMarketDepthData = TRUE; isRunOnce = -1; return; } SCString DebugMessage; if (isRunOnce > 0) return; isRunOnce = 1; // Get access to the market depth bars in the chart the study instance is applied to. c_ACSILDepthBars* p_DepthBars = sc.GetMarketDepthBars(); if (p_DepthBars != NULL) { // DebugMessage.Format("We Get Market Depth Bars"); // sc.AddMessageToLog(DebugMessage, 1); return; } if (p_DepthBars == NULL) { return; } if (p_DepthBars->DepthDataExistsAt(sc.Index)) { DebugMessage.Format("We Have Depth Data"); sc.AddMessageToLog(DebugMessage, 1); } for (int i = 0; i < sc.ArraySize; i++) // Iterating through all present bars { if (p_DepthBars->DepthDataExistsAt(i)) { DebugMessage.Format("We Have Depth Data Exists At: %d", i); sc.AddMessageToLog(DebugMessage, 1); } // Do nothing if the bar at the current index has no data. if (!p_DepthBars->DepthDataExistsAt(i)) { /*DebugMessage.Format("No Depth Data Exists At: %d", i); sc.AddMessageToLog(DebugMessage, 1);*/ continue; } // Iterate through each price index for the bar at the current index. int PriceTickIndex = p_DepthBars->GetBarLowestPriceTickIndex(i); do { // Use PriceTickIndex to get the desired depth data at the current // price level. For example: const int MaxBidQuantityAtPriceTick = p_DepthBars->GetMaxBidQuantity(sc.Index, PriceTickIndex); } while (p_DepthBars->GetNextHigherPriceTickIndex(i, PriceTickIndex)); } } |
[2020-12-25 03:39:11] |
RoadKill - Posts: 38 |
Any success on doing this? How about using Python? probably much easier for unpacking the packing depth data. Here is the structure: Market Depth Data File Format Date Time Of Last Edit: 2020-12-25 03:42:08
|
To post a message in this thread, you need to log in with your Sierra Chart account: