public SnapshotCollection(NativeConnection connection, IDxSnapshotListener listener, SnapshotCase[] snapshotCases) { this.snapshotCases = snapshotCases; foreach (SnapshotCase snapshot in this.snapshotCases) snapshot.Initialize(connection, listener); }
/// <summary> /// Creates a snapshot subscription /// </summary> /// <remarks> /// Don't call this method inside any listeners and callbacks of NativeSubscription, NativeConnection, /// NativeRegionalBook, NativeSnapshotSubscription classes /// </remarks> /// <param name="time">Time in the past - number of milliseconds from 1.1.1970 (unix time)</param> /// <param name="listener">snapshot listener callback</param> /// <returns>subscription object</returns> /// <exception cref="DxException"></exception> public IDxSubscription CreateSnapshotSubscription(long time, IDxSnapshotListener listener) { if (handle == IntPtr.Zero) { throw new NativeDxException("not connected"); } IDxSubscription result = new NativeSnapshotSubscription(this, time, listener); subscriptions.Add(result); return(result); }
/// <summary> /// Creates the new native order subscription on snapshot with incremental updates. /// </summary> /// <remarks> /// Don't call this constructor inside any listeners and callbacks of NativeSubscription, NativeConnection, /// NativeRegionalBook, NativeSnapshotSubscription classes /// </remarks> /// <param name="connection">Native connection pointer.</param> /// <param name="listener">Snapshot or update events listener.</param> /// <exception cref="ArgumentNullException">Listener is invalid.</exception> public NativeSnapshotSubscription(NativeConnection connection, IDxIncOrderSnapshotListener listener) { if (listener == null) { throw new ArgumentNullException(nameof(listener)); } connectionPtr = connection.Handle; this.listener = listener; this.time = 0; this.connection = connection; }
/// <summary> /// Creates new native order or candle subscription on snapshot. /// </summary> /// <param name="connection">Native connection pointer.</param> /// <param name="time">Milliseconds time in the past.</param> /// <param name="listener">Snapshot events listener.</param> /// <exception cref="ArgumentNullException">Listener is invalid.</exception> public NativeSnapshotSubscription(NativeConnection connection, long time, IDxSnapshotListener listener) { if (listener == null) { throw new ArgumentNullException("listener"); } connectionPtr = connection.Handler; this.listener = listener; this.time = time; this.connection = connection; }
/// <summary> /// Creates a snapshot subscription /// </summary> /// <remarks> /// Don't call this method inside any listeners and callbacks of NativeSubscription, NativeConnection, /// NativeRegionalBook, NativeSnapshotSubscription classes /// </remarks> /// <param name="time">Date time in the past</param> /// <param name="listener">snapshot listener callback</param> /// <returns>subscription object</returns> /// <exception cref="DxException"></exception> public IDxSubscription CreateSnapshotSubscription(DateTime?time, IDxSnapshotListener listener) { if (handle == IntPtr.Zero) { throw new NativeDxException("not connected"); } var unixTime = time == null ? 0 : Tools.DateToUnixTime((DateTime)time); IDxSubscription result = new NativeSnapshotSubscription(this, unixTime, listener); subscriptions.Add(result); return(result); }
public void Initialize(NativeConnection connection, IDxSnapshotListener listener) { snapshotSubscription = connection.CreateSnapshotSubscription(time, listener); if (candleSymbol != null) { snapshotSubscription.AddSymbol(candleSymbol); } else { snapshotSubscription.AddSource(source); snapshotSubscription.AddSymbol(symbol); } }
/// <summary> /// Creates new native snapshot subscription with specified event type. /// </summary> /// <param name="connection">Native connection pointer.</param> /// <param name="eventType">Single event type.</param> /// <param name="time">Milliseconds time in the past.</param> /// <param name="listener">Snapshot events listener.</param> /// <exception cref="ArgumentNullException">Listener is invalid.</exception> public NativeSnapshotSubscription(NativeConnection connection, EventType eventType, long time, IDxSnapshotListener listener) { if (listener == null) { throw new ArgumentNullException("listener"); } if ((eventType & (eventType - 1)) > 0) { throw new ArgumentException("Only one event type is allowed for snapshot."); } connectionPtr = connection.Handler; this.eventType = eventType; this.listener = listener; this.time = time; }