Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Common/Market.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public static class Market
Tuple.Create(InteractiveBrokers, 39),
Tuple.Create(EUREX, 40),
Tuple.Create(OSE, 41),
Tuple.Create(DYDX, 42)
Tuple.Create(DYDX, 42),
Tuple.Create(KRX, 43)
};

static Market()
Expand Down Expand Up @@ -267,6 +268,11 @@ static Market()
/// </summary>
public const string DYDX = "dydx";

/// <summary>
/// Korea Exchange
/// </summary>
public const string KRX = "krx";

/// <summary>
/// Adds the specified market to the map of available markets with the specified identifier.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions Common/Securities/Future/Futures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1555,6 +1555,12 @@ public static class Indices
/// <returns>The symbol</returns>
public const string HangSeng = "HSI";

/// <summary>
/// KOSPI 200 Index Futures
/// </summary>
/// <returns>The symbol</returns>
public const string Kospi200 = "KM";

/// <summary>
/// Micro E-mini S&amp;P 500 Index Futures
/// </summary>
Expand Down
19 changes: 19 additions & 0 deletions Common/Securities/Future/FuturesExpiryFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,25 @@ public static Func<DateTime, DateTime> FuturesExpiryFunction(Symbol symbol)
})
},

// KOSPI 200 Index Futures (KM): http://global.krx.co.kr/contents/GLB/05/0503/0503010102/GLB0503010102.jsp
{Symbol.Create(Futures.Indices.Kospi200, SecurityType.Future, Market.KRX), (time =>
{
// Contract months: the four nearest months of the quarterly cycle (March, June, September, December)
// Last trading day: the second Thursday of the contract month. Trading terminates at 15:20 KST on that day.
// If the second Thursday is a holiday, the last trading day is the preceding business day.
var market = Market.KRX;
var symbol = Futures.Indices.Kospi200;
var holidays = FuturesExpiryUtilityFunctions.GetExpirationHolidays(market, symbol);

var lastTradingDay = FuturesExpiryUtilityFunctions.NthWeekday(time, 2, DayOfWeek.Thursday);
while (holidays.Contains(lastTradingDay) || !lastTradingDay.IsCommonBusinessDay())
{
lastTradingDay = lastTradingDay.AddDays(-1);
}
return lastTradingDay.Add(new TimeSpan(15, 20, 0));
})
},

// MSCI Europe Net Total Return (USD) Futures: https://www.theice.com/products/71512951/MSCI-Europe-NTR-Index-Future-USD & https://www.theice.com/publicdocs/futures_us/exchange_notices/ICE_Futures_US_2022_TRADING_HOLIDAY_CALENDAR_20211118.pdf
{Symbol.Create(Futures.Indices.MSCIEuropeNTR, SecurityType.Future, Market.NYSELIFFE), (time =>
{
Expand Down
3 changes: 3 additions & 0 deletions Data/future/krx/margins/KM.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# we don't have historical information for this symbol
date,initial,maintenance
19900101,7087500,4725000
138 changes: 138 additions & 0 deletions Data/market-hours/market-hours-database.json
Original file line number Diff line number Diff line change
Expand Up @@ -123301,6 +123301,144 @@
"earlyCloses": {},
"lateOpens": {}
},
"Future-krx-[*]": {
"dataTimeZone": "Asia/Seoul",
"exchangeTimeZone": "Asia/Seoul",
"sunday": [],
"monday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"tuesday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"wednesday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"thursday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"friday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"saturday": [],
"holidays": [],
"earlyCloses": {},
"lateOpens": {}
},
"Future-krx-KM": {
"dataTimeZone": "Asia/Seoul",
"exchangeTimeZone": "Asia/Seoul",
"sunday": [],
"monday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"tuesday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"wednesday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"thursday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"friday": [
{
"start": "08:00:00",
"end": "09:00:00",
"state": "premarket"
},
{
"start": "09:00:00",
"end": "15:45:00",
"state": "market"
}
],
"saturday": [],
"holidays": [],
"earlyCloses": {},
"lateOpens": {}
},
"Index-ose-[*]": {
"dataTimeZone": "Asia/Tokyo",
"exchangeTimeZone": "Asia/Tokyo",
Expand Down
3 changes: 3 additions & 0 deletions Data/symbol-properties/symbol-properties-database.csv
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ hkfe,[*],index,,HKD,1,0.01,1

ose,[*],index,,JPY,1,0.01,1

krx,KM,future,KOSPI 200 Index Futures,KRW,250000,0.05,1.0
krx,[*],index,,KRW,1,0.01,1

# Futures options -- will default to Futures contract specs in case no entry exists
cbot,OZB,futureoption,U.S. Treasury Bond American Futures Options,USD,1000.0,0.015625,1.0
cbot,OZC,futureoption,Corn American Futures Options,USD,5000.0,0.00125,1.0,,,100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class FuturesExpiryFunctionsTests
private const string OneFortyFivePM = "13:45:00";
private const string ThreeThirtyPM = "15:30:00";
private const string FourFifteenPM = "16:15:00";
private const string ThreeTwentyPMKoreaTime = "15:20:00";
private readonly SymbolPropertiesDatabase _symbolPropertiesDatabase = SymbolPropertiesDatabase.FromDataFolder();

[OneTimeSetUp]
Expand Down Expand Up @@ -396,6 +397,7 @@ public void FinancialsExpiryDateFunction_WithDifferentDates_ShouldFollowContract
[TestCase(QuantConnect.Securities.Futures.Indices.VIX, EightOClockChicagoTime)]
[TestCase(QuantConnect.Securities.Futures.Indices.VIXMini, EightOClockChicagoTime)]
[TestCase(QuantConnect.Securities.Futures.Indices.Nikkei225Yen, TwoThirtyPM)]
[TestCase(QuantConnect.Securities.Futures.Indices.Kospi200, ThreeTwentyPMKoreaTime)]
[TestCase(QuantConnect.Securities.Futures.Indices.MSCITaiwanIndex, OneFortyFivePM)]
[TestCase(QuantConnect.Securities.Futures.Indices.Nifty50, ThreeThirtyPM)]
[TestCase(QuantConnect.Securities.Futures.Indices.BankNifty, ThreeThirtyPM)]
Expand Down
Binary file modified Tests/TestData/FuturesExpiryFunctionsTestData.xml
Binary file not shown.
Loading