Closed EcBen closed 5 months ago
Hi @EcBen!
Yes, you can specify the required symbols in the HTTP request. Detailed information on all available parameters can be found here https://tools.dxfeed.com/ipf?help.
Also, if you're using Schedule
, you can trigger auto update of schedule.properties
(this file contains the schedule) from our site by using SystemProperty
com.dxfeed.schedule.download=auto
. File will be reupdated once a day, or you can control it using the form: com.dxfeed.schedule.download=auto,4h
(this will cause updates to be once each 4 hours). By default it will update once a day, this is usually enough, we don't update this file that often.
Here's an example:
SystemProperty.SetProperty("com.dxfeed.schedule.download", "auto");
var symbol = "SPY";
var reader = new InstrumentProfileReader();
var profiles = reader.ReadFromFile($"https://user:password@tools.dxfeed.com/ipf?SYMBOL={symbol}");
foreach (var profile in profiles)
{
if (profile.Symbol.Equals(symbol, StringComparison.Ordinal))
{
var time = DateTimeOffset.Now.ToUnixTimeMilliseconds();
var schedule = Schedule.GetInstance(profile);
schedule.TryGetNearestSessionByTime(time, SessionFilter.REGULAR, out var session);
var day = schedule.GetDayByTime(time);
var sessions = day.GetSessions();
var nextDay = day.GetNextDay(DayFilter.TRADING);
}
}
await Task.Delay(Timeout.Infinite);
Also, if you are using InstrumentProfileCollector
, you should add a listener (AddUpdateListener
) because receiving IPF by the collector is asynchronous. If you just try to call col.View
, you may not see the changes immediately.
If you want a blocking call, it's easier to use InstrumentProfileReader
and `ReadFromFile method.
Best regards, dxFeed APIs Team
Thanks for the quick response! I'll give that a try. Today, we found that DxFeed's REST API for sessions is incorrect, but the Schedule
for this library is correct, so we want to switch to it:
{
"date": "20240703",
"isTrading": "true",
"startTime": "2024-07-03 08:30:00-0500",
"endTime": "2024-07-03 15:00:00-0500",
"type": "REGULAR"
},
The equity REGULAR session ended today at 12:00 noon Central Daylight Time, not 15:00.
It was also wrong on the Good Friday holiday.
This is unexpected behavior. Can I ask you to create a ticket on our customer portal? It is actually more efficient for us to handle requests using this portal as it is a single point of entry for customers, ensuring that your issue is tracked and resolved promptly.
Yes, just added it to the customer portal.
Trying to use the new
Schedule
class to get an instruments trading sessions requires passing anInstrumentProfile
. I can get anInstrumentProfile
from the IPF URL:However, this data can be HUGE. For one account, it's only 4.6MB. For another, it's 300.9MB. I only need one or two
InstrumentProfile
s from this data. Using this library, is there another way to get a singleInstrumentProfile
than loading the full list? I already have aDXEndpoint
created and connected to adxlink
URL.