20260707111223_AddSeibroSupply.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. using System;
  2. using Microsoft.EntityFrameworkCore.Migrations;
  3. #nullable disable
  4. namespace Infrastructure.Migrations.AppDb
  5. {
  6. /// <inheritdoc />
  7. public partial class AddSeibroSupply : Migration
  8. {
  9. /// <inheritdoc />
  10. protected override void Up(MigrationBuilder migrationBuilder)
  11. {
  12. migrationBuilder.CreateTable(
  13. name: "ListingChangeEvent",
  14. columns: table => new
  15. {
  16. ID = table.Column<int>(type: "int", nullable: false)
  17. .Annotation("SqlServer:Identity", "1, 1"),
  18. IssucoCustno = table.Column<int>(type: "int", nullable: true, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
  19. Isin = table.Column<string>(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"),
  20. ShotnIsin = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "단축코드 (SHOTN_ISIN)"),
  21. KorSecnNm = table.Column<string>(type: "nvarchar(150)", maxLength: 150, nullable: false, comment: "종목명 (KOR_SECN_NM)"),
  22. BfaltCirclForm = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "변경전 유통형태 (BFALT_CIRCL_FORM)"),
  23. AfaltCirclForm = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: true, comment: "변경후 유통형태 (AFALT_CIRCL_FORM)"),
  24. ApliDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "변경(적용)일자 (APLI_DT)"),
  25. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  26. },
  27. constraints: table =>
  28. {
  29. table.PrimaryKey("PK_ListingChangeEvent", x => x.ID);
  30. },
  31. comment: "SEIBro 주식 상장(유통형태 변경) 정보 (getStkListInfo) — 월 윈도우 스윕, 적용일 기준 window delete+insert");
  32. migrationBuilder.CreateTable(
  33. name: "LockupEvent",
  34. columns: table => new
  35. {
  36. ID = table.Column<int>(type: "int", nullable: false)
  37. .Annotation("SqlServer:Identity", "1, 1"),
  38. IssucoCustno = table.Column<int>(type: "int", nullable: false, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
  39. KorSecnNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "한글종목명 (KOR_SECN_NM)"),
  40. SecnKacd = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: true, comment: "종목종류 (SECN_KACD — 실응답은 명칭 문자열)"),
  41. ShotnIsin = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: false, comment: "단축코드 (SHOTN_ISIN)"),
  42. MartTpcd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: true, comment: "시장구분 (MART_TPCD)"),
  43. OccrSeq = table.Column<string>(type: "nvarchar(1)", maxLength: 1, nullable: false, comment: "업무구분 (OCCR_SEQ) — 1예수 2반환"),
  44. SafedpDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "의무보호예수일 (SAFEDP_DT)"),
  45. SafedpQty = table.Column<long>(type: "bigint", nullable: true, comment: "예수주식수 (SAFEDP_QTY)"),
  46. DutySafedpRacd = table.Column<string>(type: "nvarchar(2)", maxLength: 2, nullable: false, comment: "보호예수사유코드 (DUTY_SAFEDP_RACD)"),
  47. ReturnDt = table.Column<DateOnly>(type: "date", nullable: true, comment: "반환일 (RETURN_DT)"),
  48. ReturnQty = table.Column<long>(type: "bigint", nullable: true, comment: "반환주식수 (RETURN_QTY)"),
  49. TotalStkCnt = table.Column<long>(type: "bigint", nullable: true, comment: "총발행주식수 (TOTAL_STK_CNT)"),
  50. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  51. },
  52. constraints: table =>
  53. {
  54. table.PrimaryKey("PK_LockupEvent", x => x.ID);
  55. },
  56. comment: "SEIBro 의무보호예수/반환 (getSafeDpDutyDepoStatus) — 락업 예수/반환 일정·수량·사유");
  57. migrationBuilder.CreateTable(
  58. name: "SecuritiesLending",
  59. columns: table => new
  60. {
  61. ID = table.Column<int>(type: "int", nullable: false)
  62. .Annotation("SqlServer:Identity", "1, 1"),
  63. Isin = table.Column<string>(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목코드 (ISIN)"),
  64. StdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "기준일 (STD_DT)"),
  65. TotIssuStkqty = table.Column<long>(type: "bigint", nullable: true, comment: "총발행주식수 (TOT_ISSU_STKQTY)"),
  66. TrQty = table.Column<long>(type: "bigint", nullable: true, comment: "일일거래량 (TR_QTY)"),
  67. MatcQty = table.Column<long>(type: "bigint", nullable: true, comment: "대차체결량 (MATC_QTY)"),
  68. RedQty = table.Column<long>(type: "bigint", nullable: true, comment: "대차상환량 (RED_QTY)"),
  69. SlbTrRemQty = table.Column<long>(type: "bigint", nullable: true, comment: "대차잔고주수 (SLB_TR_REM_QTY)"),
  70. FrinerLendRemAmt = table.Column<long>(type: "bigint", nullable: true, comment: "외국인 대여잔고금액 (FRINER_LEND_REM_AMT)"),
  71. FrinerLendRemRatio = table.Column<decimal>(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "외국인 대여잔고비율 (FRINER_LEND_REM_RATIO)"),
  72. NativeLendRemAmt = table.Column<long>(type: "bigint", nullable: true, comment: "내국인 대여잔고금액 (NATIVE_LEND_REM_AMT)"),
  73. NativeLendRemRatio = table.Column<decimal>(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "내국인 대여잔고비율 (NATIVE_LEND_REM_RATIO)"),
  74. FrinerBrwRemAmt = table.Column<long>(type: "bigint", nullable: true, comment: "외국인 차입잔고금액 (FRINER_BRW_REM_AMT)"),
  75. FrinerBrwRemRatio = table.Column<decimal>(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "외국인 차입잔고비율 (FRINER_BRW_REM_RATIO)"),
  76. NativeBrwRemAmt = table.Column<long>(type: "bigint", nullable: true, comment: "내국인 차입잔고금액 (NATIVE_BRW_REM_AMT)"),
  77. NativeBrwRemRatio = table.Column<decimal>(type: "decimal(6,2)", precision: 6, scale: 2, nullable: true, comment: "내국인 차입잔고비율 (NATIVE_BRW_REM_RATIO)"),
  78. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  79. },
  80. constraints: table =>
  81. {
  82. table.PrimaryKey("PK_SecuritiesLending", x => x.ID);
  83. },
  84. comment: "SEIBro 종목별 대차거래 현황 (getSlbDealingByIsin) — 대차잔고·외국인/내국인 대여·차입");
  85. migrationBuilder.CreateTable(
  86. name: "StockIssuanceChange",
  87. columns: table => new
  88. {
  89. ID = table.Column<int>(type: "int", nullable: false)
  90. .Annotation("SqlServer:Identity", "1, 1"),
  91. IssucoCustno = table.Column<int>(type: "int", nullable: true, comment: "발행회사 고객번호 (ISSUCO_CUSTNO)"),
  92. Isin = table.Column<string>(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목번호 (ISIN)"),
  93. SecnKacd = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: true, comment: "종목종류코드 (SECN_KACD)"),
  94. SecnIssuNtimes = table.Column<int>(type: "int", nullable: false, comment: "종목발행횟수 (SECN_ISSU_NTIMES)"),
  95. IssuDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "발행일자 (ISSU_DT)"),
  96. Issuprc = table.Column<decimal>(type: "decimal(28,10)", precision: 28, scale: 10, nullable: true, comment: "발행가 (ISSUPRC, 1주당)"),
  97. IssuQty = table.Column<long>(type: "bigint", nullable: true, comment: "발행수량 (ISSU_QTY) — 감소는 음수"),
  98. SecnIssuRacd = table.Column<string>(type: "nvarchar(3)", maxLength: 3, nullable: false, comment: "종목발행사유코드 (SECN_ISSU_RACD)"),
  99. SecnIssuNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "종목발행사유명 (SECN_ISSU_NM)"),
  100. ListDt = table.Column<DateOnly>(type: "date", nullable: true, comment: "상장일자 (LIST_DT)"),
  101. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  102. },
  103. constraints: table =>
  104. {
  105. table.PrimaryKey("PK_StockIssuanceChange", x => x.ID);
  106. },
  107. comment: "SEIBro 주식증감내역 (getStkIncdecDetails) — 발행횟수별 주식수 변동(액면분할·증자·소각)");
  108. migrationBuilder.CreateTable(
  109. name: "UnlistedCirculation",
  110. columns: table => new
  111. {
  112. ID = table.Column<int>(type: "int", nullable: false)
  113. .Annotation("SqlServer:Identity", "1, 1"),
  114. Isin = table.Column<string>(type: "nchar(12)", fixedLength: true, maxLength: 12, nullable: false, comment: "종목번호 (ISIN)"),
  115. StdDt = table.Column<DateOnly>(type: "date", nullable: false, comment: "기준일 (요청 STD_DT — 응답 미포함)"),
  116. ShotnIsin = table.Column<string>(type: "nvarchar(12)", maxLength: 12, nullable: true, comment: "단축코드 (SHOTN_ISIN)"),
  117. RepSecnNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false, comment: "대표종목명 (REP_SECN_NM)"),
  118. SecnKacdNm = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true, comment: "종목종류 (SECN_KACD_NM — 스펙 SECN_KACA_NM 오기)"),
  119. GenDepoQty = table.Column<long>(type: "bigint", nullable: true, comment: "예탁수량 (GEN_DEPO_QTY)"),
  120. RthingReturnStkqty = table.Column<long>(type: "bigint", nullable: true, comment: "반환수량 (RTHING_RETURN_STKQTY)"),
  121. AcnttrQty = table.Column<long>(type: "bigint", nullable: true, comment: "계좌대체수량 (ACNTTR_QTY)"),
  122. IsElectronicSecurity = table.Column<bool>(type: "bit", nullable: true, comment: "전자증권 여부 (ELTSC_YN)"),
  123. UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
  124. },
  125. constraints: table =>
  126. {
  127. table.PrimaryKey("PK_UnlistedCirculation", x => x.ID);
  128. },
  129. comment: "SEIBro 비상장유통추정 정보 (getUnlistCirclInfo) — 비상장(K-OTC) 예탁/계좌대체/반환. StdDt 는 요청값 스탬핑");
  130. migrationBuilder.CreateIndex(
  131. name: "IX_ListingChangeEvent_ApliDt",
  132. table: "ListingChangeEvent",
  133. column: "ApliDt");
  134. migrationBuilder.CreateIndex(
  135. name: "IX_ListingChangeEvent_Isin_ApliDt_BfaltCirclForm_AfaltCirclForm",
  136. table: "ListingChangeEvent",
  137. columns: new[] { "Isin", "ApliDt", "BfaltCirclForm", "AfaltCirclForm" },
  138. unique: true,
  139. filter: "[BfaltCirclForm] IS NOT NULL AND [AfaltCirclForm] IS NOT NULL");
  140. migrationBuilder.CreateIndex(
  141. name: "IX_LockupEvent_IssucoCustno_ShotnIsin_SafedpDt_OccrSeq_DutySafedpRacd",
  142. table: "LockupEvent",
  143. columns: new[] { "IssucoCustno", "ShotnIsin", "SafedpDt", "OccrSeq", "DutySafedpRacd" },
  144. unique: true);
  145. migrationBuilder.CreateIndex(
  146. name: "IX_LockupEvent_ReturnDt",
  147. table: "LockupEvent",
  148. column: "ReturnDt");
  149. migrationBuilder.CreateIndex(
  150. name: "IX_LockupEvent_SafedpDt",
  151. table: "LockupEvent",
  152. column: "SafedpDt");
  153. migrationBuilder.CreateIndex(
  154. name: "IX_SecuritiesLending_Isin_StdDt",
  155. table: "SecuritiesLending",
  156. columns: new[] { "Isin", "StdDt" },
  157. unique: true);
  158. migrationBuilder.CreateIndex(
  159. name: "IX_SecuritiesLending_StdDt",
  160. table: "SecuritiesLending",
  161. column: "StdDt");
  162. migrationBuilder.CreateIndex(
  163. name: "IX_StockIssuanceChange_Isin_SecnIssuNtimes_IssuDt_SecnIssuRacd",
  164. table: "StockIssuanceChange",
  165. columns: new[] { "Isin", "SecnIssuNtimes", "IssuDt", "SecnIssuRacd" },
  166. unique: true);
  167. migrationBuilder.CreateIndex(
  168. name: "IX_StockIssuanceChange_IssuDt",
  169. table: "StockIssuanceChange",
  170. column: "IssuDt");
  171. migrationBuilder.CreateIndex(
  172. name: "IX_UnlistedCirculation_Isin_StdDt",
  173. table: "UnlistedCirculation",
  174. columns: new[] { "Isin", "StdDt" },
  175. unique: true);
  176. migrationBuilder.CreateIndex(
  177. name: "IX_UnlistedCirculation_StdDt",
  178. table: "UnlistedCirculation",
  179. column: "StdDt");
  180. }
  181. /// <inheritdoc />
  182. protected override void Down(MigrationBuilder migrationBuilder)
  183. {
  184. migrationBuilder.DropTable(
  185. name: "ListingChangeEvent");
  186. migrationBuilder.DropTable(
  187. name: "LockupEvent");
  188. migrationBuilder.DropTable(
  189. name: "SecuritiesLending");
  190. migrationBuilder.DropTable(
  191. name: "StockIssuanceChange");
  192. migrationBuilder.DropTable(
  193. name: "UnlistedCirculation");
  194. }
  195. }
  196. }