Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions Demonstration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using QuantConnect.Securities.Future;
using QuantConnect.Util;
using System;
using System.Linq;

namespace QuantConnect.Algorithm.CSharp
{
Expand All @@ -39,7 +40,19 @@ public override void Initialize()

var exp = new DateTime(2025, 12, 19);
var symbol = QuantConnect.Symbol.CreateFuture("ES", Market.CME, exp);
//_es = AddFutureContract(symbol, Resolution.Tick, true, 1, true);
_es = AddFutureContract(symbol, Resolution.Second, true, 1, true);
Log($"_es: {_es}");

var history = History<TradeBar>(_es.Symbol, 10, Resolution.Minute).ToList();

Log($"History returned {history.Count} bars");

foreach (var bar in history)
{
Log($"History Bar: {bar.Time} - O:{bar.Open} H:{bar.High} L:{bar.Low} C:{bar.Close} V:{bar.Volume}");
}

}

public override void OnData(Slice slice)
Expand All @@ -51,13 +64,13 @@ public override void OnData(Slice slice)
}

Log($"OnData: Slice has {slice.Count} data points");

// For Tick resolution, check Ticks collection
if (slice.Ticks.ContainsKey(_es.Symbol))
{
var ticks = slice.Ticks[_es.Symbol];
Log($"Received {ticks.Count} ticks for {_es.Symbol}");

foreach (var tick in ticks)
{
if (tick.TickType == TickType.Trade)
Expand All @@ -70,12 +83,11 @@ public override void OnData(Slice slice)
}
}
}
// These won't have data for Tick resolution
if (slice.Bars.ContainsKey(_es.Symbol))

// Access OHLCV bars
foreach (var bar in slice.Bars.Values)
{
var bar = slice.Bars[_es.Symbol];
Log($"Bar - O:{bar.Open} H:{bar.High} L:{bar.Low} C:{bar.Close} V:{bar.Volume}");
Log($"OHLCV BAR: {bar.Symbol.Value} - O: {bar.Open}, H: {bar.High}, L: {bar.Low}, C: {bar.Close}, V: {bar.Volume}");
}
}
}
Expand Down
28 changes: 0 additions & 28 deletions DemonstrationUniverse.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Demonstration.cs" Link="Demonstration.cs" />
<Compile Include="..\DemonstrationUniverse.cs" Link="DemonstrationUniverse.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="protobuf-net" Version="3.1.33" />
Expand Down
12 changes: 4 additions & 8 deletions QuantConnect.DataBento/DataBentoDataDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@
namespace QuantConnect.Lean.DataSource.DataBento
{
/// <summary>
/// Data downloader class for pulling data from Data Provider
/// Data downloader for historical data from DataBento's Raw HTTP API
/// Converts DataBento data to Lean data types
/// </summary>
public class DataBentoDataDownloader : IDataDownloader, IDisposable
{
/// <inheritdoc cref="HttpClient"/>
private readonly HttpClient _httpClient;

private readonly string _apiKey;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove.
This field is used only in .ctor.


private const decimal PriceScaleFactor = 1e-9m;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an xml description of the const, such as a link to the documentation.


/// <summary>
Expand Down Expand Up @@ -72,8 +70,6 @@ public IEnumerable<BaseData> Get(DataDownloaderGetParameters parameters)
{
var symbol = parameters.Symbol;
var resolution = parameters.Resolution;
var startUtc = parameters.StartUtc;
var endUtc = parameters.EndUtc;
var tickType = parameters.TickType;

var dataset = "GLBX.MDP3"; // hard coded for now. Later on can add equities and options with different mapping
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this like const:

  • with XML description;
  • docs link where we can find other possible variants of the dataset.

Expand All @@ -85,8 +81,8 @@ public IEnumerable<BaseData> Get(DataDownloaderGetParameters parameters)
body.Append($"dataset={dataset}");
body.Append($"&symbols={dbSymbol}");
body.Append($"&schema={schema}");
body.Append($"&start={startUtc:yyyy-MM-ddTHH:mm}");
body.Append($"&end={endUtc:yyyy-MM-ddTHH:mm}");
body.Append($"&start={parameters.StartUtc:yyyy-MM-ddTHH:mm}");
body.Append($"&end={parameters.EndUtc:yyyy-MM-ddTHH:mm}");
body.Append("&stype_in=parent");
body.Append("&encoding=csv");

Expand Down
Loading
Loading