chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:02:50 +08:00
commit 0fc60fdcb1
5008 changed files with 910633 additions and 0 deletions
@@ -0,0 +1,45 @@
/*
* 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.Collections.Generic;
using Newtonsoft.Json;
using QuantConnect.Util;
namespace QuantConnect.Securities.FutureOption.Api
{
/// <summary>
/// CME Option Chain Quotes API call root response
/// </summary>
public class CMEOptionChainQuotes
{
/// <summary>
/// The future options contracts with/without settlements
/// </summary>
[JsonProperty("optionContractQuotes")]
public List<CMEOptionChainQuoteEntry> Quotes { get; private set; }
}
/// <summary>
/// Option chain entry quotes, containing strike price
/// </summary>
public class CMEOptionChainQuoteEntry
{
/// <summary>
/// Strike price of the future option quote entry
/// </summary>
[JsonProperty("strikePrice"), JsonConverter(typeof(StringDecimalJsonConverter), true)]
public decimal StrikePrice { get; private set; }
}
}
@@ -0,0 +1,141 @@
/*
* 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 System.Collections.Generic;
using Newtonsoft.Json;
using QuantConnect.Util;
namespace QuantConnect.Securities.FutureOption.Api
{
/// <summary>
/// CME options trades, dates, and expiration list API call root response
/// </summary>
/// <remarks>Returned as a List of this class</remarks>
public class CMEOptionsTradeDatesAndExpiration
{
/// <summary>
/// Describes the type of future option this entry is
/// </summary>
[JsonProperty("label")]
public string Label { get; private set; }
/// <summary>
/// Name of the product
/// </summary>
[JsonProperty("name")]
public string Name { get; private set; }
/// <summary>
/// Option type. "AME" for American, "EUR" for European.
/// Note that there are other types such as weekly, but we
/// only support American options for now.
/// </summary>
[JsonProperty("optionType")]
public string OptionType { get; private set; }
/// <summary>
/// Product ID of the option
/// </summary>
[JsonProperty("productId")]
public int ProductId { get; private set; }
/// <summary>
/// Is Daily option
/// </summary>
[JsonProperty("daily")]
public bool Daily { get; private set; }
/// <summary>
/// ???
/// </summary>
[JsonProperty("sto")]
public bool Sto { get; private set; }
/// <summary>
/// Is weekly option
/// </summary>
[JsonProperty("weekly")]
public bool Weekly { get; private set; }
/// <summary>
/// Expirations of the future option
/// </summary>
[JsonProperty("expirations")]
public List<CMEOptionsExpiration> Expirations { get; private set; }
}
/// <summary>
/// Future options Expiration entries. These are useful because we can derive the
/// future chain from this data, since FOP and FUT share a 1-1 expiry code.
/// </summary>
public class CMEOptionsExpiration
{
/// <summary>
/// Date of expiry
/// </summary>
[JsonProperty("label")]
public string Label { get; private set; }
/// <summary>
/// Product ID of the expiring asset (usually future option)
/// </summary>
[JsonProperty("productId")]
public int ProductId { get; private set; }
/// <summary>
/// Contract ID of the asset
/// </summary>
/// <remarks>Used to search settlements for the option chain</remarks>
[JsonProperty("contractId")]
public string ContractId { get; private set; }
/// <summary>
/// Contract month code formatted as [FUTURE_MONTH_LETTER(1)][YEAR(1)]
/// </summary>
[JsonProperty("expiration")]
public CMEOptionExpirationEntry Expiration { get; private set; }
}
/// <summary>
/// Chicago Mercantile Exchange Option Expiration Entry
/// </summary>
public class CMEOptionExpirationEntry
{
/// <summary>
/// Month of expiry
/// </summary>
[JsonProperty("month")]
public int Month { get; private set; }
/// <summary>
/// Year of expiry
/// </summary>
[JsonProperty("year")]
public int Year { get; private set; }
/// <summary>
/// Expiration code (two letter)
/// </summary>
[JsonProperty("code")]
public string Code { get; private set; }
/// <summary>
/// Expiration code (three letter)
/// </summary>
[JsonProperty("twoDigitsCode")]
public string TwoDigitsCode { get; private set; }
}
}
@@ -0,0 +1,98 @@
/*
* 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.Collections.Generic;
using Newtonsoft.Json;
namespace QuantConnect.Securities.FutureOption.Api
{
/// <summary>
/// Product slate API call root response
/// </summary>
public class CMEProductSlateV2ListResponse
{
/// <summary>
/// Products matching the search criteria
/// </summary>
[JsonProperty("products")]
public List<CMEProductSlateV2ListEntry> Products { get; private set; }
}
/// <summary>
/// Product entry describing the asset matching the search criteria
/// </summary>
public class CMEProductSlateV2ListEntry
{
/// <summary>
/// CME ID for the asset
/// </summary>
[JsonProperty("id")]
public int Id { get; private set; }
/// <summary>
/// Name of the product (e.g. E-mini NASDAQ futures)
/// </summary>
[JsonProperty("name")]
public string Name { get; private set; }
/// <summary>
/// Clearing code
/// </summary>
[JsonProperty("clearing")]
public string Clearing { get; private set; }
/// <summary>
/// GLOBEX ticker
/// </summary>
[JsonProperty("globex")]
public string Globex { get; private set; }
/// <summary>
/// Is traded in the GLOBEX venue
/// </summary>
[JsonProperty("globexTraded")]
public bool GlobexTraded { get; private set; }
/// <summary>
/// Venues this asset trades on
/// </summary>
[JsonProperty("venues")]
public string Venues { get; private set; }
/// <summary>
/// Asset type this product is cleared as (i.e. "Futures", "Options")
/// </summary>
[JsonProperty("cleared")]
public string Cleared { get; private set; }
/// <summary>
/// Exchange the asset trades on (i.e. CME, NYMEX, COMEX, CBOT)
/// </summary>
[JsonProperty("exch")]
public string Exchange { get; private set; }
/// <summary>
/// Asset class group ID - describes group of asset class (e.g. equities, agriculture, etc.)
/// </summary>
[JsonProperty("groupId")]
public int GroupId { get; private set; }
/// <summary>
/// More specific ID describing product
/// </summary>
[JsonProperty("subGroupId")]
public int subGroupId { get; private set; }
}
}
@@ -0,0 +1,46 @@
/*
* 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.Collections.Generic;
namespace QuantConnect.Securities.FutureOption
{
/// <summary>
/// Provides a means to get the scaling factor for CME's quotes API
/// </summary>
public class CMEStrikePriceScalingFactors
{
/// <summary>
/// CME's option chain quotes strike price scaling factor
/// </summary>
private static readonly IReadOnlyDictionary<string, decimal> _scalingFactors = new Dictionary<string, decimal>
{
{ "SI", 0.1m },
{ "NG", 5m }
};
/// <summary>
/// Gets the option chain strike price scaling factor for the quote response from CME
/// </summary>
/// <param name="underlyingFuture">Underlying future Symbol to normalize</param>
/// <returns>Scaling factor for the strike price</returns>
public static decimal GetScaleFactor(Symbol underlyingFuture)
{
return _scalingFactors.ContainsKey(underlyingFuture.ID.Symbol)
? _scalingFactors[underlyingFuture.ID.Symbol]
: 1m;
}
}
}