Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for fromTime on Candles #36

Open
voros1 opened this issue Jun 6, 2023 · 2 comments
Open

Support for fromTime on Candles #36

voros1 opened this issue Jun 6, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@voros1
Copy link

voros1 commented Jun 6, 2023

Hello,
The documentation here (which I assume is for the 'legacy' version) says that the 'fromTime' parameter
https://kb.dxfeed.com/en/data-services/aggregated-data-services/how-to-request-candles.html
may be included as so:
IDxSubscription candleSubscription = con.CreateSubscription(fromTime, new CandleListener());
The graal-net-api version doesn't seem to support a fromTime parameter.

On a related note:
While a simple symbol such as
/ESM23:XCME is supported correctly by graal-net-api, the full symbol specifications as in the link above, such as:
/ESM23:XCME{=15m}
don't seem to work via the graal-net-api
This appears to be the symbol that
https://tools.dxfeed.com/webservice/chart-demo.jsp
is using though.

Thank You.

@voros1 voros1 changed the title Support for fromTIme on Candles Support for fromTime on Candles Jun 6, 2023
@stdcion stdcion added the enhancement New feature or request label Jun 7, 2023
@stdcion stdcion self-assigned this Jun 7, 2023
@stdcion
Copy link
Collaborator

stdcion commented Jun 7, 2023

Hi @voros1!

Unfortunately, the TimeSeriesSubscription is not currently supported. But we plan to add it soon, as a workaround you can now use TimeSeriesSubscriptionSymbol.

You can test it using DxFeed.Graal.Net.Tool, for example:
./DxFeed.Graal.Net.Tools connect demo.dxfeed.com:7300 Candle "/ESM23:XCME{=15m}" --from-time 20230607

Output:

I 230607 111401.871 [main] QD - Using QDS-3.316+file-UNKNOWN+mars-UNKNOWN+monitoring-UNKNOWN+tools-UNKNOWN, (C) Devexperts
I 230607 111401.881 [main] QD - Using scheme com.dxfeed.api.impl.DXFeedScheme Ao7i0mLrB7RbnGZ43PGWcWWLGeKJ79lOVlbtAxAaXTI
I 230607 111401.883 [main] QD - ConnectTool with collectors [Ticker, Stream, History]
I 230607 111401.911 [main] ClientSocket-Distributor - Starting ClientSocketConnector to demo.dxfeed.com:7300
I 230607 111401.912 [demo.dxfeed.com:7300-Reader] ClientSocketConnector - Resolving IPs for demo.dxfeed.com
I 230607 111401.915 [demo.dxfeed.com:7300-Reader] ClientSocketConnector - Connecting to 208.93.103.170:7300
I 230607 111402.080 [demo.dxfeed.com:7300-Reader] ClientSocketConnector - Connected to 208.93.103.170:7300
D 230607 111402.247 [demo.dxfeed.com:7300-Reader] QD - Distributor received protocol descriptor multiplexor@CDSti [type=qtp, version=QDS-3.306, opt=hs, mars.root=mdd.demo-amazon.multiplexor-demo1] sending [TICKER, STREAM, HISTORY, DATA] from 208.93.103.170
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x4, time=20230607-104500.000+03:00, sequence=0, count=2544, open=4284.25, high=4284.75, low=4282.25, close=4283.5, volume=3318, vwap=4283.59018987342, bidVolume=1834, askVolume=1484, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-103000.000+03:00, sequence=0, count=3539, open=4284.75, high=4286.5, low=4283, close=4284.5, volume=4654, vwap=4284.73178985819, bidVolume=2397, askVolume=2257, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-101500.000+03:00, sequence=0, count=3439, open=4287.5, high=4288.5, low=4283.75, close=4284.75, volume=4268, vwap=4286.05857544517, bidVolume=2405, askVolume=1863, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-100000.000+03:00, sequence=0, count=4791, open=4289.25, high=4289.75, low=4286, close=4287.25, volume=6376, vwap=4287.76258626098, bidVolume=3477, askVolume=2899, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-094500.000+03:00, sequence=0, count=1591, open=4289.5, high=4289.75, low=4287.75, close=4289.25, volume=2188, vwap=4288.84803473492, bidVolume=1095, askVolume=1093, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-093000.000+03:00, sequence=0, count=1171, open=4291.5, high=4291.5, low=4289.25, close=4289.25, volume=1582, vwap=4290.4190897598, bidVolume=901, askVolume=681, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-091500.000+03:00, sequence=0, count=1054, open=4291.25, high=4291.75, low=4290.25, close=4291.75, volume=1377, vwap=4290.95061728395, bidVolume=710, askVolume=667, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-090000.000+03:00, sequence=0, count=1786, open=4291.75, high=4292.25, low=4290, close=4291, volume=2263, vwap=4290.88820150243, bidVolume=1192, askVolume=1071, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-084500.000+03:00, sequence=0, count=1367, open=4291.5, high=4292, low=4290.75, close=4291.5, volume=1833, vwap=4291.38611565739, bidVolume=980, askVolume=853, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-083000.000+03:00, sequence=0, count=1156, open=4292.25, high=4293.25, low=4291.5, close=4291.75, volume=1532, vwap=4292.43439947781, bidVolume=813, askVolume=719, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-081500.000+03:00, sequence=0, count=765, open=4293.5, high=4293.5, low=4291.5, close=4292, volume=916, vwap=4292.39601528384, bidVolume=533, askVolume=383, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-080000.000+03:00, sequence=0, count=1148, open=4293.25, high=4293.5, low=4291.75, close=4293.5, volume=1423, vwap=4292.76300070274, bidVolume=714, askVolume=709, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-074500.000+03:00, sequence=0, count=2058, open=4293.75, high=4293.75, low=4291.5, close=4293.25, volume=2415, vwap=4292.84523809524, bidVolume=1170, askVolume=1245, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-073000.000+03:00, sequence=0, count=714, open=4293.75, high=4294, low=4292.75, close=4293.5, volume=854, vwap=4293.37177985948, bidVolume=426, askVolume=428, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-071500.000+03:00, sequence=0, count=609, open=4294, high=4294.5, low=4293.75, close=4293.75, volume=730, vwap=4294.25787671233, bidVolume=340, askVolume=390, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-070000.000+03:00, sequence=0, count=665, open=4294, high=4294.5, low=4293.25, close=4294, volume=780, vwap=4293.775, bidVolume=394, askVolume=386, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-064500.000+03:00, sequence=0, count=1302, open=4293.5, high=4294.75, low=4293.25, close=4294, volume=1692, vwap=4294.07358156028, bidVolume=817, askVolume=875, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-063000.000+03:00, sequence=0, count=1276, open=4292.25, high=4293.75, low=4292, close=4293.5, volume=1533, vwap=4292.82697325506, bidVolume=575, askVolume=958, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-061500.000+03:00, sequence=0, count=780, open=4291.5, high=4292.25, low=4291.25, close=4292, volume=888, vwap=4291.84966216216, bidVolume=377, askVolume=511, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-060000.000+03:00, sequence=0, count=715, open=4291.5, high=4291.75, low=4290.5, close=4291.5, volume=859, vwap=4291.23195576251, bidVolume=433, askVolume=426, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-054500.000+03:00, sequence=0, count=621, open=4291.5, high=4291.75, low=4290.75, close=4291.25, volume=719, vwap=4291.2938108484, bidVolume=362, askVolume=357, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-053000.000+03:00, sequence=0, count=859, open=4290.75, high=4291.75, low=4290, close=4291.5, volume=1031, vwap=4290.75533462658, bidVolume=415, askVolume=616, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-051500.000+03:00, sequence=0, count=1015, open=4289.5, high=4291, low=4289, close=4291, volume=1247, vwap=4290.084202085, bidVolume=551, askVolume=696, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-050000.000+03:00, sequence=0, count=1387, open=4290.5, high=4290.5, low=4288.5, close=4289.5, volume=1691, vwap=4289.75162625665, bidVolume=954, askVolume=737, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-044500.000+03:00, sequence=0, count=1156, open=4291.5, high=4291.5, low=4289.75, close=4290.75, volume=1498, vwap=4290.41738985314, bidVolume=775, askVolume=723, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-043000.000+03:00, sequence=0, count=1748, open=4291.5, high=4292, low=4290.25, close=4291.5, volume=2008, vwap=4291.1922310757, bidVolume=1023, askVolume=985, impVolatility=NaN, openInterest=2400967}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-041500.000+03:00, sequence=0, count=2386, open=4291.25, high=4291.75, low=4289.5, close=4291.5, volume=2835, vwap=4290.6753968254, bidVolume=1470, askVolume=1365, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-040000.000+03:00, sequence=0, count=4119, open=4293, high=4293.75, low=4288, close=4291.25, volume=5005, vwap=4290.56223776224, bidVolume=2728, askVolume=2277, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-034500.000+03:00, sequence=0, count=1301, open=4295, high=4295.5, low=4292.75, close=4292.75, volume=1744, vwap=4294.2560206422, bidVolume=980, askVolume=764, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-033000.000+03:00, sequence=0, count=1525, open=4292.75, high=4295.25, low=4292.25, close=4295, volume=2012, vwap=4293.97390656064, bidVolume=882, askVolume=1130, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-031500.000+03:00, sequence=0, count=1334, open=4293.5, high=4294, low=4292.25, close=4292.75, volume=1633, vwap=4293.0176056338, bidVolume=813, askVolume=820, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-030000.000+03:00, sequence=0, count=1573, open=4293.5, high=4294.5, low=4292.75, close=4293.5, volume=1884, vwap=4293.53927813164, bidVolume=868, askVolume=1016, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-024500.000+03:00, sequence=0, count=1177, open=4293, high=4294.25, low=4292, close=4293.5, volume=1406, vwap=4293.17443100996, bidVolume=683, askVolume=723, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-023000.000+03:00, sequence=0, count=1489, open=4292.75, high=4294.25, low=4292.5, close=4293, volume=1928, vwap=4293.39470954357, bidVolume=1058, askVolume=870, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-021500.000+03:00, sequence=0, count=484, open=4292.75, high=4293.25, low=4292, close=4293, volume=576, vwap=4292.62847222222, bidVolume=270, askVolume=306, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-020000.000+03:00, sequence=0, count=1114, open=4289.75, high=4293.25, low=4289.5, close=4292.75, volume=1431, vwap=4291.76327742837, bidVolume=574, askVolume=857, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-014500.000+03:00, sequence=0, count=476, open=4290.5, high=4290.75, low=4289.5, close=4289.75, volume=570, vwap=4290.05, bidVolume=257, askVolume=313, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-013000.000+03:00, sequence=0, count=925, open=4288.5, high=4291.25, low=4288.5, close=4290.25, volume=1166, vwap=4289.56367924528, bidVolume=512, askVolume=654, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-011500.000+03:00, sequence=0, count=943, open=4291, high=4291.25, low=4288.25, close=4288.5, volume=1287, vwap=4289.97416472416, bidVolume=795, askVolume=492, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-010000.000+03:00, sequence=0, count=761, open=4292.25, high=4292.25, low=4290.75, close=4291, volume=1042, vwap=4291.42058541267, bidVolume=526, askVolume=444, impVolatility=NaN, openInterest=2412137}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0xa, time=20230607-000000.000+03:00, sequence=0, count=0, open=NaN, high=NaN, low=NaN, close=NaN, volume=NaN, vwap=NaN, bidVolume=NaN, askVolume=NaN, impVolatility=NaN, openInterest=NaN}
Candle{/ESM23:XCME{=15m}, eventTime=0, eventFlags=0x0, time=20230607-104500.000+03:00, sequence=0, count=2545, open=4284.25, high=4284.75, low=4282.25, close=4283.5, volume=3319, vwap=4283.59016269961, bidVolume=1834, askVolume=1485, impVolatility=NaN, openInterest=2400967}

Here's a complete example:

using System;
using System.Threading;
using System.Threading.Tasks;
using DxFeed.Graal.Net.Api;
using DxFeed.Graal.Net.Api.Osub;
using DxFeed.Graal.Net.Events.Candles;

namespace Sample;

internal abstract class Program
{
    public static async Task Main(string[] args)
    {
        var endpoint = DXEndpoint.Create().Connect("demo.dxfeed.com:7300");
        var sub = endpoint.GetFeed().CreateSubscription(typeof(Candle));

        sub.AddEventListener(events =>
        {
            foreach (var candle in events)
            {
                Console.WriteLine(candle);
            }
        });

        sub.AddSymbols(new TimeSeriesSubscriptionSymbol("/ESM23:XCME{=15m}", 0));

        await Task.Delay(Timeout.Infinite);
    }
}

@stdcion
Copy link
Collaborator

stdcion commented Jun 8, 2023

@voros1

I also added a new “CandleSample" (as in our old .NET API), which shows how to use CandleSymbol.

Best regards,
dxFeed APIs Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants