9cdb4a91c5
* Live Coarse universe refactor
- Live trading will source Coarse and Fine fundamental data directly
from disk. Updating unit tests.
* Adds ILiveDataProvider interface
* Adds wrapper for IDataQueueHandler implementations
* Replaces IDataQueueHandler with ILiveDataProvider in
LiveTradingDataFeed
* Edits IDataQueueHandler documentation
* Maintains aggregation for current IDQH impls and skips for ILDF impls
* Note: No unit test was created for this method, go back and TODO
* Protobuf Market data
- Adding protobuf support for Ticks, TradeBars and QuoteBars. Adding
unit tests.
* Adds unit tests for LiveDataAggregator changes
* Fixes bug where custom data was not handled as it was before
* Fixes race condition bug because of variable reuse in class
* Add protobuf extension serialization
* Fixes for protobuf serialization
* Refactor
* Fix OptionChainUniverse
* replace BaseDataExchange pumping ticks with consolidators
* AlpacaBrokerage
* BitfinexBrokerage
* GDAXBrokerage
* OandaBrokerage
* InteractiveBrokers
* TradierBrokerage
* FxcmBrokerage
* PaperBrokerage
* etc
* WIP fixes for existing LTDF unit tests
* Fixes more LTDF unit tests
* make IDataAggregator.Update recieving Generic BaseData rather than Tick
* Change IDataQueueHandler.Subscribe method
* Some fixes after adding new commits
* Adds protobuf (de)serialization support for Dividend and Split
* Serialize protobuf with length prefix
* Fix missing LTDF unit tests
* Adds TiingoNews protobuf definitions
* fix comments
* more fixes on IQFeedDataQueueHandler
* disallow putting ticks into enumerator directly
* ScannableEnumerator tests
* fix OandaBrokerage
* AggregationManager unit tests
* fix AlpacaBrokerage tests
* fix InteractiveBrokers
* fix FxcmBrokerage tests
* call AggregationManager.Remove method on unsubscribe
* fix GDAX existing tests
* Fixes, refactor adding more tests for AggregatorManager
* Adds BenzingaNews protobuf definitions and round trip unit test
* Adds missing TiingoNews unit test to Protobuf round trip tests
* Improve sleep sequence of LiveSynchronizer
* need start aggregating first, and then can subscribe
* More test fixes and refactor
- Refactoring AggregationManager and ScannableEnumerator so the last is
the one that owns the consolidator
- Adding pulse on the main LiveSynchronizer
* Improve performance of LEquityDataSynchronizingEnu
* Add missing Set job packet method
* Minor performance improvements
* Improvements add test timeout
- Improvements adding test timeout to find blocking test in travis
* Improve aggregationManager performance
* Testing improvements for travis
* Remove test timeouts
* More test fixes
- Adding more missing dispose calls and improving determinism
* fix IEXDataQueueHandler and tests
* Final tweaks to LTDF tests
* more AggregationManager tests
* consume and log ticks
* fix test: couldn't subscribe to Forex tickers
* change Resolution for all bar configs
* Improve RealTimeScheduleEventServiceAccuracy
* refactoring: move common code to base class
* fixed bug; unsubscribe SubscriptionDataConfig
* Small performance improvement
* Minor fixes
* Avoid Symbol serialization
* Fixes coarse selection in live mode
* Fix for live coarse
* Adds protobuf (de)serialization support for Robintrack
* Adds round-trip unit test
* Minor performance improvements
* More minor performance improvements
* pass LiveNodePacket through to OandaBrokerage
* Fixes empty list becoming null value when deserializing with protobuf
* Reverts BZ live trading exception removal and fixes tests
* Refactor WorkQueue making it abstract
* Add try catch for composer
* Adds optional data batching period to LiveFillForwardEnumerator
* Override data-queue-handler with config
* Improve PeriodCountConsolidator.Scan performance
* Move batching delay to main Synchornizer thread
* Reverts addition of Robintrack protobuf definitions
* Give priority to config history provider if set
* Add Estimize protobuffing
- Add Estimize protobuffing support. Adding unit tests
* Always dispose of data queue handler
Co-authored-by: Gerardo Salazar <gsalaz9800@gmail.com>
Co-authored-by: Adalyat Nazirov <aenazirov@gmail.com>
139 lines
5.2 KiB
C#
139 lines
5.2 KiB
C#
/*
|
|
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
|
|
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
*/
|
|
|
|
using System;
|
|
using Newtonsoft.Json;
|
|
using ProtoBuf;
|
|
using static QuantConnect.StringExtensions;
|
|
|
|
namespace QuantConnect.Data.Market
|
|
{
|
|
/// <summary>
|
|
/// Split event from a security
|
|
/// </summary>
|
|
[ProtoContract(SkipConstructor = true)]
|
|
public class Split : BaseData
|
|
{
|
|
/// <summary>
|
|
///Gets the type of split event, warning or split.
|
|
/// </summary>
|
|
[JsonProperty]
|
|
[ProtoMember(10)]
|
|
public SplitType Type
|
|
{
|
|
get; private set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the split factor
|
|
/// </summary>
|
|
[JsonProperty]
|
|
[ProtoMember(11)]
|
|
public decimal SplitFactor
|
|
{
|
|
get; private set;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the price at which the split occurred
|
|
/// This is typically the previous day's closing price
|
|
/// </summary>
|
|
[ProtoMember(12)]
|
|
public decimal ReferencePrice
|
|
{
|
|
get { return Value; }
|
|
set { Value = value; }
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the Split class
|
|
/// </summary>
|
|
public Split()
|
|
{
|
|
Type = SplitType.SplitOccurred;
|
|
DataType = MarketDataType.Auxiliary;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the Split class
|
|
/// </summary>
|
|
/// <param name="symbol">The symbol</param>
|
|
/// <param name="date">The date</param>
|
|
/// <param name="price">The price at the time of the split</param>
|
|
/// <param name="splitFactor">The split factor to be applied to current holdings</param>
|
|
/// <param name="type">The type of split event, warning or split occurred</param>
|
|
public Split(Symbol symbol, DateTime date, decimal price, decimal splitFactor, SplitType type)
|
|
: this()
|
|
{
|
|
Type = type;
|
|
Time = date;
|
|
Symbol = symbol;
|
|
ReferencePrice = price;
|
|
SplitFactor = splitFactor;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Reader converts each line of the data source into BaseData objects. Each data type creates its own factory method, and returns a new instance of the object
|
|
/// each time it is called.
|
|
/// </summary>
|
|
/// <param name="config">Subscription data config setup object</param>
|
|
/// <param name="line">Line of the source document</param>
|
|
/// <param name="date">Date of the requested data</param>
|
|
/// <param name="isLiveMode">true if we're in live mode, false for backtesting mode</param>
|
|
/// <returns>Instance of the T:BaseData object generated by this line of the CSV</returns>
|
|
public override BaseData Reader(SubscriptionDataConfig config, string line, DateTime date, bool isLiveMode)
|
|
{
|
|
// this is implemented in the SubscriptionDataReader.CheckForSplit
|
|
throw new NotImplementedException("This method is not supposed to be called on the Split type.");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return the URL string source of the file. This will be converted to a stream
|
|
/// </summary>
|
|
/// <param name="config">Configuration object</param>
|
|
/// <param name="date">Date of this source file</param>
|
|
/// <param name="isLiveMode">true if we're in live mode, false for backtesting mode</param>
|
|
/// <returns>String URL of source file.</returns>
|
|
public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
|
|
{
|
|
// this data is derived from map files and factor files in backtesting
|
|
throw new NotImplementedException("This method is not supposed to be called on the Split type.");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Formats a string with the symbol and value.
|
|
/// </summary>
|
|
/// <returns>string - a string formatted as SPY: 167.753</returns>
|
|
public override string ToString()
|
|
{
|
|
var type = Type == SplitType.Warning ? "Split Warning" : "Split";
|
|
return Invariant($"{type}: {Symbol}: {SplitFactor} | {ReferencePrice}");
|
|
}
|
|
|
|
/// <summary>
|
|
/// Return a new instance clone of this object, used in fill forward
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// This base implementation uses reflection to copy all public fields and properties
|
|
/// </remarks>
|
|
/// <returns>A clone of the current object</returns>
|
|
public override BaseData Clone()
|
|
{
|
|
return new Split(Symbol, Time, Price, SplitFactor, Type);
|
|
}
|
|
}
|
|
}
|