-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: validation that user can subscribe on real time update * fix: config for Rest Url to run client externally * feat: handle WS's error response * feat: add explicit attribute for test classes * remove: not used configs * feat: ReSubscription process when internet was disconnected * fix:workflow: name of test dll * refactor: OptionChainProvider list refactor: GetOptionContracts in DataDownloader * fix: QuoteBars with Resolution greater then Tick feat: QuoteBar tests revert: data-folder path in config * refactor: name of variable
- Loading branch information
Showing
17 changed files
with
243 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
{ | ||
"data-folder": "../../../../Lean/Data/", | ||
"data-directory": "../../../../Lean/Data/", | ||
|
||
"thetadata-subscription-plan": "Free" | ||
"thetadata-subscription-plan": "Pro" | ||
} |
71 changes: 71 additions & 0 deletions
71
QuantConnect.ThetaData/Converters/ThetaDataQuoteListContractConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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 Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using QuantConnect.Lean.DataSource.ThetaData.Models.Rest; | ||
|
||
namespace QuantConnect.Lean.DataSource.ThetaData.Converters; | ||
|
||
/// <summary> | ||
/// JSON converter to convert ThetaData Quote | ||
/// </summary> | ||
public class ThetaDataQuoteListContractConverter : JsonConverter<QuoteListContract> | ||
{ | ||
/// <summary> | ||
/// Gets a value indicating whether this <see cref="JsonConverter"/> can write JSON. | ||
/// </summary> | ||
/// <value><c>true</c> if this <see cref="JsonConverter"/> can write JSON; otherwise, <c>false</c>.</value> | ||
public override bool CanWrite => false; | ||
|
||
/// <summary> | ||
/// Gets a value indicating whether this <see cref="JsonConverter"/> can read JSON. | ||
/// </summary> | ||
/// <value><c>true</c> if this <see cref="JsonConverter"/> can read JSON; otherwise, <c>false</c>.</value> | ||
public override bool CanRead => true; | ||
|
||
/// <summary> | ||
/// Writes the JSON representation of the object. | ||
/// </summary> | ||
/// <param name="writer">The <see cref="JsonWriter"/> to write to.</param> | ||
/// <param name="value">The value.</param> | ||
/// <param name="serializer">The calling serializer.</param> | ||
public override void WriteJson(JsonWriter writer, QuoteListContract value, JsonSerializer serializer) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
|
||
/// <summary> | ||
/// Reads the JSON representation of the object. | ||
/// </summary> | ||
/// <param name="reader">The <see cref="JsonReader"/> to read from.</param> | ||
/// <param name="objectType">Type of the object.</param> | ||
/// <param name="existingValue">The existing value of object being read.</param> | ||
/// <param name="hasExistingValue">The existing value has a value.</param> | ||
/// <param name="serializer">The calling serializer.</param> | ||
/// <returns>The object value.</returns> | ||
public override QuoteListContract ReadJson(JsonReader reader, Type objectType, QuoteListContract existingValue, bool hasExistingValue, JsonSerializer serializer) | ||
{ | ||
var token = JToken.Load(reader); | ||
if (token.Type != JTokenType.Array || token.Count() != 4) throw new Exception($"{nameof(ThetaDataQuoteConverter)}.{nameof(ReadJson)}: Invalid token type or count. Expected a JSON array with exactly four elements."); | ||
|
||
return new( | ||
token[0]!.Value<string>()!, | ||
token[1]!.Value<string>()!.ConvertFromThetaDataDateFormat(), | ||
token[2]!.Value<decimal>(), | ||
token[3]!.Value<string>()! | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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 Newtonsoft.Json; | ||
using QuantConnect.Lean.DataSource.ThetaData.Converters; | ||
|
||
namespace QuantConnect.Lean.DataSource.ThetaData.Models.Rest; | ||
|
||
[JsonConverter(typeof(ThetaDataQuoteListContractConverter))] | ||
public readonly struct QuoteListContract | ||
{ | ||
public string Ticker { get; } | ||
|
||
public DateTime Expiry { get; } | ||
|
||
public decimal Strike { get; } | ||
|
||
public string Right { get; } | ||
|
||
public QuoteListContract(string ticker, DateTime expiry, decimal strike, string right) | ||
{ | ||
Ticker = ticker; | ||
Expiry = expiry; | ||
Strike = strike; | ||
Right = right; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.