From 5aa90e4aaae6c6f1d715f2f16da02be44be4f000 Mon Sep 17 00:00:00 2001 From: Wickedness Date: Fri, 10 Jul 2026 04:32:15 +0900 Subject: [PATCH] feat: initialize WinUI 3 WebView migration --- .gitattributes | 24 + .gitignore | 40 ++ App.xaml | 27 + App.xaml.cs | 20 + Assets/LockScreenLogo.scale-200.png | Bin 0 -> 432 bytes Assets/SplashScreen.scale-200.png | Bin 0 -> 5372 bytes Assets/Square150x150Logo.scale-200.png | Bin 0 -> 1755 bytes Assets/Square44x44Logo.scale-200.png | Bin 0 -> 637 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 283 bytes Assets/StoreLogo.png | Bin 0 -> 456 bytes Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 2097 bytes Config/appsettings.example.json | 21 + Imports.cs | 2 + MBN_STOCK_WEBVIEW.csproj | 80 +++ MBN_STOCK_WEBVIEW.sln | 38 + MainWindow.xaml | 129 ++++ MainWindow.xaml.cs | 250 +++++++ Package.appxmanifest | 51 ++ Properties/PublishProfiles/win-x64.pubxml | 17 + Properties/launchSettings.json | 7 + README.md | 78 ++ Web/app.js | 398 +++++++++++ Web/index.html | 139 ++++ Web/styles.css | 220 ++++++ app.manifest | 24 + docs/MIGRATION.md | 65 ++ .../Data/IDataQueryExecutor.cs | 45 ++ .../LegacyData/DBDefine.cs | 353 ++++++++++ .../LegacyData/DataDefineBuilder.cs | 131 ++++ .../LegacyData/DataManager.cs | 665 ++++++++++++++++++ .../LegacyData/IDBDataHandle.cs | 20 + .../LegacyData/Request/ADataObject.cs | 52 ++ .../LegacyData/Request/IDataRequest.cs | 20 + .../LegacyData/Request/Nxt_ADataObject.cs | 53 ++ .../LegacyData/Request/Nxt_IDataRequest.cs | 20 + .../Request/거래원/trader_stocks.cs | 263 +++++++ .../LegacyData/Request/그리드/Grid11.cs | 67 ++ .../LegacyData/Request/그리드/Grid13.cs | 76 ++ .../LegacyData/Request/그리드/Grid14.cs | 33 + .../LegacyData/Request/그리드/Grid8.cs | 70 ++ .../LegacyData/Request/그리드/Grid9.cs | 232 ++++++ .../LegacyData/Request/막대그래프/Stick12.cs | 64 ++ .../LegacyData/Request/막대그래프/Stick21.cs | 112 +++ .../LegacyData/Request/봉차트/ACandleData.cs | 107 +++ .../Request/봉차트/CandleFutures.cs | 135 ++++ .../Request/봉차트/CandleIndustryKOSDAQ.cs | 142 ++++ .../Request/봉차트/CandleIndustryKOSPI.cs | 144 ++++ .../LegacyData/Request/봉차트/CandleKOSDAQ.cs | 151 ++++ .../LegacyData/Request/봉차트/CandleKOSPI.cs | 147 ++++ .../Request/봉차트/CandleKOSPI200.cs | 149 ++++ .../LegacyData/Request/봉차트/CandleKRX100.cs | 145 ++++ .../Request/봉차트/CandleStockDIS.cs | 67 ++ .../Request/봉차트/CandleStockDISK.cs | 64 ++ .../Request/봉차트/CandleStockKOSDAQ.cs | 219 ++++++ .../Request/봉차트/CandleStockKOSPI.cs | 221 ++++++ .../Request/봉차트/Candleforeign.cs | 58 ++ .../Request/봉차트/CandleforeignStock.cs | 54 ++ .../Request/사각형그래프/Square20.cs | 65 ++ .../LegacyData/Request/선그래프/Exchange.cs | 105 +++ .../Request/선그래프/IndexIndustryYield.cs | 117 +++ .../LegacyData/Request/선그래프/IndexYield.cs | 312 ++++++++ .../LegacyData/Request/선그래프/StockYield.cs | 128 ++++ .../LegacyData/Request/선그래프/Trading.cs | 296 ++++++++ .../LegacyData/Request/지도데이터/MapAsia.cs | 49 ++ .../Request/지도데이터/MapEurope.cs | 40 ++ .../LegacyData/Request/지도데이터/MapUSA.cs | 40 ++ .../LegacyData/Request/지도데이터/MapWorld.cs | 49 ++ .../LegacyData/Request/판5단/ETF.cs | 88 +++ .../Request/판5단/Nxt_capital_5dan.cs | 73 ++ .../Request/판5단/Nxt_high_overtime_5dan.cs | 80 +++ .../Request/판5단/Nxt_low_overtime_5dan.cs | 75 ++ .../Request/판5단/Nxt_lower_5dan.cs | 79 +++ .../Request/판5단/Nxt_upper_5dan.cs | 79 +++ .../LegacyData/Request/판5단/Nxt_vol_5dan.cs | 77 ++ .../LegacyData/Request/판5단/capital_5dan.cs | 114 +++ .../Request/판5단/capital_forecast_5dan.cs | 116 +++ .../LegacyData/Request/판5단/high52_5dan.cs | 101 +++ .../Request/판5단/high_overtime_5dan.cs | 119 ++++ .../LegacyData/Request/판5단/kospi200.cs | 113 +++ .../LegacyData/Request/판5단/low52_5dan.cs | 101 +++ .../Request/판5단/low_overtime_5dan.cs | 125 ++++ .../LegacyData/Request/판5단/lower_5dan.cs | 87 +++ .../LegacyData/Request/판5단/suggest_5dan.cs | 77 ++ .../LegacyData/Request/판5단/theme_5dan.cs | 76 ++ .../Request/판5단/theme_yesang_5dan.cs | 102 +++ .../LegacyData/Request/판5단/upjong_5dan.cs | 71 ++ .../LegacyData/Request/판5단/upper_5dan.cs | 87 +++ .../Request/판데이터기본/DataObject_3PAN.cs | 471 +++++++++++++ .../Request/판데이터기본/EXCHANGE_PAN.cs | 81 +++ .../Request/판데이터기본/NXT_SANGSE_PAN.cs | 370 ++++++++++ .../Request/판데이터기본/SANGSE_PAN.cs | 199 ++++++ .../판데이터기본/업종/INDUSTRY_FORGIEN_PAN.cs | 47 ++ .../Request/판데이터기본/업종/INDUSTRY_PAN.cs | 66 ++ .../판데이터기본/종목/Nxt_STOCK_PAN.cs | 122 ++++ .../판데이터기본/종목/STOCK_FORECAST_PAN.cs | 108 +++ .../판데이터기본/종목/STOCK_FORGIEN_PAN.cs | 47 ++ .../판데이터기본/종목/STOCK_OVERTIME_PAN.cs | 116 +++ .../Request/판데이터기본/종목/STOCK_PAN.cs | 162 +++++ .../판데이터기본/지수/INDEX_FORECAST_PAN.cs | 92 +++ .../판데이터기본/지수/INDEX_FORGIEN_PAN.cs | 45 ++ .../Request/판데이터기본/지수/INDEX_PAN.cs | 105 +++ .../LegacyData/Request/호가/Quote_Stocks.cs | 109 +++ .../MBN_STOCK_WEBVIEW.Core.csproj | 13 + 103 files changed, 10903 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 App.xaml create mode 100644 App.xaml.cs create mode 100644 Assets/LockScreenLogo.scale-200.png create mode 100644 Assets/SplashScreen.scale-200.png create mode 100644 Assets/Square150x150Logo.scale-200.png create mode 100644 Assets/Square44x44Logo.scale-200.png create mode 100644 Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 Assets/StoreLogo.png create mode 100644 Assets/Wide310x150Logo.scale-200.png create mode 100644 Config/appsettings.example.json create mode 100644 Imports.cs create mode 100644 MBN_STOCK_WEBVIEW.csproj create mode 100644 MBN_STOCK_WEBVIEW.sln create mode 100644 MainWindow.xaml create mode 100644 MainWindow.xaml.cs create mode 100644 Package.appxmanifest create mode 100644 Properties/PublishProfiles/win-x64.pubxml create mode 100644 Properties/launchSettings.json create mode 100644 README.md create mode 100644 Web/app.js create mode 100644 Web/index.html create mode 100644 Web/styles.css create mode 100644 app.manifest create mode 100644 docs/MIGRATION.md create mode 100644 src/MBN_STOCK_WEBVIEW.Core/Data/IDataQueryExecutor.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/DBDefine.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataDefineBuilder.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataManager.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/IDBDataHandle.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/ADataObject.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/IDataRequest.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_ADataObject.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_IDataRequest.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/거래원/trader_stocks.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid11.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid13.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid14.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid8.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid9.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick12.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick21.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/ACandleData.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleFutures.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSDAQ.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSPI.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSDAQ.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI200.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKRX100.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDIS.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDISK.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSDAQ.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSPI.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/Candleforeign.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleforeignStock.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/사각형그래프/Square20.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Exchange.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexIndustryYield.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexYield.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/StockYield.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Trading.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapAsia.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapEurope.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapUSA.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapWorld.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/ETF.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_capital_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_high_overtime_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_low_overtime_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_lower_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_upper_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_vol_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_forecast_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high52_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high_overtime_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/kospi200.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low52_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low_overtime_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/lower_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/suggest_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_yesang_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upjong_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upper_5dan.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/DataObject_3PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/EXCHANGE_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/NXT_SANGSE_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/SANGSE_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_FORGIEN_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/Nxt_STOCK_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORECAST_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORGIEN_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_OVERTIME_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORECAST_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORGIEN_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_PAN.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/호가/Quote_Stocks.cs create mode 100644 src/MBN_STOCK_WEBVIEW.Core/MBN_STOCK_WEBVIEW.Core.csproj diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..e0e5a50 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,24 @@ +* text=auto + +.gitattributes text eol=lf +.gitignore text eol=lf + +*.cs text eol=crlf +*.sln text eol=crlf +*.csproj text eol=crlf +*.xaml text eol=crlf +*.xml text eol=crlf +*.appxmanifest text eol=crlf +*.manifest text eol=crlf +*.pubxml text eol=crlf +*.json text eol=lf +*.html text eol=lf +*.css text eol=lf +*.js text eol=lf +*.md text eol=lf + +*.png binary +*.ico binary + +# The migrated SQL files preserve legacy verbatim-query formatting. +src/MBN_STOCK_WEBVIEW.Core/LegacyData/** whitespace=-blank-at-eol,-blank-at-eof,-space-before-tab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e62f146 --- /dev/null +++ b/.gitignore @@ -0,0 +1,40 @@ +# Visual Studio / .NET +.vs/ +**/bin/ +**/obj/ +artifacts/ +TestResults/ +*.user +*.suo +*.userosscache +*.sln.docstates + +# MSIX build output and signing material +AppPackages/ +BundleArtifacts/ +*.appx +*.appxbundle +*.msix +*.msixbundle +*.msixupload +*.pfx +*.p12 +*.snk + +# Local settings and secrets +Config/appsettings.local.json +Config/*.secrets.json +*.local.ini +.env +.env.* +!.env.example + +# Web tooling (if introduced later) +node_modules/ +dist/ + +# OS / editors +.DS_Store +Thumbs.db +.idea/ +.vscode/ diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..fd8feae --- /dev/null +++ b/App.xaml @@ -0,0 +1,27 @@ + + + + + + + + + #07101D + #0D1929 + #1E314A + #32D5A4 + + + + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..55accb8 --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,20 @@ +namespace MBN_STOCK_WEBVIEW; + +/// +/// Application entry point for the packaged WinUI 3 desktop app. +/// +public partial class App : Application +{ + private Window? _window; + + public App() + { + InitializeComponent(); + } + + protected override void OnLaunched(LaunchActivatedEventArgs args) + { + _window = new MainWindow(); + _window.Activate(); + } +} diff --git a/Assets/LockScreenLogo.scale-200.png b/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..7440f0d4bf7c7e26e4e36328738c68e624ee851e GIT binary patch literal 432 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezr3(FqV6|IEGZ*x-#9g>~Mkr+x6^F zy~CDX2QIMs&Gcs3RnRBoxBA!*(Mfw0KTCYuYk0WlEIV>qBmPl! zq4ukrvfADX@#p8fbLY(H47N+k`FZ(FZh?cDro7>{8mkBO3>^oaIx`3!Jl)Qq)HI!+ z(S=1{o~eT)&W^=Ea8C`-17(Jv5(nHFJ{dOjGdxLVkY_y6&S1whfuFI4MM0kF0f&cO zPDVpV%nz;Id$>+0Ga5e9625-JcI)oq=#Pa3p^>8BB}21BUw@eN!-6@w%X+^`+Vn?! zryu|3T>kVWNBYyBc=7Y6H#s1Ah!OI_nezW zXTqOdkv2Az6KKBV=$yHdF^R3Fqw(TZEoNSZX>reXJ#bwX42%f|Pgg&ebxsLQ010xn AssI20 literal 0 HcmV?d00001 diff --git a/Assets/SplashScreen.scale-200.png b/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..32f486a86792a5e34cd9a8261b394c49b48f86be GIT binary patch literal 5372 zcmd5=Z){Ul6u)iv53sCbIJKLzl(EF%0tzcEY@|pLrfgF~2Dk$KFtU+$kbYqDN5W%7 z>?DBo!@y06eh{Oux>brrNT^{MO(tkiC@nH(2}}G_1|uvcMD(0{?|W^Gxo!tG~hW2Rn&7%b`-Kd_^`BCrb>XVtRKONoEw6%NswzMxk+kbocuk&}kJ#hSP z>8uR{r%LJ?I#)aaWW;uEixz+DzyTpp)MTEo&R%nEA92~g{^eXQwKV1m{xl5K<@k3FacT+Z zrwfy=VocIptI>t%@p5a;Rt=WXVnU;2SUdr7Yk>gw_2z_ICK^23$|Cg7{3Eg5j@N*F zetT?>30(*S_7ld-Yt&u7T{(hEjjM#vPlXibjrq?;pBBx3*>_2~VFGdsH5L zQKme_LAebV}aOX#+rQafZtp+4jK}V!>pn1?+eUH$0%6}z(Kul9!^2z zXi+d@jnx)RW7!j9uFEdv5N&1sCW#Z6Ej5Y7c;o28Q7i%U0(2v5J>o9P zl$#C8&9r)nL;?J65^GIeSOHYr3B7}}R~}@2Tx_xo5*YdU#g1bO}95cq69J!efdlE+xj1qG#ZUqh~1Sn#dBsZfDvcupM zXOFoyJ0$s+RHQKpzr#T>c&EUbq)lGvZDxuI!9unMI=#;ob2&gT)WqOjt6^X`_N21r`&eh6h0xpT!n6Z9rvE&+bFU$vTJO2? z#^tBNOx*2N)~(+TH8d>ep6``8V=3JEfdUUahVZ-xN+k#V&32x|%qnX(XBii5<@`%^ zV#Ky4f1!6RJqJXBU3M4~tmj2;;r`8_j&w?h5g35uMH(QI$Xpesb zG|*XRT?kh6M(jj0Y&vF^M*9g-iDMW%G%9%Pa}6ERQ9b0%6z1v}Ja=|L@G#5ZI>JS9 z*(K12nMvS?oyG8s9|q~{w`ajtI`KSHSiJ;)%X@M&eCE(VqI#F(XL?L@A$TUT?6av5 zkPWIR391XjSC%d6L}7F71Qpw(;c_~)mSZo-&Fm^FHlPX|Fu}1B3E+9j0}o1a(4HFS zUItE22CC%XZi!b4%~vWn>rpV9&CUEvt!?Q{Pr*L~51&(0Sz{VJJFrJtWw2PwXd|J{ zgH%3vAY$flodH=4&ruCHX;(3t;o}n?!0~3EE|5qRz$!VIkphxa4@_jyfiE9m;0 zjcYJ2;26N&MTB8X4joZ&?SUe|VS$^I%dt{!c2O;%3SdqW@K_14r8eyC1s&VcU5+2~ z_O1Cc*w|aIA=VC6AT_EFoL}W#Rl;7CZe)e}RS*e;8CVyM6i8a(yO@|S709VYY(y2g zc+QxB>Bw^B^2Db~*o)=i$m-aUNQFkYy5(eJW$cez>C{POds*p3cy#tHnvActP;dBP zdEf)C;lq}&#PE?XCD<~ngrzYUg|nS`#MS`Rd7cT>xlR19P#~4Qg5!J}@glCUq)z_2 zjvyv%aSq0 z)njao1dV0XNw&c@qmj1e*jgQ$l@_urW5G4RSY#rT1z`#%3;{EB`aJK|TH^lb_3nAT z-_Q4X-(K&IS8UyqsnjYdippfmN-HT!X2MT;Dpcy~-#$k6V z|MR4vU#O&p7TC46pTflb3 zoUJ;ZRf#&8&EwXy5s%!&(q6cN62swD#FH%O-RJsjWPZN3^^@FCIQ&MxXIFo7!I#VI zkpIstuWqUV5uhgs07?k$*!`uiZ=5b#$lI|0c+XJvj(}zSE3MN#EyOK zql(#yA}~Ibl*r(s1}Z^5mmn*-n93g?-ccM+^PN?6HH~h0hjy6@XY*^i<-V)+OZ;p7 z7j`p_sT55xnYsedNIIel^QIIg7i@`2Qi}x5$!tk29$2OQI zs^kQXAKE}5ZJu$)2@Dxn?}}O@f@6@^!%9Tj+o>=jd!^ZuvBE4jb4g}Z5WMBtcmy^~ zoFGVS5|0FA!(1Q%fL?Bj*L+9ZL{mjSO8lzqrQ0UCZ)X zPwk$1HNFgaK%NxGpuXz}#ywXvf2JQ?BQ5uOZM2up4S#ieaxS$!o9o6Z=czNQb} zwAh|xLZ>+WyN%o?^uCAQw&&4o?S$DJ`WP(Hr*grL*qNXlqU0osCQ(Up5F(^$Z5;n&oJIO4uF`k&QL*j{f zU=;#MZ5{@b%qMbjTB3dh-5#mqY>%{0jgS+WdHyG literal 0 HcmV?d00001 diff --git a/Assets/Square44x44Logo.scale-200.png b/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..f713bba67f551ef91020b75716a4dc8ebd744b1c GIT binary patch literal 637 zcmeAS@N?(olHy`uVBq!ia0vp^5g^RL1|$oo8kjIJFu8cTIEGZ*dUI*J;2{SImxtDO zm%3!R$UazoY}x{$j0P5ABYXWr(l=jxJ6ps1W{tV=^>{Dl><3nv3A}sm=EZ)#l3`NR zpZda3^rNox*D1%NC98Z~L*6zipLw~Gxn&(Y-;KmJ+aR6eLabU-L#y8HW%7P-E_-VlLqIabbHPHKT*)fT@9iWJ7iWgOT9%0}Lrj>lztPxWq6sPw3pi z#-<=#$jjrP_DD*i!RLsn0mIA=>4~N)IMYWIf=j%-zuKCdMG%tHYot70D1| zvWa0wMhauW#S>1CnI_;>!1Q3zMA17@DOVq{MQ+{U7^a&yA+%dMCG;WNPV0i;w$tu; zX^b}UKziPM)(<;)ruW;-`)bBN+rQNM*Zs_>?n$|FVFo-e*PZb*@U7VAd+tHb4e?=Blc~}S6K)wL}r*Gf`BM#QB z+y>N$mCswb4d{^{S9v_!eQj4fTRMOwOCi?lSk9%<=vAz}jM-*PQtH@Odn1LZcd^j#o> hW$4xn+CT+ep9lJ{OAO?njobhL002ovPDHLkV1nYebbkN< literal 0 HcmV?d00001 diff --git a/Assets/StoreLogo.png b/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..a4586f26bdf7841cad10f39cdffe2aca3af252c1 GIT binary patch literal 456 zcmeAS@N?(olHy`uVBq!ia0vp^Mj*_=1|;R|J2o;fF!p=8IEGZ*dUM0H=rDtTTVkd2 z(%lbKn@VS_lUaADVB&;Z6F#LM+mPsa?e>FnHo;HND^!P`-lX%BH~FOg%y&x+t*x!? zg$#_1A1kgsSvO(fw`bOmo;lrJX8byO1j^gf7qohR%mmt z@L)WX;>gqgK|tWJvQ5j;4;=gt4HXVKSMYRv5RhY5vS~TqfK_NAP*r{h!!g^BZ;w4r z7CGdsai)y;fJQc`7{Zc2b==h%o`Op$|bg6a&nL{*m7-=0>k4M4-PXlU;G-?%*(*g>iFt^ U$m#7DfHB12>FVdQ&MBb@0G`#n8vpc0sq%A~kJcD9FY~qQRMt?ZR3YyDZt}Od;|mgpc{2dv9AHF){kXU%k({ z=Y8JidEayHTkG@twPZ|U3_^%3ct-OgLSiFAqDN!|tbCX@c@?4P`2x*TMK!+Q4b?k0 ziW7!!KF6dPWcF<%I|iznM~`QJ_V7sHGV_D`dhgpA9Vd@&X}ErK+j~_rdv;Bp?OA@a zFXOk7eWOJe5NcK;6h$FaM&7JxNc#-@QTwzW6x#d_zmQNkz5) zPI;kh;3d;5UCJU+9a(cOxX(|edWoOiAEdGU#kPJ&xnc2||3vDbuhBCkj-pb0as$Zl z5;}4n=**n6(1g`JEtSy;SG6X;#-F~Oz3lESG2b5`j@wAwY4Yp<=4Xeb>iH=6aicF?DxD&q{`!&}ct zBI)aycwuobQAf&678Uf+Mmh-@9RUhyH~>?w0dixO0#jZjEc9R^=5NZw=|a(kcB?9^ zfnTiEFXp-q#B;Tn>(O%$A*ud^Rg&eVH6Y_5Y%!E39RR&s?XpG`gKwU!6FE1 z7X)DC7)*(5g}lh`4`{i~DZcWupZI`K)_4P)VE{@gc7@Xsd^86zl~_mOYH?I4!aGeX z^E(_=L6?PgveDQ+r%P@UISEXrkn`LHJZ##+!-anV>6h)IkKp;E@p8+3&(5%kS2)ld*J*rJccZM0iyaAx7+F~GW1UWFK&3X$PE1^}NH zgAG9ck5K!{07OwU@j@Do>TbH=CDEo#4m0cEyAuXy_<&jlzJVcKweSJ5 z&=q~iIn18$w8yb=rmEmHxVEUA^?RwnB?6Qlp1os8@*dWTGL2bhzZ!s*xqScR?EPL` zo(JwNdKUUYy7GtvZ3asXm)cgFvCx9EmAi;|w=a0iGiv%%VYKh`P0Wma4y`Xyx|T~( zAmfGbgbEEC7)j8b@WA@+5W3a61HJXC1dX@6_T|Czk0I0zBk%tnW~()VWITGI!`$c< gARL?UBrYYkwoDw4eo*CrzXGTrZ@;GF>596)00d&n@&Et; literal 0 HcmV?d00001 diff --git a/Config/appsettings.example.json b/Config/appsettings.example.json new file mode 100644 index 0000000..72f4af6 --- /dev/null +++ b/Config/appsettings.example.json @@ -0,0 +1,21 @@ +{ + "database": { + "oracle": { + "host": "", + "port": 1521, + "serviceName": "", + "userName": "" + }, + "mariaDb": { + "host": "", + "port": 3306, + "database": "", + "userName": "" + } + }, + "playout": { + "host": "127.0.0.1", + "port": 30001, + "sceneFolder": "" + } +} diff --git a/Imports.cs b/Imports.cs new file mode 100644 index 0000000..5443927 --- /dev/null +++ b/Imports.cs @@ -0,0 +1,2 @@ +global using Microsoft.UI.Xaml; +global using Microsoft.UI.Xaml.Controls; diff --git a/MBN_STOCK_WEBVIEW.csproj b/MBN_STOCK_WEBVIEW.csproj new file mode 100644 index 0000000..1a41b95 --- /dev/null +++ b/MBN_STOCK_WEBVIEW.csproj @@ -0,0 +1,80 @@ + + + + net8.0-windows10.0.19041.0 + 10.0.17763.0 + WinExe + + + true + true + + + enable + latest + enable + MBN_STOCK_WEBVIEW + + + true + x64 + x64 + win-x64 + win-x64 + app.manifest + Properties\PublishProfiles\win-x64.pubxml + false + false + 1.0.0 + 1 + + + + + + + + + + + + PreserveNewest + PreserveNewest + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + diff --git a/MBN_STOCK_WEBVIEW.sln b/MBN_STOCK_WEBVIEW.sln new file mode 100644 index 0000000..0c13613 --- /dev/null +++ b/MBN_STOCK_WEBVIEW.sln @@ -0,0 +1,38 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.5.33103.201 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{84322810-C106-461C-892A-5A3631226260}") = "MBN_STOCK_WEBVIEW", "MBN_STOCK_WEBVIEW.csproj", "{E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{827E0CD3-B72D-47B6-A68D-7590B98EB39B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MBN_STOCK_WEBVIEW.Core", "src\MBN_STOCK_WEBVIEW.Core\MBN_STOCK_WEBVIEW.Core.csproj", "{CCFB7CB0-F898-444F-A16B-E28554A2698A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}.Debug|x64.ActiveCfg = Debug|x64 + {E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}.Debug|x64.Build.0 = Debug|x64 + {E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}.Debug|x64.Deploy.0 = Debug|x64 + {E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}.Release|x64.ActiveCfg = Release|x64 + {E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}.Release|x64.Build.0 = Release|x64 + {E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}.Release|x64.Deploy.0 = Release|x64 + {CCFB7CB0-F898-444F-A16B-E28554A2698A}.Debug|x64.ActiveCfg = Debug|Any CPU + {CCFB7CB0-F898-444F-A16B-E28554A2698A}.Debug|x64.Build.0 = Debug|Any CPU + {CCFB7CB0-F898-444F-A16B-E28554A2698A}.Release|x64.ActiveCfg = Release|Any CPU + {CCFB7CB0-F898-444F-A16B-E28554A2698A}.Release|x64.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {CCFB7CB0-F898-444F-A16B-E28554A2698A} = {827E0CD3-B72D-47B6-A68D-7590B98EB39B} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {58E98A35-4C8C-4C80-9227-1063B345AD07} + EndGlobalSection +EndGlobal diff --git a/MainWindow.xaml b/MainWindow.xaml new file mode 100644 index 0000000..ca60e6f --- /dev/null +++ b/MainWindow.xaml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+

OPERATOR WORKSPACE

+

마이그레이션 대시보드

+
+
+
현재 시각--:--:--
+
패키지MSIX
+ +
+
+ +
+
WebView UIFarPoint 대체 기반
READY
+
71
데이터 요청기존 SQL 계층 이관
MIGRATED
+
DB
Oracle · MariaDB안전한 어댑터 대기
PENDING
+
T2
Tornado Enginex64 COM 검증 대기
PENDING
+
+ +
+
+
+

CUT CATALOG

그래픽 항목

+ Web UI +
+ +
+ + + + +
+
+
+ +
+
+

PLAYLIST

송출 순서

+ 0 CUTS +
+
+ + + + + + + +
+
+ + + +
#그래픽 컷구분정렬
+
+ 플레이리스트가 비어 있습니다. + 왼쪽 항목의 + 버튼으로 송출 순서를 구성하세요. +
+
+
+ +
+
+

PROGRAM / PREVIEW

송출 제어

+ IDLE +
+
+
+ PREVIEW + 선택된 그래픽 없음 + 플레이리스트 항목을 선택하세요. +
+
+
+
+
+ + + + +
+
+
운영 로그
+
    +
    +
    +
    +
    + + +
    + + + diff --git a/Web/styles.css b/Web/styles.css new file mode 100644 index 0000000..b16545d --- /dev/null +++ b/Web/styles.css @@ -0,0 +1,220 @@ +:root { + color-scheme: dark; + --bg: #07101d; + --surface: #0d1929; + --surface-2: #111f32; + --surface-3: #16263b; + --border: #1e314a; + --border-soft: #17283d; + --text: #e8eff8; + --muted: #8799af; + --muted-2: #5e728b; + --mint: #32d5a4; + --mint-soft: rgba(50, 213, 164, .13); + --blue: #56a8ff; + --amber: #ffba55; + --red: #ff6680; + --violet: #9b8cff; + --shadow: 0 18px 44px rgba(0, 0, 0, .24); + font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Segoe UI", sans-serif; +} + +* { box-sizing: border-box; } + +html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; } + +body { background: var(--bg); color: var(--text); font-size: 13px; } + +button, input { font: inherit; } + +button { color: inherit; } + +.app-shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); width: 100%; height: 100%; } + +.sidebar { + display: flex; + min-height: 0; + flex-direction: column; + background: #091421; + border-right: 1px solid var(--border); +} + +.brand-block { display: flex; align-items: center; gap: 11px; height: 82px; padding: 0 20px; border-bottom: 1px solid var(--border-soft); } + +.brand-mark { + display: grid; + width: 37px; + height: 37px; + place-items: center; + border-radius: 11px; + background: linear-gradient(145deg, #49edbb, #1db989); + box-shadow: 0 8px 24px rgba(50, 213, 164, .2); + color: #05120e; + font-size: 18px; + font-weight: 900; +} + +.brand-block strong { display: block; font-size: 13px; letter-spacing: .07em; } +.brand-block span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; } + +.market-nav { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 3px; overflow-y: auto; padding: 14px 11px; } + +.nav-item { + display: grid; + grid-template-columns: 29px 1fr; + align-items: center; + min-height: 40px; + padding: 0 11px; + border: 1px solid transparent; + border-radius: 9px; + background: transparent; + color: var(--muted); + text-align: left; + cursor: pointer; + transition: .16s ease; +} + +.nav-item span { display: grid; width: 22px; height: 22px; place-items: center; color: #647991; font-size: 12px; font-weight: 700; } +.nav-item:hover { background: rgba(255,255,255,.035); color: var(--text); } +.nav-item.active { border-color: rgba(50,213,164,.18); background: var(--mint-soft); color: #dffdf4; font-weight: 650; } +.nav-item.active span { color: var(--mint); } + +.sidebar-status { padding: 14px 15px 17px; border-top: 1px solid var(--border-soft); background: rgba(0,0,0,.09); } +.status-row { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 7px; margin: 7px 0; color: var(--muted); font-size: 10px; } +.status-row strong { color: #b9c6d5; font-size: 10px; font-weight: 600; } +.status-dot { width: 6px; height: 6px; border-radius: 50%; } +.status-dot.ok { background: var(--mint); box-shadow: 0 0 0 3px rgba(50,213,164,.1); } +.status-dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(255,186,85,.1); } +.runtime { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border-soft); color: var(--muted-2); font: 9px/1.4 Consolas, monospace; } + +.workspace { min-width: 0; min-height: 0; overflow: auto; padding: 0 24px 22px; background: radial-gradient(circle at 76% -10%, rgba(44,104,132,.13), transparent 35%), var(--bg); } + +.workspace-header { display: flex; align-items: center; justify-content: space-between; min-height: 82px; gap: 24px; } +.eyebrow, .panel-kicker { margin: 0 0 5px; color: var(--mint); font: 9px/1.2 Consolas, monospace; letter-spacing: .14em; } +h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.035em; } +.header-meta { display: flex; align-items: center; gap: 25px; } +.header-meta > div { display: flex; flex-direction: column; gap: 4px; } +.header-meta span { color: var(--muted-2); font-size: 9px; text-transform: uppercase; } +.header-meta strong { color: #cbd7e5; font: 12px Consolas, monospace; } + +.ghost-button, .playlist-actions button, .event-log button { + min-height: 30px; + border: 1px solid var(--border); + border-radius: 7px; + background: var(--surface-2); + color: #aebed0; + cursor: pointer; +} +.ghost-button { padding: 0 12px; } +.ghost-button:hover, .playlist-actions button:hover, .event-log button:hover { border-color: #36506e; color: white; } + +.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; } +.summary-strip article { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; min-width: 0; min-height: 62px; gap: 11px; padding: 10px 13px; border: 1px solid var(--border-soft); border-radius: 11px; background: rgba(13,25,41,.78); } +.summary-strip strong, .summary-strip small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } +.summary-strip strong { margin-bottom: 3px; font-size: 11px; } +.summary-strip small { color: var(--muted); font-size: 9px; } +.summary-strip b { align-self: start; margin-top: 4px; color: var(--muted-2); font: 8px Consolas, monospace; } +.metric-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; font: 10px Consolas, monospace; } +.metric-icon.mint { background: var(--mint-soft); color: var(--mint); } +.metric-icon.blue { background: rgba(86,168,255,.12); color: var(--blue); } +.metric-icon.amber { background: rgba(255,186,85,.12); color: var(--amber); } +.metric-icon.violet { background: rgba(155,140,255,.12); color: var(--violet); } + +.console-grid { display: grid; grid-template-columns: minmax(250px, .73fr) minmax(410px, 1.2fr) minmax(330px, 1fr); gap: 12px; min-height: 680px; height: calc(100vh - 188px); } + +.panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: rgba(13,25,41,.92); box-shadow: var(--shadow); overflow: hidden; } +.panel-header { display: flex; align-items: center; justify-content: space-between; min-height: 67px; padding: 0 16px; border-bottom: 1px solid var(--border-soft); } +.panel-header h2 { margin: 0; font-size: 15px; font-weight: 650; } +.badge { padding: 4px 7px; border: 1px solid rgba(50,213,164,.22); border-radius: 10px; background: var(--mint-soft); color: var(--mint); font: 8px Consolas, monospace; letter-spacing: .05em; } +.badge.neutral { border-color: var(--border); background: var(--surface-2); color: var(--muted); } + +.search-box { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 6px; height: 40px; margin: 13px 13px 10px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; background: #091522; } +.search-box > span { color: var(--muted); font-size: 17px; } +.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 11px; } +.search-box input::placeholder { color: #52657d; } +kbd { padding: 3px 5px; border: 1px solid #283c55; border-bottom-width: 2px; border-radius: 4px; color: #60748c; font: 8px Consolas, monospace; } + +.catalog-tabs { display: flex; gap: 5px; padding: 0 13px 11px; border-bottom: 1px solid var(--border-soft); } +.catalog-tabs button { padding: 5px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; } +.catalog-tabs button.active { border-color: var(--border); background: var(--surface-3); color: white; } +.catalog-list { min-height: 0; flex: 1; overflow-y: auto; padding: 8px; } +.catalog-item { display: grid; grid-template-columns: 34px 1fr 27px; align-items: center; min-height: 50px; gap: 9px; padding: 6px 7px; border: 1px solid transparent; border-radius: 8px; } +.catalog-item:hover { border-color: var(--border); background: rgba(255,255,255,.025); } +.cut-code { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 7px; background: var(--surface-3); color: #8ca2bc; font: 9px Consolas, monospace; } +.catalog-item strong, .catalog-item small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } +.catalog-item strong { margin-bottom: 3px; font-size: 10px; } +.catalog-item small { color: var(--muted-2); font-size: 8px; } +.add-cut { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid #29415b; border-radius: 7px; background: #102034; color: var(--mint); cursor: pointer; } +.add-cut:hover { border-color: var(--mint); background: var(--mint-soft); } +.catalog-empty { padding: 35px 10px; color: var(--muted); text-align: center; } + +.playlist-actions { display: grid; grid-template-columns: auto 30px 30px auto 1fr auto auto; gap: 5px; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); } +.playlist-actions button { padding: 0 9px; font-size: 9px; } +.playlist-actions button.danger { color: #ff9aad; } +.playlist-actions button.primary-soft { border-color: rgba(50,213,164,.23); background: var(--mint-soft); color: var(--mint); } +.table-wrap { position: relative; min-height: 0; flex: 1; overflow: auto; } +table { width: 100%; border-collapse: collapse; table-layout: fixed; } +thead { position: sticky; z-index: 2; top: 0; background: #0d1929; } +th { height: 35px; border-bottom: 1px solid var(--border); color: var(--muted-2); font-size: 8px; font-weight: 600; text-align: left; text-transform: uppercase; } +td { height: 47px; border-bottom: 1px solid var(--border-soft); color: #b9c7d8; font-size: 10px; } +th, td { padding: 0 8px; } +.check-cell { width: 35px; text-align: center; } +.number-cell { width: 34px; color: var(--muted-2); text-align: center; } +.drag-cell { width: 42px; color: var(--muted-2); text-align: center; } +tbody tr { cursor: pointer; transition: .12s ease; } +tbody tr:hover { background: rgba(255,255,255,.022); } +tbody tr.active { background: var(--mint-soft); } +tbody tr.dragging { opacity: .42; } +tbody tr.drag-over { box-shadow: inset 0 2px var(--mint); } +td strong, td small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } +td strong { margin-bottom: 3px; color: #d7e2ee; font-size: 10px; } +td small { color: var(--muted-2); font-size: 8px; } +.row-type { display: inline-block; padding: 3px 5px; border-radius: 5px; background: var(--surface-3); color: #7f96b0; font: 8px Consolas, monospace; } +input[type="checkbox"] { accent-color: var(--mint); } +.empty-state { position: absolute; inset: 36px 0 0; display: none; place-content: center; padding: 20px; color: var(--muted); text-align: center; } +.empty-state.show { display: grid; } +.empty-state strong, .empty-state span { display: block; } +.empty-state strong { margin-bottom: 7px; color: #91a2b6; font-size: 11px; } +.empty-state span { color: var(--muted-2); font-size: 9px; } + +.playout-panel { padding-bottom: 12px; } +.preview-stage { position: relative; display: grid; min-height: 255px; margin: 13px; place-items: center; overflow: hidden; border: 1px solid #29405a; border-radius: 9px; background: radial-gradient(circle at 50% 45%, #193552, #08121f 60%); } +.preview-stage::after { position: absolute; inset: 0; background-image: linear-gradient(rgba(65,101,133,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(65,101,133,.08) 1px, transparent 1px); background-size: 24px 24px; content: ""; } +.safe-area { position: relative; z-index: 1; width: 78%; padding: 31px 20px; border: 1px dashed rgba(137,167,195,.24); color: var(--muted); text-align: center; } +.safe-area span, .safe-area strong, .safe-area small { display: block; } +.safe-area span { margin-bottom: 13px; color: var(--mint); font: 8px Consolas, monospace; letter-spacing: .16em; } +.safe-area strong { margin-bottom: 7px; color: #e8f0fa; font-size: 16px; } +.safe-area small { color: #6f839b; font-size: 9px; } +.stage-corner { position: absolute; z-index: 2; width: 20px; height: 20px; border-color: var(--mint); border-style: solid; opacity: .7; } +.top-left { top: 10px; left: 10px; border-width: 1px 0 0 1px; }.top-right { top: 10px; right: 10px; border-width: 1px 1px 0 0; }.bottom-left { bottom: 10px; left: 10px; border-width: 0 0 1px 1px; }.bottom-right { right: 10px; bottom: 10px; border-width: 0 1px 1px 0; } + +.playout-controls { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 6px; padding: 0 13px 12px; } +.playout-controls button { display: flex; min-width: 0; height: 42px; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: #b5c4d5; font-size: 9px; font-weight: 700; cursor: pointer; } +.playout-controls button span { color: var(--muted-2); font: 8px Consolas, monospace; } +.playout-controls button:hover { filter: brightness(1.15); } +.playout-controls .prepare { border-color: rgba(86,168,255,.34); background: rgba(86,168,255,.1); color: #8ec4ff; } +.playout-controls .take-in { border-color: rgba(50,213,164,.38); background: var(--mint-soft); color: var(--mint); } +.playout-controls .take-out { border-color: rgba(255,102,128,.28); background: rgba(255,102,128,.08); color: #ff8fa2; } + +.event-log { display: flex; min-height: 0; flex: 1; flex-direction: column; margin: 0 13px; border: 1px solid var(--border-soft); border-radius: 8px; background: #08131f; overflow: hidden; } +.event-log-header { display: flex; align-items: center; justify-content: space-between; min-height: 33px; padding: 0 10px; border-bottom: 1px solid var(--border-soft); } +.event-log-header strong { color: #7f92aa; font-size: 9px; } +.event-log button { min-height: 22px; padding: 0 7px; border: 0; background: transparent; color: var(--muted-2); font-size: 8px; } +.event-log ol { min-height: 0; margin: 0; padding: 6px 10px 8px 30px; overflow-y: auto; color: #7890aa; font: 9px/1.75 Consolas, monospace; } +.event-log li::marker { color: #40556d; } +.event-log time { margin-right: 8px; color: #455d77; } + +.toast { position: fixed; z-index: 20; right: 22px; bottom: 20px; max-width: 320px; padding: 11px 14px; transform: translateY(25px); border: 1px solid rgba(50,213,164,.28); border-radius: 8px; background: #12273a; box-shadow: var(--shadow); color: #d9f7ef; font-size: 10px; opacity: 0; pointer-events: none; transition: .2s ease; } +.toast.show { transform: translateY(0); opacity: 1; } + +::-webkit-scrollbar { width: 8px; height: 8px; } +::-webkit-scrollbar-track { background: transparent; } +::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: #263a51; background-clip: padding-box; } + +@media (max-width: 1180px) { + .app-shell { grid-template-columns: 178px minmax(0, 1fr); } + .brand-block { padding: 0 14px; } + .console-grid { grid-template-columns: minmax(220px, .8fr) minmax(380px, 1.25fr); height: auto; } + .playout-panel { grid-column: 1 / -1; min-height: 520px; } + .summary-strip { grid-template-columns: repeat(2, 1fr); } +} diff --git a/app.manifest b/app.manifest new file mode 100644 index 0000000..b29247f --- /dev/null +++ b/app.manifest @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + PerMonitorV2 + + + diff --git a/docs/MIGRATION.md b/docs/MIGRATION.md new file mode 100644 index 0000000..16a3ab1 --- /dev/null +++ b/docs/MIGRATION.md @@ -0,0 +1,65 @@ +# MBN_STOCK_N 마이그레이션 현황 + +## 원본 기준선 + +원본은 .NET Framework 4.8 / C# 7.3 기반 WinForms 애플리케이션입니다. 약 38,000줄의 C# 코드와 다음 요소로 구성되어 있습니다. + +- 대형 `MainForm` 및 7개 WinForms UserControl +- 보조 폼 7개 +- Tornado/K3D 장면 처리 클래스 35개 +- Oracle 및 MariaDB SQL/데이터 요청 계층 +- FarPoint Spread 4 플레이리스트/그리드 + +원본 작업 트리의 `MainForm.cs`와 `RES/MmoneyCoder.ini`에는 커밋되지 않은 변경이 있습니다. 원본 저장소는 그대로 보존했으며, 새 프로젝트에는 비밀값이 포함된 INI를 복사하지 않았습니다. + +## 적용 완료 + +| 기존 구현 | 새 구현 | +|---|---| +| WinForms MainForm | WinUI 3 `MainWindow` + 로컬 WebView2 UI | +| FarPoint `FpSpread` 플레이리스트 | HTML table + 선택/드래그 정렬/이동/삭제 | +| 플레이리스트 임시 저장 | WebView2 사용자 데이터 영역의 `localStorage` | +| WinForms 단축키 | Web UI `F2` / `F8` / `Esc` 처리 | +| 직접 DBManager 호출 | Core의 `IDataQueryExecutor` 경계 | +| `Data/Request` SQL 정의 | .NET 8 Core 프로젝트로 71개 이관 | +| AnyCPU/x86 혼재 | 솔루션 및 게시 프로필 x64 단일화 | +| 상대 경로 Web 파일 | MSIX Content 및 안전한 가상 호스트 매핑 | + +WebView는 `https://app.mbn.local` 가상 호스트로 패키지 내부 파일만 제공합니다. 외부 탐색은 WebView 안에서 차단하고 기본 브라우저로 넘기며, 개발자 도구와 기본 컨텍스트 메뉴는 디버거가 연결된 경우에만 활성화합니다. + +## 다음 구현 경계 + +### 데이터베이스 + +- `IDataQueryExecutor`를 구현하는 Oracle/MariaDB 어댑터 +- .NET 8 호환 공급자 선정 및 연결 검증 +- 기존 문자열 조합 SQL의 매개변수화 +- 비동기 실행, 취소, 타임아웃, 재연결 정책 +- Credential Locker/DPAPI 등 승인된 비밀 저장 방식 + +### Tornado/K3D + +- 설치된 x64 COM 타입 라이브러리에서 재현 가능한 Interop 생성 +- `IPlayoutEngine` 경계로 COM 형식 격리 +- STA 호출 직렬화와 프로세스 재연결 +- MSIX 환경의 COM 활성화 및 벤더 재배포 조건 확인 +- 기존 `StartsWith("Tornado2")` 프로세스 탐지 변경 반영 + +### 화면 기능 + +- Oracle 플레이리스트 영구 저장/불러오기 +- 10개 업무 탭의 실제 데이터 바인딩 +- 테마, 전문가, VI, 비교, 수동 그래프 편집기 +- 35개 장면 빌더의 단계별 포팅 +- 실제 Preview 이미지 및 씬/영상 자산 연결 + +## 의도적으로 제외한 항목 + +- WinForms `*.Designer.cs`, `*.resx` +- FarPoint DLL과 라이선스 파일 +- `Interop.K3DAsyncEngineLib.dll` 복사본 +- 원본 `App.config` 바인딩 리디렉션 +- 실제 DB 주소, 계정, 암호가 들어 있는 INI +- Git에서 관리되지 않던 약 212MB의 Tornado 컷/영상 자산 + +이 항목들은 WinUI/WebView/MSIX 경계에 맞춰 재구현하거나, 정식 라이선스 및 운영 자산 위치가 확인된 뒤 어댑터 형태로 연결합니다. diff --git a/src/MBN_STOCK_WEBVIEW.Core/Data/IDataQueryExecutor.cs b/src/MBN_STOCK_WEBVIEW.Core/Data/IDataQueryExecutor.cs new file mode 100644 index 0000000..76870cc --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/Data/IDataQueryExecutor.cs @@ -0,0 +1,45 @@ +#nullable enable + +using System.Data; + +namespace MMoneyCoderSharp.Data; + +/// +/// Identifies a legacy data source without coupling the core project to a provider package. +/// +public enum DataSourceKind +{ + Oracle, + MariaDb +} + +/// +/// Executes a migrated query. Infrastructure code supplies the provider implementation. +/// +public interface IDataQueryExecutor +{ + DataTable Execute(DataSourceKind source, string tableName, string query); +} + +/// +/// Compatibility seam used while the legacy request objects are migrated incrementally. +/// +public static class DataQueryExecutor +{ + private static IDataQueryExecutor? _current; + + public static bool IsConfigured => _current is not null; + + public static IDataQueryExecutor Current => _current + ?? throw new InvalidOperationException( + "A database query executor has not been configured. " + + "Configure the infrastructure adapter before requesting live data."); + + public static void Configure(IDataQueryExecutor executor) + { + ArgumentNullException.ThrowIfNull(executor); + _current = executor; + } + + public static void Reset() => _current = null; +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DBDefine.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DBDefine.cs new file mode 100644 index 0000000..7959e8e --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DBDefine.cs @@ -0,0 +1,353 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp +{ + public static class DBDefine + { + + [Flags] + public enum 요구데이터분류 + { + 지수, + 종목, + 환율, + 업종과동향 + } + + /// + /// Cut_5,10참조 + /// + public enum 선그래프데이터분류 + { + 원달러, + 원엔, + 원위엔, + 원유로, + 코스피수익률, + 코스닥수익률, + 코스피200수익률, + KRX100수익률, + 코스피업종지수수익률, + 코스닥업종지수수익률, + 코스피종목수익률, + 코스닥종목수익률, + 개인매매동향, + 외국인매매동향, + 기관매매동향, + 코스피매매동향, + 코스닥매매동향 + } + + /// + /// Cut_7참조 + /// + public enum 봉차트데이터분류 + { + KOSPI, + KOSDAQ, + KOSPI200, + KRX100, + 선물, + 코스피종목, + 코스닥종목, + 코스피업종지수, + 코스닥업종지수, + 해외지수, + 해외종목, + 거래정지, + 거래정지k + } + + /// + /// Cut_7 세부종목 + /// KRX100, 업종지수는 예상지수가 없음. + /// + public enum 봉차트세부종목 + { + 예상지수, + 일반지수, + 거래량 + } + + /// + /// Cut_8, Cut_9 참조 + /// + public enum 봉차트매매동향 + { + 주체별매매동향, + 코스피매매동향5단, + 코스닥매매동향5단 + } + + + public enum 그리드표그래프종류 + { + 투자자순매수매도상위14번컷, + 프로그램매매13번컷, + 기관순매수현황11번컷, + 지수별매매동향9번컷, + 주체별매매동향8번컷 + } + + + public enum 데이터기간 + { + [StringValue("1")] + 일, + [StringValue("5")] + 주, + [StringValue("20")] + 월, + [StringValue("60")] + 분기, + [StringValue("120")] + 반기, + [StringValue("240")] + 연 + } + + public enum 환율 + { + [StringValue("A09")] + 달러, + + [StringValue("A10")] + 엔, + + [StringValue("A90")] + 위엔, + + [StringValue("A91")] + 유로 + } + + [Flags] + public enum 국내지수종류 + { + KOSPI, KOSDAQ, NXT_KOSPI, NXT_KOSDAQ, KOSPI200, KRX100, 선물 + } + + [Flags] + public enum 국제지수종류 + { + 다우, 나스닥, SP, 독일, 영국, 프랑스, 니케이, 중국상해, 홍콩항셍, 대만가권, + 싱가포르지수, 태국지수, 필리핀지수, 말레이시아지수, 인도네시아지수, 일본, + 유가두바이지수, 유가WTI지수, 유가브랜드유지수, 금지수 + } + + [Flags] + public enum 국내시장종류 + { + KOSPI, KOSDAQ, NXT_KOSPI, NXT_KOSDAQ, 거래정지, 거래정지K + } + + [Flags] + public enum 종목데이터분류 + { + 거래량, PBR, 현재가, 시가, 액면가, 시가총액, + 등락비율, 주52고저, 시간외등락, 예상시가총액최고최저 + } + + [Flags] + public enum 원환율 + { + 원위엔, 원달러, 원엔, 원유로 + } + + [Flags] + public enum 달러환율 + { + 달러엔, 달러유로, 달러위안 + } + + [Flags] + public enum 업종데이터 + { + KOSPI, KOSDAQ, 해외 + } + + [Flags] + public enum 매매동향 + { + 개인, 외국인, 기관, 코스피, 코스닥, 해외종목 + } + + public enum 섹터지수막대그래프분류 + { + 코스피, 코스닥, 다우, 나스닥, SNP + } + + public enum 판1그래프데이터지수류 + { + 예상지수, + 현재지수, + } + + public enum 판1그래프데이터산업및종목류 + { + 종목현재가, + 종목예상체결가, + 종목시간외단일가, + 지수업종 + } + + + public enum 판1그래프데이터해외류 + { + 해외업종, + 해외종목 + } + + public enum 판3데이터분류 + { + 주요지수_코스피_코스닥_코스피200, + 주요지수_코스피_코스닥_선물, + 예상체결지수_코스피_코스닥_코스피200, + 예상체결지수_코스피_코스닥_선물, + 미국지수, + 중화권지수, + 유럽지수, + 아시아지수_상해_대만_일본, + 달러환율_엔_위안_유로, + 원환율_달러_엔_유로, + 미국국채, + 채권금리, + 유가_두바이_WTI_브랜트, + 광물, + 식자재, + 소맥_옥수수_밀, + 대두_콩_현미, + 커피_코코아_설탕, + 생우_비육우_돈육, + 구리_철광석_니켈, + 천연가스_백금_팔라듐, + 납_아연_주석, + 원면_목화, + 국제금, + 국내금 + } + + + public enum 해외지수종류 + { + [StringValue("DJI@DJI")] + 다우, + [StringValue("NAS@IXIC")] + 나스닥, + [StringValue("SPI@SPX")] + SNP, + [StringValue("XTR@DAX30")] + 독일, + [StringValue("LNS@FTSE100")] + 영국, + [StringValue("PAS@CAC40")] + 프랑스, + [StringValue("NII@NI225")] + 니케이, + [StringValue("SHS@000001")] + 중국상해, + [StringValue("HSI@HSI")] + 홍콩항셍, + [StringValue("TWS@TI01")] + 대만가권, + [StringValue("SGI@STI")] + 싱가포르지수, + [StringValue("THI@SET")] + 태국지수, + [StringValue("PHI@COMP")] + 필리핀, + [StringValue("IDI@JKSE")] + 인도네시아, + [StringValue("MYI@KLSE")] + 말레이시아 + } + + public enum 상세판데이터분류 + { + 시가, + 액면가, + PBR, + 거래량 + } + + public enum 지도데이터분류 + { + 글로벌, + 아시아, + 미국, + 유럽 + } + + public enum 데이터5단판지수별 + { + 시가총액, + 상승률, + 하락률, + 신고가52주, + 신저가52주, + 시간외상승률, + 시간외하락률, + 예상가시가총액상위, + 업종, + 코스피200, + 거래량, + ETF + } + + public enum 데이터5단판기타 + { + 전문가추천, + 테마주, + 테마예상 + } + + public static string GetStringValue(this Enum value) + { + // Get the type + Type type = value.GetType(); + + // Get fieldinfo for this type + FieldInfo fieldInfo = type.GetField(value.ToString()); + + // Get the stringvalue attributes + StringValueAttribute[] attribs = fieldInfo.GetCustomAttributes( + typeof(StringValueAttribute), false) as StringValueAttribute[]; + + // Return the first if there was a match. + return attribs.Length > 0 ? attribs[0].StringValue : null; + } + + public class StringValueAttribute : Attribute + { + + #region Properties + + /// + /// Holds the stringvalue for a value in an enum. + /// + public string StringValue { get; protected set; } + + #endregion + + #region Constructor + + /// + /// Constructor used to init a StringValue Attribute + /// + /// + public StringValueAttribute(string value) + { + this.StringValue = value; + } + + #endregion + + } + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataDefineBuilder.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataDefineBuilder.cs new file mode 100644 index 0000000..bca556e --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataDefineBuilder.cs @@ -0,0 +1,131 @@ +using MMoneyCoderSharp.DB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.Data +{ + + /// + /// 데이터의 입/출력에 관한 정의를 위해 만든 추상화 빌더객체. + /// 필요한 데이터를 순서대로 빌드 할 수 있도록 리턴값으로 유도하고, + /// 모든 데이터가 있다면 최종적인 객체를 Struct형태로 리턴이 가능하도록 유도한다. + /// + /// 내부의 데이터에 관련된 내용은 enum으로 정의하고 Int로 최종적으로 리턴받아 멤버변수로 보유한다. + /// + /// 20210207 규합할수 없는 부분(지수와 종목의 쿼리합)에 대한 정의가 불가능하여 버린다. + /// 데이터를 기반으로 씬에 접근하려는 계획은 포기해야겠다. 이미 쿼리 자체가 그래픽에 파편화되어있어서 데이터를 기반으로 추상화 하기 불가능하다. + /// + public class DataDefineBuilder + { + + // protected int mBuildedIntValue = 0; + + // public static DataDefineBuilder setDefine(요구데이터분류 requestDataType) + // { + + // switch (requestDataType) + // { + // case 요구데이터분류.환율 : + // return new 환율분류(); + + // case 요구데이터분류.종목: + // return new 종목(); + + // case 요구데이터분류.지수: + // return new 지수(); + + // default: + // return null; + + // } + + // } + + //#region "환율" + + // public class 환율분류 : DataDefineBuilder, IBuilderDefined + // { + + // private Exchange mRequestInstance = null; + + // private 원환율? mExchangeValueWON; + + // private 달러환율? mExchangeValueDOLLOR; + + // private bool mIsLastDataRequest = false; + + // public void build() + // { + + // if (mExchangeValueWON.HasValue) + // { + // //this.mBuildedIntValue = (int)mRecvEnum; + // } + // else + // { + // throw new Exception("환율분류 잘못된 빌드시도"); + // } + + // } + + // public static DataDefineBuilder setDefine(원환율 requestDataType) + // { + // switch(requestDataType) + // { + // case 원환율.원달러: + // return new Exchange(); + // case 환율기준통화.달러: + // return new 달러기준환율(); + // default: + // return null; + // } + + // } + + // public static DataDefineBuilder setDefine(달러환율 requestDataType) + // { + + + // } + + // public DataDefineBuilder IsNeedLastDataList(bool recvNeedLastData) + // { + // this.mIsLastDataRequest = recvNeedLastData; + // } + + // } + + + //#endregion + + // public class 지수빌더 : DataDefineBuilder + // { + + // } + + // public class 종목빌더 : DataDefineBuilder + // { + + // } + + // public class 업종과동향빌더 : DataDefineBuilder + // { + + // } + + + // } + + // public interface IBuilderDefined + // { + // void build(); + // } + + + } + +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataManager.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataManager.cs new file mode 100644 index 0000000..437780f --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/DataManager.cs @@ -0,0 +1,665 @@ +using MMoneyCoderSharp.Data.Request; +using MMoneyCoderSharp.Data.Request.봉차트; +using MMoneyCoderSharp.DB; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +//using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.Data +{ + /// + /// 씬단위로 요청사항을 매핑해서 DB에서 받은 데이터를 리턴해줄 매니저 객체. + /// + public class DataManager + { + + + #region "싱글턴" + private static volatile DataManager mInstance = null; + + private static object mSingletonLocker = new object(); + + private DataManager() + { + + } + + public static DataManager getInstance() + { + lock (mSingletonLocker) + { + if (mInstance == null) + { + mInstance = new DataManager(); + } + } + + return mInstance; + } + + #endregion + + + /// + /// 스탁포멧정리기준.hwp로 컷 대 기준을 작성함. + /// 1. 1열판 기본 -> 판그래프데이터참조 + /// 2. 2열판 상세 -> 판그래프데이터참조 + /// 3. 2열판 기본 -> 판그래프데이터참조 + /// 4. 3열판 그래프 -> 판3데이터분류 + /// 5. 라인그래프 -> 선그래프데이터분류 + /// 6. 캔들차트 -> 봉차트데이터분류 + /// 7. 캔들차트 -> 봉차트데이터분류 + /// 8. 주체별매매동향 -> 그리드표 + /// 9. 지수별매매동향 -> 그리드표 + /// 10. 매매동향선그래프 -> 선그래프데이터분류 + /// 11. 기관순매수현황 -> 그리드표 + /// 12. 매매동향막대그래프 -> 막대그래프데이터분류 + /// 13. 프로그램매매 표그래프 -> 그리드표 + /// 14. 외국인투자자 순매도 상위 -> 쿼리가 없음 + /// 15~18 -> 지도그래프 + /// 19. 이미지 그래프 -> 아직안함 + /// 20. 네모그래프 -> 네모그래프 + /// 21. 섹터지수 막대그래프 -> 막대그래프데이터분류 + /// 22. 캔들차트 두개 -> 이거 고민되네.. + /// 23. 선그래프 두개 -> 이거도 고민되네.. + /// 24. 종목별 수익률 -> 선그래프데이터분류(아직안함) + /// 25. 5단그래프 -> + /// 26. 호가창 + /// 27. 거래원 + /// 28. 수급동향 + /// 29. 매출구성 원그래프 + /// 30. 성장지표 선그래프 + /// 31. 종목매출액 막대그래프 -> 쿼리가 없음 + /// 32. 영업이익 막대그래프 -> 쿼리가 없음 + /// + + + private DataSet mStockInfoDataSet = null; + + public DataSet getStocksInfoTable() + { + + if (mStockInfoDataSet == null) + { + updateStocksInfoSet(); + } + + return mStockInfoDataSet; + + } + + + public void updateStocksInfoSet() + { + + string sql = string.Empty; + + mStockInfoDataSet = new DataSet(); + + DataTable bufTableKospi = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "코스피", "SELECT F_STOCK_WANNAME, F_STOCK_CODE FROM T_STOCK WHERE F_MKT_HALT = 'N'"); + mStockInfoDataSet.Tables.Add(bufTableKospi); + + DataTable bufTableKosdaq = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "코스닥", "SELECT F_STOCK_WANNAME, F_STOCK_CODE FROM T_KOSDAQ_STOCK WHERE F_MKT_HALT = 'N'"); + mStockInfoDataSet.Tables.Add(bufTableKosdaq); + + DataTable bufTableNXTKospi = DataQueryExecutor.Current.Execute(DataSourceKind.MariaDb, "NXT코스피", "SELECT CONCAT(F_STOCK_NAME, '(NXT)') F_STOCK_NAME, F_STOCK_CODE FROM N_STOCK WHERE F_STOP_GUBUN = 'N'"); + mStockInfoDataSet.Tables.Add(bufTableNXTKospi); + + DataTable bufTableNXTKosdaq = DataQueryExecutor.Current.Execute(DataSourceKind.MariaDb, "NXT코스닥", "SELECT CONCAT(F_STOCK_NAME, '(NXT)') F_STOCK_NAME, F_STOCK_CODE FROM N_KOSDAQ_STOCK WHERE F_STOP_GUBUN = 'N'"); + mStockInfoDataSet.Tables.Add(bufTableNXTKosdaq); + + DataTable bufTableForgien = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "해외", "SELECT F_KNAM, F_SYMB FROM T_WORLD_IX_EQ_MASTER"); + mStockInfoDataSet.Tables.Add(bufTableForgien); + + DataTable bufTableKOSPI_INDUSTRY = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "코스피업종", "select a.f_part_code, b.f_part_name from t_index a, t_part b where a.f_part_code = b.f_part_code order by a.f_part_code"); + mStockInfoDataSet.Tables.Add(bufTableKOSPI_INDUSTRY); + + DataTable bufTableKOSDAQ_INDUSTRY = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "코스닥업종", "select a.f_part_code, b.f_part_name from t_kosdaq_index a, t_kosdaq_part b where a.f_part_code = b.f_part_code order by a.f_part_code"); + mStockInfoDataSet.Tables.Add(bufTableKOSDAQ_INDUSTRY); + + DataTable bufTableKFORGIEN_INDUSTRY = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "해외업종", "select F_INPUT_NAME, f_knam, f_symb from t_world_ix_eq_master WHERE f_fdtc = '0' and f_natc = 'US' ORDER BY F_KNAM"); + mStockInfoDataSet.Tables.Add(bufTableKFORGIEN_INDUSTRY); + + DataTable bufTableKFORGIEN_INDEX = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "해외지수", "select F_SYMB, F_KNAM, F_ENAM, F_INPUT_NAME from t_world_ix_eq_master WHERE F_FDTC = '0'"); + mStockInfoDataSet.Tables.Add(bufTableKFORGIEN_INDEX); + + DataTable bufTableKFORGIEN_STOCK = DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, "해외종목", "select F_INPUT_NAME, f_symb from t_world_ix_eq_master WHERE f_fdtc = '1' and (f_natc = 'US' or f_natc = 'TW') ORDER BY F_INPUT_NAME"); + mStockInfoDataSet.Tables.Add(bufTableKFORGIEN_STOCK); + + } + + + /// + /// 선그래프 데이터 요청 메서드 + /// 마지막 매개변수는 종목일때는 한글종목명, 지수일때는 분류코드. + /// + /// 여기가 기존 코드 중 cut_5,10으로 검색해서 나오는 데이터 모두. + /// + /// + /// 선그래프씬 데이터 분류 + /// 선그래프씬 데이터 길이 + /// 종목은 해당 종목의 한글명으로, 지수는 코드값으로.... + /// + public DataSet createLineGraphData(선그래프데이터분류 recvDataType, 데이터기간 recvDataLength, string recvArgData = null) + { + + IDataRequest bufInstance = null; + + switch (recvDataType) + { + case 선그래프데이터분류.원달러: + bufInstance = new Exchange(환율.달러, recvDataLength); + break; + case 선그래프데이터분류.원엔: + bufInstance = new Exchange(환율.엔, recvDataLength); + break; + case 선그래프데이터분류.원위엔: + bufInstance = new Exchange(환율.위엔, recvDataLength); + break; + case 선그래프데이터분류.원유로: + bufInstance = new Exchange(환율.유로, recvDataLength); + break; + case 선그래프데이터분류.코스피수익률: + bufInstance = new IndexYield(recvDataLength, 국내지수종류.KOSPI); + break; + case 선그래프데이터분류.코스닥수익률: + bufInstance = new IndexYield(recvDataLength, 국내지수종류.KOSDAQ); + break; + case 선그래프데이터분류.코스피200수익률: + bufInstance = new IndexYield(recvDataLength, 국내지수종류.KOSPI200); + break; + case 선그래프데이터분류.KRX100수익률: + bufInstance = new IndexYield(recvDataLength, 국내지수종류.KRX100); + break; + case 선그래프데이터분류.코스피업종지수수익률: + bufInstance = new IndexIndustryYield(recvArgData, recvDataLength, 국내시장종류.KOSPI); + break; + case 선그래프데이터분류.코스닥업종지수수익률: + bufInstance = new IndexIndustryYield(recvArgData, recvDataLength, 국내시장종류.KOSDAQ); + break; + case 선그래프데이터분류.코스피종목수익률: + bufInstance = new StockYield(recvArgData, recvDataLength, 국내시장종류.KOSPI); + break; + case 선그래프데이터분류.코스닥종목수익률: + bufInstance = new StockYield(recvArgData, recvDataLength, 국내시장종류.KOSDAQ); + break; + case 선그래프데이터분류.개인매매동향: + case 선그래프데이터분류.기관매매동향: + case 선그래프데이터분류.외국인매매동향: + case 선그래프데이터분류.코스피매매동향: + case 선그래프데이터분류.코스닥매매동향: + bufInstance = new Trading(recvDataType); + break; + default: + break; + } + + bufInstance.buildData(); + + return bufInstance.getResult(); + + } + + /// + /// 봉차트를 위한데이터 + /// 종목과 업종지수 모두 추가 데이터로는 Code를 받는다. + /// + /// 기존 코드에서 6,7컷부분 + /// + /// + /// + /// + /// 종목은 코드값 지수는 한글명.. + /// + public DataSet createCandleChartData(봉차트데이터분류 recvDataTypeMain, 봉차트세부종목 recvDataTypeSub, 데이터기간 recvDataLength, string recvArgData = null) + { + + IDataRequest bufInstance = null; + + switch (recvDataTypeMain) + { + case 봉차트데이터분류.KOSPI: + bufInstance = new CandleKOSPI(recvDataTypeSub, recvDataLength); + break; + case 봉차트데이터분류.KOSDAQ: + bufInstance = new CandleKOSDAQ(recvDataTypeSub, recvDataLength); + break; + case 봉차트데이터분류.KOSPI200: + bufInstance = new CandleKOSPI200(recvDataTypeSub, recvDataLength); + break; + case 봉차트데이터분류.KRX100: + bufInstance = new CandleKRX100(recvDataTypeSub, recvDataLength); + break; + case 봉차트데이터분류.선물: + bufInstance = new CandleFutures(recvDataTypeSub, recvDataLength); + break; + case 봉차트데이터분류.코스피종목: + bufInstance = new CandleStockKOSPI(recvDataTypeSub, recvDataLength, recvArgData); + break; + case 봉차트데이터분류.코스닥종목: + bufInstance = new CandleStockKOSDAQ(recvDataTypeSub, recvDataLength, recvArgData); + break; + case 봉차트데이터분류.코스피업종지수: + bufInstance = new CandleIndustryKOSPI(recvDataTypeSub, recvDataLength, recvArgData); + break; + case 봉차트데이터분류.코스닥업종지수: + bufInstance = new CandleIndustryKOSDAQ(recvDataTypeSub, recvDataLength, recvArgData); + break; + + case 봉차트데이터분류.해외지수: + bufInstance = new Candleforeign(recvDataTypeSub, recvDataLength, recvArgData); + break; + + case 봉차트데이터분류.해외종목: + bufInstance = new CandleforeignStock(recvDataTypeSub, recvDataLength, recvArgData); + break; + + case 봉차트데이터분류.거래정지: + bufInstance = new CandleStockDIS(recvDataTypeSub, recvDataLength, recvArgData); + + break; + + case 봉차트데이터분류.거래정지k: + bufInstance = new CandleStockDISK(recvDataTypeSub, recvDataLength, recvArgData); + + break; + default: + break; + } + + bufInstance.buildData(); + + return bufInstance.getResult(); + + } + + /// + /// 그리드표 그래프 데이터 + /// 컷14번은 쿼리가 없음 + /// + /// + /// + public DataSet createGridChartData(그리드표그래프종류 recvDataType, 국내시장종류? recvMarketType = null) + { + IDataRequest bufInstance = null; + + switch (recvDataType) + { + case 그리드표그래프종류.투자자순매수매도상위14번컷: + throw new Exception("쿼리가 없음"); + //break; + case 그리드표그래프종류.프로그램매매13번컷: + bufInstance = new Grid13(); + break; + case 그리드표그래프종류.기관순매수현황11번컷: + bufInstance = new Grid11(); + break; + case 그리드표그래프종류.지수별매매동향9번컷: + bufInstance = new Grid9(recvMarketType.Value); + break; + case 그리드표그래프종류.주체별매매동향8번컷: + bufInstance = new Grid8(); + break; + } + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + /// + /// 20번컷 사각그래프용 데이터. + /// 국내시장 업종별 네모그래프 + /// 15개종목이 이미 정해져있음.(선택불가) + /// + /// 시장종류 + /// + public DataSet createSquareChartData_Cut20(국내시장종류 recvDataType) + { + + IDataRequest bufInstance = new Square20(recvDataType); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + /// + /// 12번컷 데이터. + /// HWP 표와는 다르게 선물은 없음. + /// + /// + /// + public DataSet createCut12StickData(국내시장종류 recvDataType) + { + IDataRequest bufInstance = new Stick12(recvDataType); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + /// + /// 21번컷 데이터. + /// 12번과 헷갈리지 말 것 + /// + /// + /// + public DataSet createCut21StickData(섹터지수막대그래프분류 recvDataType) + { + IDataRequest bufInstance = new Stick21(recvDataType); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + + + public DataSet createWorldMapData(지도데이터분류 recvDataType) + { + IDataRequest bufInstance = null; + + switch (recvDataType) + { + case 지도데이터분류.글로벌: + bufInstance = new MapWorld(); + break; + case 지도데이터분류.아시아: + bufInstance = new MapAsia(); + break; + case 지도데이터분류.미국: + bufInstance = new MapUSA(); + break; + case 지도데이터분류.유럽: + bufInstance = new MapEurope(); + break; + default: + break; + } + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + #region "판데이터" + + /// + /// 1열판 국내지수류 데이터 + /// + /// + /// + /// + public DataSet createPlateData(판1그래프데이터지수류 recvDataList, 국내지수종류 recvDataType) + { + IDataRequest bufInstance = null; + + switch (recvDataList) + { + case 판1그래프데이터지수류.현재지수: + bufInstance = new INDEX_PAN(recvDataType); + break; + case 판1그래프데이터지수류.예상지수: + bufInstance = new INDEX_FORECAST_PAN(recvDataType); + break; + } + + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + /// + /// 1열판 산업종목류 데이터 + /// + /// + /// + /// + /// + public DataSet createPlateData(판1그래프데이터산업및종목류 recvDataList, 국내시장종류 recvDataType, string recvDataCode) + { + IDataRequest bufInstance = null; + Nxt_IDataRequest Nxt_bufInstance = null; + + switch (recvDataList) + { + case 판1그래프데이터산업및종목류.종목현재가: + if ((recvDataType == 국내시장종류.NXT_KOSPI) || (recvDataType == 국내시장종류.NXT_KOSDAQ)) + Nxt_bufInstance = new Nxt_STOCK_PAN(recvDataType, recvDataCode); + else + bufInstance = new STOCK_PAN(recvDataType, recvDataCode); + break; + case 판1그래프데이터산업및종목류.종목예상체결가: + bufInstance = new STOCK_FORECAST_PAN(recvDataType, recvDataCode); + break; + case 판1그래프데이터산업및종목류.종목시간외단일가: + bufInstance = new STOCK_OVERTIME_PAN(recvDataType, recvDataCode); + break; + case 판1그래프데이터산업및종목류.지수업종: + bufInstance = new INDUSTRY_PAN(recvDataType, recvDataCode); + break; + } + + if ((recvDataType == 국내시장종류.NXT_KOSPI) || (recvDataType == 국내시장종류.NXT_KOSDAQ)) + { + Nxt_bufInstance.Nxt_buildData(); + return Nxt_bufInstance.Nxt_getResult(); + } + else + { + bufInstance.buildData(); + return bufInstance.getResult(); + } + + } + + /// + /// 1열판 해외산업종목 데이터 + /// + /// + /// + /// + public DataSet createPlateData(판1그래프데이터해외류 recvDataList, string recvDataCode) + { + IDataRequest bufInstance = null; + + switch (recvDataList) + { + case 판1그래프데이터해외류.해외업종: + bufInstance = new INDUSTRY_FORGIEN_PAN(recvDataCode); + break; + case 판1그래프데이터해외류.해외종목: + bufInstance = new STOCK_FORGIEN_PAN(recvDataCode); + break; + } + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + /// + /// 1열판해외지수류 데이터 + /// + /// + /// + public DataSet createPlateData(해외지수종류 recvDataList, string recvDataCode) + { + IDataRequest bufInstance = new INDEX_FORGIEN_PAN(recvDataList, recvDataCode); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + /// + /// 1열판원환율 + /// + /// + /// + public DataSet createPlateData(원환율 recvDataList) + { + IDataRequest bufInstance = new EXCHANGE_PAN(recvDataList); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + public DataSet createPlate3Data_Cut4(판3데이터분류 recvDataList) + { + IDataRequest bufInstance = new DataObject_3PAN(recvDataList); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + public DataSet createPlateData(국내시장종류 recvDataType1, 상세판데이터분류 recvDataType2, string recvStockCode) + { + IDataRequest bufInstance = new SANGSE_PAN(recvDataType1, recvDataType2, recvStockCode); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + public DataSet createPlateNxtData(국내시장종류 recvDataType1, 상세판데이터분류 recvDataType2, string recvStockCode) + { + Nxt_IDataRequest bufInstance = new Nxt_SANGSE_PAN(recvDataType1, recvDataType2, recvStockCode); + + bufInstance.Nxt_buildData(); + + return bufInstance.Nxt_getResult(); + } + + + #endregion + + + public DataSet createCut26Data(국내시장종류 recvDataType1, string recvStockCode) + { + IDataRequest bufInstance = new Quote_Stocks(recvDataType1, recvStockCode); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + public DataSet createCut27Data(국내시장종류 recvDataType1, string recvStockCode) + { + IDataRequest bufInstance = new Trader_Stocks(recvDataType1, recvStockCode); + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + public DataSet create5DanDataIndex(국내시장종류 recvDataType1, 데이터5단판지수별 recvDataType2) + { + IDataRequest bufInstance = null; + + switch (recvDataType2) + { + + case 데이터5단판지수별.하락률: + bufInstance = new lower_5dan(recvDataType1); + break; + case 데이터5단판지수별.신고가52주: + bufInstance = new high52_5dan(recvDataType1); + break; + case 데이터5단판지수별.신저가52주: + bufInstance = new low52_5dan(recvDataType1); + break; + case 데이터5단판지수별.시간외상승률: + bufInstance = new high_overtime_5dan(recvDataType1); + break; + case 데이터5단판지수별.시간외하락률: + bufInstance = new low_overtime_5dan(recvDataType1); + break; + case 데이터5단판지수별.예상가시가총액상위: + bufInstance = new capital_forecast_5dan(recvDataType1); + break; + case 데이터5단판지수별.업종: + bufInstance = new upjong_5dan(recvDataType1); + break; + case 데이터5단판지수별.시가총액: + bufInstance = new capital_5dan(recvDataType1); + break; + case 데이터5단판지수별.상승률: + bufInstance = new upper_5dan(recvDataType1); + break; + case 데이터5단판지수별.코스피200: + bufInstance = new kospi200(recvDataType1); + break; + case 데이터5단판지수별.ETF: + bufInstance = new ETF(recvDataType1); + + break; + } + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + public DataSet Nxt_create5DanDataIndex(국내시장종류 recvDataType1, 데이터5단판지수별 recvDataType2) + { + Nxt_IDataRequest Nxt_bufInstance = null; + + switch (recvDataType2) + { + case 데이터5단판지수별.상승률: + Nxt_bufInstance = new Nxt_upper_5dan(recvDataType1); + break; + case 데이터5단판지수별.하락률: + Nxt_bufInstance = new Nxt_lower_5dan(recvDataType1); + break; + case 데이터5단판지수별.거래량: + Nxt_bufInstance = new Nxt_vol_5dan(recvDataType1); + break; + case 데이터5단판지수별.시간외상승률: + Nxt_bufInstance = new Nxt_high_overtime_5dan(recvDataType1); + break; + case 데이터5단판지수별.시간외하락률: + Nxt_bufInstance = new Nxt_low_overtime_5dan(recvDataType1); + break; + case 데이터5단판지수별.시가총액: + Nxt_bufInstance = new Nxt_capital_5dan(recvDataType1); + break; + } + + Nxt_bufInstance.Nxt_buildData(); + + return Nxt_bufInstance.Nxt_getResult(); + } + + public DataSet create5DanDataTheme(데이터5단판기타 recvDataType2, List 테마주코드리스트) + { + IDataRequest bufInstance = null; + + switch (recvDataType2) + { + case 데이터5단판기타.전문가추천: + bufInstance = new suggest_5dan(테마주코드리스트); + break; + case 데이터5단판기타.테마주: + bufInstance = new theme_5dan(테마주코드리스트); + break; + case 데이터5단판기타.테마예상: + bufInstance = new theme_yesang_5dan(테마주코드리스트); + break; + } + + bufInstance.buildData(); + + return bufInstance.getResult(); + } + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/IDBDataHandle.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/IDBDataHandle.cs new file mode 100644 index 0000000..870e3e2 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/IDBDataHandle.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp +{ + /// + /// 콜백 인터페이스 + /// + public interface IDBDataHandle + { + + void onDataReceived(); + + void onDBError(); + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/ADataObject.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/ADataObject.cs new file mode 100644 index 0000000..7de9200 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/ADataObject.cs @@ -0,0 +1,52 @@ +using MMoneyCoderSharp.DB; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MMoneyCoderSharp.Data; + +namespace MMoneyCoderSharp.Data.Request +{ + /// + /// Data Access Object + /// + public abstract class ADataObject : IDataRequest + { + + public ADataObject() + { + mRequestQuery = new Dictionary(); + mReturnDataSet = new DataSet(); + } + + /// + /// 완성되어 DB로 전송될 쿼리 + /// + protected Dictionary mRequestQuery = new Dictionary(); + + /// + /// 완성되어 결과를 리턴할 데이터 셋 + /// + protected DataSet mReturnDataSet = null; + + public string getQuery(string tableName) + { + return mRequestQuery[tableName]; + } + + public abstract IDataRequest buildData(); + + public DataSet getResult() + { + foreach (KeyValuePair item in mRequestQuery) + { + mReturnDataSet.Tables.Add( + DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, item.Key, item.Value)); + } + + return mReturnDataSet; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/IDataRequest.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/IDataRequest.cs new file mode 100644 index 0000000..89c4534 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/IDataRequest.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request +{ + public interface IDataRequest + { + + string getQuery(string recvTableName); + + DataSet getResult(); + + IDataRequest buildData(); + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_ADataObject.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_ADataObject.cs new file mode 100644 index 0000000..fa7823c --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_ADataObject.cs @@ -0,0 +1,53 @@ +using MMoneyCoderSharp.Data.Request; +using MMoneyCoderSharp.DB; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MMoneyCoderSharp.Data; + +namespace MMoneyCoderSharp.Data.Request +{ + /// + /// Data Access Object + /// + public abstract class Nxt_ADataObject : Nxt_IDataRequest + { + + public Nxt_ADataObject() + { + Nxt_mRequestQuery = new Dictionary(); + Nxt_mReturnDataSet = new DataSet(); + } + + /// + /// 완성되어 DB로 전송될 쿼리 + /// + protected Dictionary Nxt_mRequestQuery = new Dictionary(); + + /// + /// 완성되어 결과를 리턴할 데이터 셋 + /// + protected DataSet Nxt_mReturnDataSet = null; + + public string Nxt_getQuery(string tableName) + { + return Nxt_mRequestQuery[tableName]; + } + + public abstract Nxt_IDataRequest Nxt_buildData(); + + public DataSet Nxt_getResult() + { + foreach (KeyValuePair item in Nxt_mRequestQuery) + { + Nxt_mReturnDataSet.Tables.Add( + DataQueryExecutor.Current.Execute(DataSourceKind.MariaDb, item.Key, item.Value)); + } + + return Nxt_mReturnDataSet; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_IDataRequest.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_IDataRequest.cs new file mode 100644 index 0000000..82334a4 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/Nxt_IDataRequest.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request +{ + public interface Nxt_IDataRequest + { + + string Nxt_getQuery(string recvTableName); + + DataSet Nxt_getResult(); + + Nxt_IDataRequest Nxt_buildData(); + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/거래원/trader_stocks.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/거래원/trader_stocks.cs new file mode 100644 index 0000000..5aa7ae3 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/거래원/trader_stocks.cs @@ -0,0 +1,263 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Trader_Stocks : ADataObject + { + + internal Trader_Stocks(국내시장종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + + this.mStockCode = recvStockCode; + } + + 국내시장종류 mDataType; + + string mStockCode = ""; + + #region 쿼리 + //코스피 상단 + string queryKOSPI상단 = @"SELECT DISTINCT b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_curr_price CURR_PRICE, + a.f_net_chg NET_CHG, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_stock_wanname in('{0}')"; + + + string queryKOSPI매도 = @"select f_sale_nick_kname sale_name, f_sell_vol sell_vol + from( + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_1 f_sell_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_1 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_2 f_sell_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_2 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_3 f_sell_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_3 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_4 f_sell_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_4 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_5 f_sell_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_5 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + ) + order by f_sell_vol desc"; + + string queryKOSPI매수 = @"select f_sale_nick_kname sale_name, f_buy_vol buy_vol + from( + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_1 f_buy_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_1 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_2 f_buy_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_2 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_3 f_buy_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_3 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_4 f_buy_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_4 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_5 f_buy_vol + from t_dealer a, t_sale_member b, t_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_5 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + ) + order by f_buy_vol desc"; + + string queryKOSDAQ상단 = @"SELECT DISTINCT b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_curr_price CURR_PRICE, + a.f_net_chg NET_CHG, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_stock_wanname in('{0}')"; + + string queryKOSDAQ매도 = @"select f_sale_nick_kname sale_name, f_sell_vol sell_vol + from( + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_1 f_sell_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_1 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_2 f_sell_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_2 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_3 f_sell_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_3 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_4 f_sell_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_4 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_sell_dealer_vol_5 f_sell_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_sell_dealer_no_5 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + ) + order by f_sell_vol desc"; + + string queryKOSDAQ매수 = @"select f_sale_nick_kname sale_name, f_buy_vol buy_vol + from( + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_1 f_buy_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_1 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_2 f_buy_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_2 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_3 f_buy_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_3 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_4 f_buy_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_4 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + union + select a.f_stock_code, + b.f_sale_nick_kname, a.f_buy_dealer_vol_5 f_buy_vol + from t_kosdaq_dealer a, t_sale_member b, t_kosdaq_stock c + where c.f_stock_wanname = '{0}' + and c.f_mkt_halt = 'N' + and a.f_buy_dealer_no_5 = b.f_sale_no + and a.f_stock_code = c.f_stock_code + ) + order by f_buy_vol desc"; + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("상단", String.Format(queryKOSPI상단, this.mStockCode)); + mRequestQuery.Add("매도", String.Format(queryKOSPI매도, this.mStockCode)); + mRequestQuery.Add("매수", String.Format(queryKOSPI매수, this.mStockCode)); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("상단", String.Format(queryKOSDAQ상단, this.mStockCode)); + mRequestQuery.Add("매도", String.Format(queryKOSDAQ매도, this.mStockCode)); + mRequestQuery.Add("매수", String.Format(queryKOSDAQ매수, this.mStockCode)); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid11.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid11.cs new file mode 100644 index 0000000..6f1f66e --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid11.cs @@ -0,0 +1,67 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Grid11 : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"select '코스피' name, + decode(f_invest_code, '1000', '증권', '2000', '보험', + '3000', '투신', + '4000', '은행', '6000', '기금') invest_name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '4000', '6000') + group by decode(f_invest_code, '1000', '증권', '2000', '보험', + '3000', '투신', + '4000', '은행', '6000', '기금') + union + select '코스닥' name, + decode(f_invest_code, '1000', '증권', '2000', '보험', + '3000', '투신', + '4000', '은행', '6000', '기금') invest_name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '4000', '6000') + group by decode(f_invest_code, '1000', '증권', '2000', '보험', + '3000', '투신', + '4000', '은행', '6000', '기금') + union + select '코스피200' name, + decode(f_invest_code, '1000', '증권', '2000', '보험', + '3000', '투신', + '4000', '은행', '6000', '기금') invest_name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_invest + where F_PART_CODE = '029' + and F_INVEST_CODE in('1000', '2000', '3000', '4000', '6000') + group by decode(f_invest_code, '1000', '증권', '2000', '보험', + '3000', '투신', + '4000', '은행', '6000', '기금')"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid13.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid13.cs new file mode 100644 index 0000000..b1159c0 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid13.cs @@ -0,0 +1,76 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Grid13 : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"select '차익' name, + round(((F_CCON_BUY_W_AMT + F_CCON_BUY_J_AMT) - (F_CCON_SELL_W_AMT + F_CCON_SELL_J_AMT)) / 100000000) part_idx + from t_pgm_tot + union + select '비차익' name, + round(((F_BCON_BUY_W_AMT + F_BCON_BUY_J_AMT) - (F_BCON_SELL_W_AMT + F_BCON_SELL_J_AMT)) / 100000000) part_idx + from t_pgm_tot + union + select '순매수' name, + round((((F_BCON_BUY_W_AMT + F_BCON_BUY_J_AMT) - (F_BCON_SELL_W_AMT + F_BCON_SELL_J_AMT)) + + ((F_CCON_BUY_W_AMT + F_CCON_BUY_J_AMT) - (F_CCON_SELL_W_AMT + F_CCON_SELL_J_AMT))) / 100000000) part_idx + from t_pgm_tot + union + SELECT '코스피200' name, decode(f_chg_type, '-', (f_part_idx / 100) * -1, f_part_idx / 100) part_idx + FROM T_200_INDEX + WHERE f_part_code = '029' + union + SELECT '선물' name, decode(chg_type, '-', part_idx * -1, part_idx) part_idx + FROM(SELECT f_curr_price / 100 part_idx, + decode(sign(f_curr_price - f_base_price), 1, '+', -1, '-', 0, ' ') chg_type + FROM t_sunmul_online + WHERE f_stock_code = (select f_stock_code from t_sunmul_batch + where f_market_date = (select max(f_market_date) + from t_sunmul_batch) + and substr(f_stock_code, 4, 1) = '1' + and F_MONTH_GUBUN = '1') + ) + union + select '베이시스' name, + b.part_idx - a.part_idx part_idx + from + (SELECT '코스피200' name, decode(f_chg_type, '-', (f_part_idx / 100) * -1, f_part_idx / 100) part_idx + FROM T_200_INDEX + WHERE f_part_code = '029') A, + (SELECT '선물' name, decode(chg_type, '-', part_idx * -1, part_idx) part_idx + FROM(SELECT f_curr_price / 100 part_idx, + decode(sign(f_curr_price - f_base_price), 1, '+', -1, '-', 0, ' ') chg_type + FROM t_sunmul_online + WHERE f_stock_code = (select f_stock_code from t_sunmul_batch + where f_market_date = (select max(f_market_date) + from t_sunmul_batch) + and substr(f_stock_code, 4, 1) = '1' + and F_MONTH_GUBUN = '1') + )) B"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid14.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid14.cs new file mode 100644 index 0000000..a51b90d --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid14.cs @@ -0,0 +1,33 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Grid14 : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @""; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid8.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid8.cs new file mode 100644 index 0000000..7977941 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid8.cs @@ -0,0 +1,70 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Grid8 : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"select + name, + sum(decode(invest, '개인', org_amt, 0)) ""개인"", + sum(decode(invest, '외국인', org_amt, 0)) ""외국인"", + sum(decode(invest, '기관', org_amt, 0)) ""기관"" + from( + select + 1 s, + '코스피' name, + decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관') invest, + round((sum(F_SELL_turnover) / 100000000) - (sum(F_BUY_turnover) / 100000000)) as org_amt + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관') + UNION + select + 2 s, + '코스닥' name, + decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관') invest, + round((sum(F_SELL_turnover) / 100000000) - (sum(F_BUY_turnover) / 100000000)) as org_amt + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관') + UNION + select + 3 s, + '코스피200' name, + decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관') invest, + round((sum(F_SELL_turnover) / 100000000) - (sum(F_BUY_turnover) / 100000000)) as org_amt + from t_invest + where F_PART_CODE = '029' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관') + ) + group by name, s + order by s"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid9.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid9.cs new file mode 100644 index 0000000..be24a0c --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/그리드/Grid9.cs @@ -0,0 +1,232 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Grid9 : ADataObject + { + + public Grid9(국내시장종류 recvMarketType) + { + this.mMarketType = recvMarketType; + } + + private 국내시장종류 mMarketType; + + /// + /// 금일 데이터 쿼리 + /// + string queryKOSPIList = @"select + (select max(open_day) from v_open_day) f_data_time, + P_1 ""개인"", + P_2 ""외국인"", + P_3 ""기관"" + FROM( + select + sum(decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_1, + sum(decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_2, + sum(decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000))) p_3 + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by f_invest_code + ) + UNION + select + f_data_time, + sum(p_1) ""개인"", + sum(p_2) ""외국인"", + sum(p_3) ""기관"" + from( + select + substr(f_data_time, 1, 8) f_data_time, + decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_1, + decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_2, + decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000)) p_3 + from t_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + and f_data_time in ( + select data_time || '1535' + from(select open_day data_time from v_open_day + minus + select substr(f_data_time, 1, 8) data_time + from t_index + where f_part_code = '001' + order by data_time desc + ) + where rownum< 5 + ) + group by f_data_time, f_invest_code + ) + group by f_data_time + order by f_data_time desc"; + + string queryKOSPISum = @"select + sum(p_1) ""개인"", + sum(p_2) ""외국인"", + sum(p_3) ""기관"" + from( + select + sum(decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_1, + sum(decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_2, + sum(decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000))) p_3 + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by f_invest_code + union + select + sum(p_1) p_1, + sum(p_2) p_2, + sum(p_3) p_3 + from( + select + f_data_time f_data_time, + decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_1, + decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_2, + decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000)) p_3 + from t_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + and f_data_time in ( + select + data_time + from( + select + open_day || '1535' data_time + from v_open_day + minus + select + substr(f_data_time, 1, 8) data_time + from t_index + where f_part_code = '001' + order by data_time desc + ) + where rownum< 20 + ) + group by f_data_time, f_invest_code + ) + )"; + + string queryKOSDAQList = @"select + (select max(open_day) from v_open_day) f_data_time, + P_1 ""개인"", + P_2 ""외국인"", + P_3 ""기관"" + FROM( + select + sum(decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_1, + sum(decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_2, + sum(decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000))) p_3 + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by f_invest_code + ) + UNION + select + f_data_time, + sum(p_1) ""개인"", + sum(p_2) ""외국인"", + sum(p_3) ""기관"" + from( + select + substr(f_data_time, 1, 8) f_data_time, + decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_1, + decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_2, + decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000)) p_3 + from t_kosdaq_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + and f_data_time in ( + select data_time || '1535' + from( + select open_day data_time from v_open_day + minus + select substr(f_data_time, 1, 8) data_time from t_index + where f_part_code = '001' + order by data_time desc + ) + where rownum< 5 + ) + group by f_data_time, f_invest_code + ) + group by f_data_time + order by f_data_time desc"; + + string queryKOSDAQSum = @"select + sum(p_1) ""개인"", + sum(p_2) ""외국인"", + sum(p_3) ""기관"" + from( + select + sum(decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_1, + sum(decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) p_2, + sum(decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000))) p_3 + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by f_invest_code + union + select + sum(p_1) p_1, + sum(p_2) p_2, + sum(p_3) p_3 + from( + select + f_data_time f_data_time, + decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_1, + decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_2, + decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000)) p_3 + from t_kosdaq_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + and f_data_time in ( + select + data_time + from( + select + open_day || '1535' data_time + from v_open_day + minus + select + substr(f_data_time, 1, 8) data_time + from t_index + where f_part_code = '001' + order by data_time desc + ) + where rownum< 20 + ) + group by f_data_time, f_invest_code + ) + )"; + + public override IDataRequest buildData() + { + + + if (mMarketType == 국내시장종류.KOSPI) + { + mRequestQuery.Add("일별리스트", queryKOSPIList); + mRequestQuery.Add("한달합계", queryKOSPISum); + } + else + { + mRequestQuery.Add("일별리스트", queryKOSDAQList); + mRequestQuery.Add("한달합계", queryKOSDAQSum); + } + + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick12.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick12.cs new file mode 100644 index 0000000..de0d649 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick12.cs @@ -0,0 +1,64 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Stick12 : ADataObject + { + + + public Stick12(국내시장종류 recvMarketType) + { + this.mMarketType = recvMarketType; + } + + private 국내시장종류 mMarketType; + + /// + /// 금일 데이터 쿼리 + /// + string queryKOSPI = @"select + decode(f_invest_code,'8000','개인','9000','외국인','9001','외국인','기관') invest_name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관')"; + + + string queryKOSDAQ = @"select + decode(f_invest_code,'8000','개인','9000','외국인','9001','외국인','기관') invest_name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by decode(f_invest_code, '8000', '개인', '9000', '외국인', '9001', '외국인', '기관')"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (this.mMarketType) + { + case 국내시장종류.KOSPI: + bufQuery = queryKOSPI; + break; + case 국내시장종류.KOSDAQ: + bufQuery = queryKOSDAQ; + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick21.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick21.cs new file mode 100644 index 0000000..89d5fa9 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/막대그래프/Stick21.cs @@ -0,0 +1,112 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Stick21 : ADataObject + { + + + public Stick21(섹터지수막대그래프분류 recvDataType) + { + this.mDataType = recvDataType; + } + + private 섹터지수막대그래프분류 mDataType; + + /// + /// 금일 데이터 쿼리 + /// + string queryKOSPI = @"select + b.f_part_name, + a.F_PART_IDX/100, + a.F_CHG_TYPE, + a.F_PART_CHG/100, + round(a.f_part_chg / decode(a.f_chg_type, '+', (a.f_part_idx / 100) - (a.f_part_chg / 100), '-', (a.f_part_idx / 100) + (a.f_part_chg / 100)), 2) rate + from t_index a, t_part b + where a.f_part_code = b.f_part_code + and a.f_part_code in('013', '009', '011', '016', '018', '021', '008', '007', '015', '005') + order by a.f_part_code"; + + + string queryKOSDAQ = @"select + b.f_part_name, + a.F_PART_IDX/100, + a.F_CHG_TYPE, + a.F_PART_CHG/100, + round(a.f_part_chg / decode(a.f_chg_type, '+', (a.f_part_idx / 100) - (a.f_part_chg / 100), '-', (a.f_part_idx / 100) + (a.f_part_chg / 100)), 2) rate + from t_kosdaq_index a, t_kosdaq_part b + where a.f_part_code = b.f_part_code + and a.f_part_code in('159', '160', '066', '154', '065', '031', '029', '070', '024', '153') + order by a.f_part_code"; + + string queryDOW = @"select + a.f_input_name name, + round(b.f_last,2) part_idx, + b.f_sign chg_type, + ABS(round(b.f_diff, 2)) part_chg, + round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('DJI@DJINET', 'DJI@DJUSAU', 'DJI@DJUSCH', 'DJI@DJUSNF', 'DJI@DJUSCN', 'DJI@DJT', 'DJI@DJU', 'DJI@DJUSFB', 'DJI@DJUSCFT', 'DJI@DJUSEE')"; + + + string queryNASDAQ = @"select + a.f_input_name name, + round(b.f_last,2) part_idx, + b.f_sign chg_type, + ABS(round(b.f_diff, 2)) part_chg, + round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('NAS@CXBT', 'NAS@NDX', 'NAS@NQSSSE', 'NAS@IXBK', 'NAS@IXIS', 'NAS@IXUT', 'NAS@IXK', 'NAS@NBI', 'NAS@IXF', 'NAS@NDXT')"; + + + string querySNP = @"select + a.f_input_name name, + round(b.f_last,2) part_idx, + b.f_sign chg_type, + ABS(round(b.f_diff, 2)) part_chg, + round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('SPI@S5ENRS', 'SPI@S5RLST', 'SPI@S5AUCO', 'SPI@S5INFT', 'SPI@S5COND', 'SPI@S5INSU', 'SPI@S5ELUTX', 'SPI@S5HLTH', 'SPI@S5FINL', 'SPI@S5TELS')"; + + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (this.mDataType) + { + case 섹터지수막대그래프분류.코스피: + bufQuery = queryKOSPI; + break; + case 섹터지수막대그래프분류.코스닥: + bufQuery = queryKOSDAQ; + break; + case 섹터지수막대그래프분류.다우: + bufQuery = queryDOW; + break; + case 섹터지수막대그래프분류.나스닥: + bufQuery = queryNASDAQ; + break; + case 섹터지수막대그래프분류.SNP: + bufQuery = querySNP; + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/ACandleData.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/ACandleData.cs new file mode 100644 index 0000000..a5fe7c3 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/ACandleData.cs @@ -0,0 +1,107 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.Data.Request +{ + internal abstract class ACandleData : ADataObject + { + + /// + /// + /// + /// + /// + public ACandleData(봉차트세부종목 recvDataType, 데이터기간 recvDataLength) + { + this.mDataLength = recvDataLength; + this.mDataType = recvDataType; + this.setQuery(); + } + + protected 데이터기간 mDataLength; + + protected 봉차트세부종목 mDataType; + + protected string mStockCode = string.Empty; + + protected string queryForecastToday = @""; + + protected string queryForecastLast = @""; + + protected string queryIndexNow = @""; + + protected string queryIndexToday = @""; + + protected string queryIndexLast = @""; + + protected string queryQuantityToday = @""; + + protected string queryQuantityLast = @""; + + + public override IDataRequest buildData() + { + + switch (mDataType) + { + case 봉차트세부종목.예상지수: + buildQueryMethod(queryForecastToday, queryForecastLast); + break; + case 봉차트세부종목.일반지수: + buildQueryMethod(queryIndexNow, queryIndexLast, queryIndexToday); + break; + case 봉차트세부종목.거래량: + buildQueryMethod(queryIndexNow, queryQuantityLast, queryQuantityToday); + break; + } + + + return this; + + } + + private void buildQueryMethod(string query1, string query2, string query3 = null) + { + + if (this.mStockCode != string.Empty) + { + mRequestQuery.Add("현재", string.Format(query1, this.mStockCode)); + + if (mDataLength == 데이터기간.일 && query3 != null) + { + mRequestQuery.Add("누적", string.Format(query3, this.mStockCode)); + } + else + { + mRequestQuery.Add("누적", String.Format(query2, this.mDataLength.GetStringValue(), this.mStockCode)); + } + + } + else + { + + mRequestQuery.Add("현재", query1); + + if (mDataLength == 데이터기간.일 && query3 != null) + { + mRequestQuery.Add("누적", query3); + } + else + { + mRequestQuery.Add("누적", String.Format(query2, this.mDataLength.GetStringValue())); + } + } + + } + + + protected abstract void setQuery(); + + } + +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleFutures.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleFutures.cs new file mode 100644 index 0000000..8c4ebb6 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleFutures.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleFutures : ACandleData + { + public CandleFutures(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength) : base(recvDataType, recvDataLength) + { + + if (recvDataType == DBDefine.봉차트세부종목.거래량) + { + throw new Exception("선물은 거래량 쿼리가 없음."); + } + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @"SELECT + '선물' name, + part_idx part_idx, + chg_type, + ABS(part_chg) part_chg, + round(part_chg / decode(chg_type, '+', (part_idx / 100) - (part_chg / 100), '-', (part_idx / 100) + (part_chg / 100), 1), 2) rate + FROM ( + SELECT decode(a.f_fo_price,0, b.F_JUN_LAST_PRICE, a.f_fo_price) part_idx, + decode(a.f_fo_price, 0, 0, (a.f_fo_price - b.F_JUN_LAST_PRICE)/100) part_chg, + decode(a.f_fo_price, 0, ' ', decode(sign(a.f_fo_price -b.F_JUN_LAST_PRICE),1,'+',-1,'-',0,' ')) chg_type + FROM t_sunmul_online a, t_sunmul_batch b +WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_seq = 1 + AND b.f_market_date = (select max(OPEN_DAY) from v_open_day) + AND b.F_MONTH_GUBUN = '1' + )"; + + this.queryForecastLast = @"select + F_DATA_DAY, + chg_type, + part_chg, + part_high_idx / 100 part_high_idx, + part_low_idx / 100 part_low_idx, + part_init_idx / 100 part_init_idx, + part_idx / 100 part_idx, + part_ma5_idx / 100 part_ma5_idx, + part_ma20_idx / 100 part_ma20_idx + FROM( + select F_DATA_DAY, F_CHG_TYPE chg_type, F_PART_CHG part_chg, + F_PART_HIGH_IDX part_high_idx, F_PART_LOW_IDX part_low_idx, F_PART_INIT_IDX part_init_idx, + F_PART_IDX part_idx, F_PART_MA5_IDX part_ma5_idx, F_PART_MA20_IDX part_ma20_idx + from T_SUNMUL_HIS_DAY + order by f_data_day desc) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT + '선물' name, + part_idx part_idx, + chg_type, + ABS(part_chg) part_chg, + ABS(round(part_chg / decode(chg_type, '+', (part_idx / 100) - (part_chg / 100), '-', (part_idx / 100) + (part_chg / 100), 1), 2)) rate + FROM ( + SELECT decode(a.f_curr_price,0, b.F_JUN_LAST_PRICE/100, a.f_curr_price/100) part_idx, a.F_NET_VOL, a.f_out_vol, a.F_NET_TURNOVER, + decode(a.f_curr_price, 0, 0, (a.f_curr_price - b.F_JUN_LAST_PRICE*100)/100) part_chg, + decode(a.f_curr_price, 0, ' ', decode(sign(a.f_curr_price -b.F_JUN_LAST_PRICE*100),1,'+',-1,'-',0,' ')) chg_type + FROM t_sunmul_online a, t_sunmul_batch b + WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_seq = 1 + AND b.f_market_date = (select max(OPEN_DAY) from v_open_day) + AND b.F_MONTH_GUBUN = '1' + )"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_IDX/100, + a.F_CHG_TYPE, + a.F_PART_CHG, + a.F_PART_HIGH_IDX/100, + a.F_PART_LOW_IDX/100, + a.F_PART_INIT_IDX/100 + from t_sunmul_his_5M a + where a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + this.queryIndexLast = @"select + F_DATA_DAY, + chg_type, + part_chg, + part_high_idx/100, + part_low_idx/100, + part_init_idx/100, + part_idx/100, + part_ma5_idx/100, + part_ma20_idx/100 + FROM ( + select + F_DATA_DAY, + F_CHG_TYPE chg_type, + F_PART_CHG part_chg, + F_PART_HIGH_IDX part_high_idx, + F_PART_LOW_IDX part_low_idx, + F_PART_INIT_IDX part_init_idx, + F_PART_IDX part_idx, + F_PART_MA5_IDX part_ma5_idx, + F_PART_MA20_IDX part_ma20_idx + from T_SUNMUL_HIS_DAY + order by f_data_day desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @""; + + + this.queryQuantityLast = @""; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSDAQ.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSDAQ.cs new file mode 100644 index 0000000..5072030 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSDAQ.cs @@ -0,0 +1,142 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleIndustryKOSDAQ : ACandleData + { + public CandleIndustryKOSDAQ(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + if (recvDataType == DBDefine.봉차트세부종목.예상지수) + { + throw new Exception("업종지수는 예상지수 쿼리가 없음."); + } + + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @""; + + this.queryForecastLast = @""; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT + b.f_part_name part_name, + f_part_vol part_vol, + round(f_part_idx/100,2) part_idx, + f_chg_type chg_type, + round(f_part_chg/100,2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_kosdaq_index a, t_kosdaq_part b + WHERE a.f_part_code = b.f_part_code + AND b.f_part_name = '{0}'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + b.f_part_name, + a.F_CHG_TYPE chg_type, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx, + a.f_part_vol + from t_kosdaq_index_his_5M a, t_kosdaq_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{0}' + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + this.queryIndexLast = @"select + F_DATA_DAY, + F_PART_CODE, + f_part_name part_name, + F_CHG_TYPE chg_type, + f_part_vol part_vol, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, b.f_part_name, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_kosdaq_index_his_day a, t_kosdaq_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{1}' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + b.f_part_name, + a.F_CHG_TYPE chg_type, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx, + a.f_part_vol part_vol + from t_kosdaq_index_his_5M a, t_kosdaq_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{0}' + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + + this.queryQuantityLast = @"select + F_DATA_DAY, + F_PART_CODE, + f_part_name part_name, + F_CHG_TYPE chg_type, + f_part_vol part_vol, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, b.f_part_name, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_kosdaq_index_his_day a, t_kosdaq_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{1}' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSPI.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSPI.cs new file mode 100644 index 0000000..b979736 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleIndustryKOSPI.cs @@ -0,0 +1,144 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleIndustryKOSPI : ACandleData + { + public CandleIndustryKOSPI(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + if (recvDataType == DBDefine.봉차트세부종목.예상지수) + { + throw new Exception("업종지수는 예상지수 쿼리가 없음."); + } + + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @""; + + this.queryForecastLast = @""; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT + b.f_part_name part_name, + a.f_part_vol part_vol, + round(f_part_idx / 100, 2) part_idx, + f_chg_type chg_type, + round(f_part_chg / 100, 2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_index a, t_part b + WHERE a.f_part_code = b.f_part_code + AND b.f_part_name = '{0}'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + b.f_part_name, + a.F_CHG_TYPE, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx, + F_PART_VOL + from t_index_his_5M a, t_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{0}' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + this.queryIndexLast = @"select + F_DATA_DAY, + F_PART_CODE, + f_part_name part_name, + F_CHG_TYPE chg_type, + f_part_vol part_vol, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, b.f_part_name, + a.F_CHG_TYPE, a.F_PART_CHG, a.F_PART_VOL, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_index_his_day a, t_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{1}' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + b.f_part_name, + a.F_CHG_TYPE, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx, + F_PART_VOL part_vol + from t_index_his_5M a, t_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{0}' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + + this.queryQuantityLast = @"select + F_DATA_DAY, + F_PART_CODE, + f_part_name part_name, + F_CHG_TYPE chg_type, + f_part_vol part_vol, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, b.f_part_name, + a.F_CHG_TYPE, a.F_PART_CHG, a.F_PART_VOL, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_index_his_day a, t_part b + where a.f_part_code = b.f_part_code + and b.f_part_name = '{1}' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSDAQ.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSDAQ.cs new file mode 100644 index 0000000..9769ea7 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSDAQ.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleKOSDAQ : ACandleData + { + public CandleKOSDAQ(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength) : base(recvDataType, recvDataLength) + { + + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @"SELECT + '코스닥 예상' NAME, + round(f_part_idx / 100, 2) part_idx, + f_chg_type chg_type, + ABS(round(f_part_chg / 100, 2)) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg),1) * 100, 2) rate + FROM t_kosdaq_fo_index + WHERE f_part_code = '001'"; + + this.queryForecastLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_kosdaq_index_his_day a + where a.f_part_code = '001' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT + round(f_part_idx/100,2) part_idx, + f_chg_type chg_type, + round(f_part_chg/100,2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_kosdaq_index + WHERE f_part_code = '001'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx + from t_kosdaq_index_his_5M a + where a.f_part_code = '001' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + this.queryIndexLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_kosdaq_index_his_day a + where a.f_part_code = '001' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_VOL part_vol + from t_kosdaq_index_his_5M a + where a.f_part_code = '001' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + + this.queryQuantityLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_VOL part_vol, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_kosdaq_index_his_day a + where a.f_part_code = '001' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI.cs new file mode 100644 index 0000000..193605e --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleKOSPI : ACandleData + { + public CandleKOSPI(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength) : base(recvDataType, recvDataLength) + { + + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @"SELECT + '코스피 예상' NAME, + round(f_part_idx / 100, 2) part_idx, + f_chg_type chg_type, + ABS(round(f_part_chg / 100, 2)) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_fo_index + WHERE f_part_code = '001'"; + + this.queryForecastLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_index_his_day a + where a.f_part_code = '001' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT + round(f_part_idx/100,2) part_idx, + f_chg_type chg_type, + round(f_part_chg/100,2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_index + WHERE f_part_code = '001'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + a.F_CHG_TYPE chg_type, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx + from t_index_his_5M a + where a.f_part_code = '001' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + this.queryIndexLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, F_PART_LOW_IDX / 100 part_low_idx, F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, F_PART_MA5_IDX / 100 part_ma5_idx, F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_index_his_day a + where a.f_part_code = '001' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + a.F_CHG_TYPE chg_type, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx, + a.F_PART_VOL part_vol + from t_index_his_5M a + where a.f_part_code = '001' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + + this.queryQuantityLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_VOL part_vol, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_index_his_day a + where a.f_part_code = '001' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI200.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI200.cs new file mode 100644 index 0000000..ebeb841 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKOSPI200.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleKOSPI200 : ACandleData + { + public CandleKOSPI200(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength) : base(recvDataType, recvDataLength) + { + + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @"SELECT + 'KOSPI200' name, + f_part_idx/100 part_idx, + f_chg_type chg_type, + ABS(round(f_part_chg/100,2)) part_chg, + round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), '-', (f_part_idx / 100) + (f_part_chg / 100), 1), 2) rate + FROM T_200_FO_INDEX + WHERE f_part_code = '029'"; + + this.queryForecastLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_200_index_his_day a + where a.f_part_code = '029' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT + round(f_part_idx/100,2) part_idx, + f_chg_type chg_type, + round(f_part_chg/100,2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM T_200_INDEX + WHERE f_part_code = '029'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + a.F_CHG_TYPE chg_type, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx + from t_200_index_his_5M a + where a.f_part_code = '029' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + this.queryIndexLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_200_index_his_day a + where a.f_part_code = '029' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + a.F_PART_CHG / 100 part_chg, + a.F_PART_HIGH_IDX / 100 part_high_idx, + a.F_PART_LOW_IDX / 100 part_low_idx, + a.F_PART_INIT_IDX / 100 part_init_idx, + a.F_PART_IDX / 100 part_idx, + F_PART_VOL part_vol + from t_200_index_his_5M a + where a.f_part_code = '029' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + + this.queryQuantityLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_VOL part_vol, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from (select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_200_index_his_day a + where a.f_part_code = '029' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKRX100.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKRX100.cs new file mode 100644 index 0000000..e81f8fb --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleKRX100.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleKRX100 : ACandleData + { + public CandleKRX100(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength) : base(recvDataType, recvDataLength) + { + + if (recvDataType == DBDefine.봉차트세부종목.예상지수) + { + throw new Exception("KRX100은 예상지수 쿼리가 없음."); + } + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @""; + + this.queryForecastLast = @""; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT + round(f_part_idx/100,2) part_idx, + f_chg_type chg_type, + round(f_part_chg/100,2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_krx100_index + WHERE f_part_code = '043'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx + from t_krx100_index_his_5M a + where a.f_part_code = '043' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + this.queryIndexLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_krx100_index_his_day a + where a.f_part_code = '043' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + #endregion + + #region 거래량 + + //this.queryQuantityToday = @"select + // a.F_DATA_DAY, + // a.F_DATA_TIME, + // a.F_PART_CODE, + // F_CHG_TYPE chg_type, + // F_PART_CHG / 100 part_chg, + // F_PART_HIGH_IDX / 100 part_high_idx, + // F_PART_LOW_IDX / 100 part_low_idx, + // F_PART_INIT_IDX / 100 part_init_idx, + // F_PART_IDX / 100 part_idx + //from t_krx100_index_his_5M a + //where a.f_part_code = '043' + // and a.f_data_day = (select max(open_day) from v_open_day) + //order by a.F_DATA_DAY, a.F_DATA_TIME"; + + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_PART_CODE, + a.F_CHG_TYPE, + F_PART_CHG / 100 part_chg, + F_PART_VOL part_vol, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + a.F_DATA_TIME + from t_krx100_index_his_5M a + where a.f_part_code = '043' + and a.f_data_day = (select max(open_day) from v_open_day) + order by a.F_DATA_DAY, a.F_DATA_TIME"; + + + + this.queryQuantityLast = @"select + F_DATA_DAY, + F_PART_CODE, + F_CHG_TYPE chg_type, + F_PART_CHG / 100 part_chg, + F_PART_VOL part_vol, + F_PART_HIGH_IDX / 100 part_high_idx, + F_PART_LOW_IDX / 100 part_low_idx, + F_PART_INIT_IDX / 100 part_init_idx, + F_PART_IDX / 100 part_idx, + F_PART_MA5_IDX / 100 part_ma5_idx, + F_PART_MA20_IDX / 100 part_ma20_idx + from ( + select a.F_DATA_DAY, a.F_PART_CODE, + a.F_CHG_TYPE, a.F_PART_CHG, a.f_part_vol, + a.F_PART_HIGH_IDX, a.F_PART_LOW_IDX, a.F_PART_INIT_IDX, + a.F_PART_IDX, a.F_PART_MA5_IDX, a.F_PART_MA20_IDX + from t_krx100_index_his_day a + where a.f_part_code = '043' + order by a.F_DATA_DAY desc + ) + where rownum <= {0} order by F_DATA_DAY asc"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDIS.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDIS.cs new file mode 100644 index 0000000..b32b6d9 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDIS.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleStockDIS : ACandleData + { + public CandleStockDIS(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 지수 + + this.queryIndexNow = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME stock_name, + a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_stop_online1 a, t_stock b + WHERE b.f_mkt_halt = 'Y' + + AND a.f_curr_price < > 0 + + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}'"; + + + + this.queryIndexLast = @"select O.OPEN_DAY, X.F_STOCK_CODE, X.f_stock_wanname, + X.F_CHG_TYPE, X.F_NET_CHG, + X.F_HIGH_PRICE, X.F_LOW_PRICE, X.F_INIT_PRICE, + X.F_CURR_PRICE, X.F_MA5_PRICE, X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_candle_history a, t_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'Y' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0} ) O + + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + #endregion + } + } + } diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDISK.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDISK.cs new file mode 100644 index 0000000..53ef69c --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockDISK.cs @@ -0,0 +1,64 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleStockDISK : ACandleData + { + public CandleStockDISK(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 지수 + + this.queryIndexNow = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME stock_name, + a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_stop_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'Y' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}'"; + + + + this.queryIndexLast = @"select O.OPEN_DAY, X.F_STOCK_CODE, X.f_stock_wanname, + X.F_CHG_TYPE, X.F_NET_CHG, + X.F_HIGH_PRICE, X.F_LOW_PRICE, X.F_INIT_PRICE, + X.F_CURR_PRICE, X.F_MA5_PRICE, X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_kosdaq_candle_history a, t_kosdaq_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'Y' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0}) O + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + #endregion + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSDAQ.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSDAQ.cs new file mode 100644 index 0000000..905a5c4 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSDAQ.cs @@ -0,0 +1,219 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleStockKOSDAQ : ACandleData + { + public CandleStockKOSDAQ(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.f_stock_nickname nickname, + b.F_STOCK_WANNAME wanname, + a.f_fore_price curr_price, + a.f_fore_vol net_vol, + c.f_final_price final_price, + ABS(a.f_fore_price - c.f_final_price) net_chg, + ' ' f_net_chg, + case when(a.f_fore_price - c.f_final_price) > 0 then '+' + when(a.f_fore_price - c.f_final_price) = 0 then '' + when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + FROM t_kosdaq_online1_call a, t_kosdaq_stock b, t_kosdaq_batch_day c + WHERE a.f_stock_code = b.f_stock_code + AND b.f_mkt_halt = 'N' + AND c.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{0}'"; + + ////////////this.queryForecastToday = @"SELECT DISTINCT + //////////// b.f_stock_code stock_code, + //////////// b.f_stock_nickname nickname, + //////////// b.F_STOCK_WANNAME wanname, + //////////// a.f_fore_price curr_price, + //////////// a.f_fore_vol net_vol, + //////////// c.f_final_price final_price, + //////////// a.f_fore_price - c.f_final_price net_chg, + //////////// a.f_net_chg, + //////////// case when(a.f_fore_price - c.f_final_price) > 0 then '+' + //////////// when(a.f_fore_price - c.f_final_price) = 0 then '' + //////////// when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + //////////// round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + ////////////FROM t_kosdaq_online1 a, t_kosdaq_stock b, t_kosdaq_batch_day c + ////////////WHERE a.f_stock_code = b.f_stock_code + //////////// AND b.f_mkt_halt = 'N' + //////////// AND c.f_stock_code = b.f_stock_code + //////////// and b.f_stock_wanname = '{0}'"; + // 테스트로 막아놓음 + //this.queryForecastLast = @"select + // F_DATA_DATE, + // F_STOCK_CODE, + // f_stock_wanname, + // F_CHG_TYPE, + // F_NET_CHG, + // F_HIGH_PRICE, + // F_LOW_PRICE, + // F_INIT_PRICE, + // F_CURR_PRICE, + // F_MA5_PRICE, + // F_MA20_PRICE + //from ( + // select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + // a.F_CHG_TYPE, a.F_NET_CHG, + // a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + // a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + // from t_kosdaq_candle_history a, t_kosdaq_stock b + // where a.f_stock_code = b.f_stock_code + // and b.f_stock_wanname = '{1}' + // order by a.F_DATA_DATE desc + //) + //where rownum <= {0} order by F_DATA_DATE asc"; + + this.queryForecastLast = @"select + O.OPEN_DAY F_DATA_DATE, + X.F_STOCK_CODE, + X.f_stock_wanname, + X.F_CHG_TYPE, + X.F_NET_CHG, + X.F_HIGH_PRICE, + X.F_LOW_PRICE, + X.F_INIT_PRICE, + X.F_CURR_PRICE, + X.F_MA5_PRICE, + X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_kosdaq_candle_history a, t_kosdaq_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'N' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0}) O + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME stock_name , + a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), '2', (a.f_curr_price - a.f_net_chg), '3', (a.f_curr_price), '4', -1*(a.f_curr_price + a.f_net_chg), '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_STOCK_CODE, + b.f_stock_wanname, + a.F_CURR_PRICE, + a.F_CHG_TYPE, + a.F_NET_CHG, + a.F_NET_VOL, + a.F_HIGH_PRICE, + a.F_LOW_PRICE, + a.F_INIT_PRICE + from t_kosdaq_online_his_5M a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}' + and b.f_mkt_halt = 'N' + and a.f_data_day = ( + select max(open_day) from v_open_day + ) + ORDER BY a.F_DATA_TIME"; + + this.queryIndexLast = @"select O.OPEN_DAY, X.F_STOCK_CODE, X.f_stock_wanname, + X.F_CHG_TYPE, X.F_NET_CHG, + X.F_HIGH_PRICE, X.F_LOW_PRICE, X.F_INIT_PRICE, + X.F_CURR_PRICE, X.F_MA5_PRICE, X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_kosdaq_candle_history a, t_kosdaq_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'N' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0}) O + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_STOCK_CODE, + b.f_stock_wanname, + a.F_CURR_PRICE, + a.F_CHG_TYPE, + a.F_NET_CHG, + a.F_NET_VOL, + a.F_HIGH_PRICE, + a.F_LOW_PRICE, + a.F_INIT_PRICE + from t_kosdaq_online_his_5M a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}' + and a.f_data_day = (select max(open_day) from v_open_day) + ORDER BY a.F_DATA_TIME"; + + this.queryQuantityLast = @"select O.OPEN_DAY, X.F_STOCK_CODE, X.f_stock_wanname, + X.F_CHG_TYPE, X.F_NET_CHG, X.F_NET_VOL, + X.F_HIGH_PRICE, X.F_LOW_PRICE, X.F_INIT_PRICE, + X.F_CURR_PRICE, X.F_MA5_PRICE, X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, a.F_NET_VOL, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_kosdaq_candle_history a, t_kosdaq_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'N' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0}) O + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSPI.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSPI.cs new file mode 100644 index 0000000..f7ce756 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleStockKOSPI.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleStockKOSPI : ACandleData + { + public CandleStockKOSPI(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 예상지수 + + this.queryForecastToday = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.f_stock_nickname nickname, + b.F_STOCK_WANNAME wanname, + a.f_fore_price curr_price, + a.f_fore_vol net_vol, + c.f_final_price final_price, + ABS(a.f_fore_price - c.f_final_price) net_chg, + '' f_net_chg, + case when(a.f_fore_price - c.f_final_price) > 0 then '+' + when(a.f_fore_price - c.f_final_price) = 0 then '' + when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + FROM t_online1_call a, t_stock b, t_batch_day c + WHERE b.f_stock_code = a.f_stock_code + AND c.f_stock_code = a.f_stock_code + AND b.f_mkt_halt = 'N' + and b.f_STOCK_wanname = '{0}'"; + + //////////this.queryForecastToday = @"SELECT DISTINCT + ////////// b.f_stock_code stock_code, + ////////// b.f_stock_nickname nickname, + ////////// b.F_STOCK_WANNAME wanname, + ////////// a.f_fore_price curr_price, + ////////// a.f_fore_vol net_vol, + ////////// c.f_final_price final_price, + ////////// a.f_fore_price - c.f_final_price net_chg, + ////////// a.f_net_chg, + ////////// case when(a.f_fore_price - c.f_final_price) > 0 then '+' when(a.f_fore_price - c.f_final_price) = 0 then '' when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + ////////// round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + //////////FROM t_online1 a, t_stock b, t_batch_day c + //////////WHERE b.f_stock_code = a.f_stock_code + ////////// AND c.f_stock_code = a.f_stock_code + ////////// AND b.f_mkt_halt = 'N' + ////////// and b.f_STOCK_wanname = '{0}'"; + + //==================== + //this.queryForecastLast = @"select + // F_DATA_DATE, + // F_STOCK_CODE, + // f_stock_wanname, + // F_CHG_TYPE, + // F_NET_CHG, + // F_HIGH_PRICE, + // F_LOW_PRICE, + // F_INIT_PRICE, + // F_CURR_PRICE, + // F_MA5_PRICE, + // F_MA20_PRICE + //from ( + // select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + // a.F_CHG_TYPE, a.F_NET_CHG, + // a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + // a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + // from t_candle_history a, t_stock b + // where a.f_stock_code = b.f_stock_code + // and b.f_stock_wanname = '{1}' + // and b.f_mkt_halt = 'N' + // order by a.F_DATA_DATE desc + //) + //where rownum <= {0} order by F_DATA_DATE asc"; + this.queryForecastLast = @"select + O.OPEN_DAY F_DATA_DATE, + X.F_STOCK_CODE, + X.f_stock_wanname, + X.F_CHG_TYPE, + X.F_NET_CHG, + X.F_HIGH_PRICE, + X.F_LOW_PRICE, + X.F_INIT_PRICE, + X.F_CURR_PRICE, + X.F_MA5_PRICE, + X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_candle_history a, t_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'N' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0}) O + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + //================================= + + #endregion + + #region 지수 + + this.queryIndexNow = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME stock_name , + a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + a.f_net_vol, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), '2', (a.f_curr_price - a.f_net_chg), '3', (a.f_curr_price), '4', -1*(a.f_curr_price + a.f_net_chg), '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}'"; + + this.queryIndexToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_STOCK_CODE, + b.f_stock_wanname, + a.F_CURR_PRICE, + a.F_CHG_TYPE, + a.F_NET_CHG, + a.F_NET_VOL, + a.F_HIGH_PRICE, + a.F_LOW_PRICE, + a.F_INIT_PRICE + from t_online_his_5M a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}' + and a.f_data_day = ( + select max(open_day) from v_open_day + ) + ORDER BY a.F_DATA_TIME"; + + this.queryIndexLast = @"select O.OPEN_DAY, X.F_STOCK_CODE, X.f_stock_wanname, + X.F_CHG_TYPE, X.F_NET_CHG, + X.F_HIGH_PRICE, X.F_LOW_PRICE, X.F_INIT_PRICE, + X.F_CURR_PRICE, X.F_MA5_PRICE, X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_candle_history a, t_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'N' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0}) O + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + #endregion + + #region 거래량 + + this.queryQuantityToday = @"select + a.F_DATA_DAY, + a.F_DATA_TIME, + a.F_STOCK_CODE, + b.f_stock_wanname, + a.F_CURR_PRICE, + a.F_CHG_TYPE, + a.F_NET_CHG, + a.F_NET_VOL, + a.F_HIGH_PRICE, + a.F_LOW_PRICE, + a.F_INIT_PRICE + from t_online_his_5M a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + AND b.f_stock_wanname = '{0}' + and a.f_data_day = (select max(open_day) from v_open_day) + ORDER BY a.F_DATA_TIME"; + + + this.queryQuantityLast = @"select O.OPEN_DAY, X.F_STOCK_CODE, X.f_stock_wanname, + X.F_CHG_TYPE, X.F_NET_CHG, X.F_NET_VOL, + X.F_HIGH_PRICE, X.F_LOW_PRICE, X.F_INIT_PRICE, + X.F_CURR_PRICE, X.F_MA5_PRICE, X.F_MA20_PRICE + from(select a.F_DATA_DATE, a.F_STOCK_CODE, b.f_stock_wanname, + a.F_CHG_TYPE, a.F_NET_CHG, a.F_NET_VOL, + a.F_HIGH_PRICE, a.F_LOW_PRICE, a.F_INIT_PRICE, + a.F_CURR_PRICE, a.F_MA5_PRICE, a.F_MA20_PRICE + from t_candle_history a, t_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{1}' + and b.f_mkt_halt = 'N' + order by a.F_DATA_DATE desc) X, + (select open_day from(select open_day from v_open_day + order by open_day desc) + where rownum <= {0}) O + where X.f_data_date(+) = o.open_day + order by O.OPEN_DAY"; + + } + + #endregion + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/Candleforeign.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/Candleforeign.cs new file mode 100644 index 0000000..06d96dd --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/Candleforeign.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class Candleforeign : ACandleData + { + public Candleforeign(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 지수 + + //this.queryIndexNow = @"select distinct a.f_input_name name, b.F_xYMD, round(b.f_last,2) part_idx, b.f_sign chg_type, + //ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + //from t_world_ix_eq_master a, t_world_ix_eq_sise b + //where a.f_symb = b.f_symb + // and a.f_input_name like '{0}' + // and b.f_fdtc = '0'"; + + this.queryIndexNow = @"select distinct a.f_input_name name, b.F_xYMD, round(b.f_last, 2) part_idx, b.f_sign chg_type, + ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_input_name like '{0}' + and b.f_fdtc in ('0', '1')"; + + this.queryIndexLast = @"select name, F_xYMD ymd, part_idx, chg_type, part_chg, rate, high, open, low + from(select distinct a.f_input_name name, b.F_xYMD, round(b.f_last, 2) part_idx, b.f_sign chg_type, + b.f_high high, b.f_open open, b.f_low low, + ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_his b + where a.f_symb = b.f_symb + and a.f_input_name like '{1}' + and b.f_fdtc in ( '0','1') + order by b.F_xYMD desc) + where rownum <= {0} order by ymd asc"; + + + + + #endregion + + + } + + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleforeignStock.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleforeignStock.cs new file mode 100644 index 0000000..187324c --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/봉차트/CandleforeignStock.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MMoneyCoderSharp.Data.Request.봉차트 +{ + internal class CandleforeignStock : ACandleData + { + public CandleforeignStock(DBDefine.봉차트세부종목 recvDataType, DBDefine.데이터기간 recvDataLength, string recvStockCode) : base(recvDataType, recvDataLength) + { + + this.mStockCode = recvStockCode; + + } + + protected override void setQuery() + { + + #region 종목 + + + + this.queryIndexNow = @"select distinct a.f_input_name name, b.F_xYMD, round(b.f_last, 2) part_idx, b.f_sign chg_type, + ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_input_name like '{0}' + and b.f_fdtc = '1'"; + + + + + + this.queryIndexLast = @"select name, F_xYMD ymd, part_idx, chg_type, part_chg, rate, high, open, low + from(select distinct a.f_input_name name, b.F_xYMD, round(b.f_last, 2) part_idx, b.f_sign chg_type, + b.f_high high, b.f_open open, b.f_low low, + ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_his b + where a.f_symb = b.f_symb + and a.f_input_name like '{1}' + and b.f_fdtc = '1' + order by b.F_xYMD desc) + where rownum <= {0} order by ymd asc"; + + #endregion + + + } + + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/사각형그래프/Square20.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/사각형그래프/Square20.cs new file mode 100644 index 0000000..1c9da57 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/사각형그래프/Square20.cs @@ -0,0 +1,65 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Square20 : ADataObject + { + + + public Square20(국내시장종류 recvMarketType) + { + this.mMarketType = recvMarketType; + } + + private 국내시장종류 mMarketType; + + /// + /// 금일 데이터 쿼리 + /// + string queryKOSPI = @"select b.f_part_name, a.F_PART_IDX/100 part_idx, a.F_CHG_TYPE, a.F_PART_CHG/100 part_chg, + round(a.f_part_chg / decode(a.f_chg_type, '+', (a.f_part_idx / 100) - (a.f_part_chg / 100), + '-', (a.f_part_idx / 100) + (a.f_part_chg / 100)), 2) rate + from t_index a, t_part b + where a.f_part_code = b.f_part_code + and a.f_part_code in('013', '009', '011', '016', '018', + '021', '008', '020', '007', '012','015', '005', '014', '006', '019') order by a.f_part_code"; + + + string queryKOSDAQ = @"select b.f_part_name, a.F_PART_IDX/100 part_idx, a.F_CHG_TYPE, a.F_PART_CHG/100 part_chg, + round(a.f_part_chg / decode(a.f_chg_type, '+', (a.f_part_idx / 100) - (a.f_part_chg / 100), + '-', (a.f_part_idx / 100) + (a.f_part_chg / 100)), 2) rate + from t_kosdaq_index a, t_kosdaq_part b + where a.f_part_code = b.f_part_code + and a.f_part_code in('066', '159', '154', '160', '065', + '031', '029', '070', '026', '024', + '041', '056', '153', '027', '062') order by a.f_part_code"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (this.mMarketType) + { + case 국내시장종류.KOSPI: + bufQuery = queryKOSPI; + break; + case 국내시장종류.KOSDAQ: + bufQuery = queryKOSDAQ; + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Exchange.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Exchange.cs new file mode 100644 index 0000000..1bf3116 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Exchange.cs @@ -0,0 +1,105 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// 환율선그래프관련 DB데이터 쿼리매핑 오브젝트. + /// + /// 오늘데이터를 가져오는 쿼리와 기존 데이터 목록을 가져오는 쿼리가 각각 정리되어있다. + /// 선그래프등의 여러 데이터를 가져와야하는 쿼리의 경우 해당 쿼리를 union하여 더해서 리턴한다. + /// + internal class Exchange : ADataObject + { + + public Exchange(환율 recvDataType, 데이터기간 recvDataLength) + { + + this.dataType = recvDataType; + this.dataLenght = recvDataLength; + + } + + /// + /// 환율데이터 종류 + /// + private 환율 dataType; + + /// + /// 가져올 데이터 기간 + /// + private 데이터기간 dataLenght; + + /// + /// 누적데이터 쿼리 + /// + const string queryLast = @"select + a.f_data_day data_day, + a.f_input_code input_code, + b.f_input_name, + a.f_curr_price curr_price, + a.F_net_CHG net_chg, + a.f_chg_type chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price - a.f_net_chg), '', (a.f_curr_price), '-', (a.f_curr_price + a.f_net_chg), 1)) * 100, 2) rate + from t_week_index a, t_input_code b + where a.f_input_code = b.f_input_code + and a.f_input_code = '{0}' + and a.f_data_day in ( + select open_day + from ( + select open_day + from v_open_day + minus + select f_data_day data_day + from t_input_index + where f_input_code = '{0}' + order by open_day desc + ) + where rownum < {1} + ) + "; + + /// + /// 금일 데이터 쿼리 + /// + const string queryToday = @"SELECT + a.f_data_day data_day, + a.f_input_code input_code, + b.f_input_name input_name, + a.f_curr_price curr_price, + a.f_net_chg net_chg, + a.f_chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price - a.f_net_chg), '', (a.f_curr_price), '-', (a.f_curr_price + a.f_net_chg), 1)) * 100, 2) rate + FROM t_input_index a, t_input_code b + WHERE a.f_input_code = b.f_input_code + AND a.f_input_code = '{0}' + order by data_day desc + "; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + if (dataLenght != 데이터기간.일) + { + + bufQuery += String.Format(queryLast, dataType.GetStringValue(), dataLenght.GetStringValue()); + + bufQuery += " union "; + + } + + bufQuery += String.Format(queryToday, dataType.GetStringValue()); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexIndustryYield.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexIndustryYield.cs new file mode 100644 index 0000000..a9b678a --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexIndustryYield.cs @@ -0,0 +1,117 @@ +using MMoneyCoderSharp.DB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.Data.Request +{ + internal class IndexIndustryYield : ADataObject + { + + /// + /// + /// + /// + /// + public IndexIndustryYield(string recvIndustryCode, 데이터기간 recvDataLength, 국내시장종류 recvMarketType) + { + this.mIndustryCode = recvIndustryCode; + this.mDataLength = recvDataLength; + this.mMarketType = recvMarketType; + } + + private string mIndustryCode = ""; + + private 데이터기간 mDataLength; + + private 국내시장종류 mMarketType; + + const string queryKOSPI = @"select + substr(f_data_time, 1,8) data_day, + f_part_idx/100 curr_price, + f_chg_type chg_type, + F_PART_CHG/100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg))) * 100, 2) rate + from t_index_his + where f_part_code = '{0}' + and Rtrim(f_data_time) in ( + select open_day || '1535' + from ( + select open_day from v_open_day + where open_day <> to_char(sysdate, 'yyyymmdd') + minus + select substr(f_data_time, 1, 8) data_day + from t_index + where f_part_code = '001' + order by open_day desc + ) + where rownum < {1} + ) + UNION + select + substr(f_data_time, 1, 8) data_day, + f_part_idx / 100 curr_price, + f_chg_type chg_type, + F_PART_CHG / 100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg))) * 100, 2) rate + from t_index + where f_part_code = '{0}' + order by data_day desc"; + + + + const string queryKOSDAQ = @"select + substr(f_data_time, 1,8) data_day, + f_part_idx/100 curr_price, + f_chg_type chg_type, + F_PART_CHG/100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg))) * 100, 2) rate + from t_kosdaq_index_his + where f_part_code = '{0}' + and Rtrim(f_data_time) in ( + select open_day || '1535' + from ( + select open_day from v_open_day + where open_day <> to_char(sysdate, 'yyyymmdd') + minus + select substr(f_data_time, 1, 8) data_day + from t_kosdaq_index + where f_part_code = '001' + order by open_day desc + ) + where rownum < {1} + ) + UNION + select + substr(f_data_time, 1, 8) data_day, + f_part_idx / 100 curr_price, + f_chg_type chg_type, + F_PART_CHG / 100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg))) * 100, 2) rate + from t_kosdaq_index + where f_part_code = '{0}' + order by data_day desc"; + + public override IDataRequest buildData() + { + string bufQuery = string.Empty; + + if (mMarketType == 국내시장종류.KOSPI) + { + bufQuery = String.Format(queryKOSPI, this.mIndustryCode, this.mDataLength.GetStringValue()); + } + else + { + bufQuery = String.Format(queryKOSDAQ, this.mIndustryCode, this.mDataLength.GetStringValue()); + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } + +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexYield.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexYield.cs new file mode 100644 index 0000000..d17c2a7 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/IndexYield.cs @@ -0,0 +1,312 @@ +using MMoneyCoderSharp.DB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.Data.Request +{ + internal class IndexYield : ADataObject + { + + /// + /// + /// + /// + /// + public IndexYield(데이터기간 recvDataLength, 국내지수종류 recvIndexType) + { + this.mDataLength = recvDataLength; + this.mIndexType = recvIndexType; + } + + private 데이터기간 mDataLength; + + private 국내지수종류 mIndexType; + + //const string queryKOSPI = @"select + // substr(f_data_time, 1,8) data_day, + // f_part_idx/100 curr_price, + // f_chg_type chg_type, + // F_PART_CHG/100 net_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // from t_index_his + // where f_part_code = '001' + // and Rtrim(f_data_time) in( + // select open_day || '1535' + // from ( + // select open_day + // from v_open_day + // where open_day <> to_char(sysdate, 'yyyymmdd') + // minus + // select substr(f_data_time, 1, 8) data_day + // from t_index + // where f_part_code = '001' + // order by open_day desc + // ) + // where rownum < {0} + // ) + // UNION + // select + // substr(f_data_time, 1, 8) data_day, + // f_part_idx / 100 curr_price, + // f_chg_type chg_type, + // F_PART_CHG / 100 net_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // from t_index + // where f_part_code = '001' + // order by data_day desc"; + + const string queryKOSPI = @"select + f_data_day data_day, + f_part_idx/100 curr_price, + f_chg_type chg_type, + F_PART_CHG/100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + from t_index_his_day + where f_part_code = '001' + and Rtrim(f_data_day) in( + select open_day + from ( + select open_day + from v_open_day + where open_day <> to_char(sysdate, 'yyyymmdd') + minus + select substr(f_data_time, 1, 8) data_day + from t_index + where f_part_code = '001' + order by open_day desc + ) + where rownum < {0} + ) + UNION + select + substr(f_data_time, 1, 8) data_day, + f_part_idx / 100 curr_price, + f_chg_type chg_type, + F_PART_CHG / 100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + from t_index + where f_part_code = '001' + order by data_day desc"; + + //const string queryKOSDAQ = @"select + // substr(f_data_time, 1,8) data_day, + // f_part_idx/100 curr_price, + // f_chg_type chg_type, + // F_PART_CHG/100 net_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // from t_kosdaq_index_his + // where f_part_code = '001' + // and Rtrim(f_data_time) in ( + // select open_day || '1535' + // from ( + // select open_day from v_open_day + // where open_day <> to_char(sysdate, 'yyyymmdd') + // minus + // select substr(f_data_time, 1, 8) data_day + // from t_kosdaq_index + // where f_part_code = '001' + // order by open_day desc + // ) + // where rownum < {0} + // ) + // UNION + // select + // substr(f_data_time, 1, 8) data_day, + // f_part_idx / 100 curr_price, + // f_chg_type chg_type, + // F_PART_CHG / 100 net_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // from t_kosdaq_index + // where f_part_code = '001' + // order by data_day desc"; + const string queryKOSDAQ = @"select + f_data_day data_day, + f_part_idx/100 curr_price, + f_chg_type chg_type, + F_PART_CHG/100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + from t_kosdaq_index_his_day + where f_part_code = '001' + and Rtrim(f_data_day) in ( + select open_day + from ( + select open_day from v_open_day + where open_day <> to_char(sysdate, 'yyyymmdd') + minus + select substr(f_data_time, 1, 8) data_day + from t_kosdaq_index + where f_part_code = '001' + order by open_day desc + ) + where rownum < {0} + ) + UNION + select + substr(f_data_time, 1, 8) data_day, + f_part_idx / 100 curr_price, + f_chg_type chg_type, + F_PART_CHG / 100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + from t_kosdaq_index + where f_part_code = '001' + order by data_day desc"; + + //const string queryKOSPI200 = @"select + // substr(f_data_time, 1,8) data_day, + // f_part_idx/100 curr_price, + // f_chg_type chg_type, + // F_PART_CHG/100 net_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // from T_200_INDEX_his + // where f_part_code = '029' + // and Rtrim(f_data_time) in ( + // select open_day || '1535' + // from ( + // select open_day from v_open_day + // where open_day <> to_char(sysdate, 'yyyymmdd') + // minus + // select substr(f_data_time, 1, 8) data_day + // from t_200_index + // where f_part_code = '029' + // order by open_day desc + // ) + // where rownum < {0} + // ) + // UNION + // SELECT + // substr(f_data_time, 1, 8) data_day, + // f_part_idx / 100 part_idx, + // f_chg_type chg_type, + // f_part_chg / 100 part_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // FROM T_200_INDEX + // WHERE f_part_code = '029' + // order by data_day desc"; + const string queryKOSPI200 = @"select + f_data_day data_day, + f_part_idx/100 curr_price, + f_chg_type chg_type, + F_PART_CHG/100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + from T_200_INDEX_his_day + where f_part_code = '029' + and Rtrim(f_data_day) in ( + select open_day + from ( + select open_day from v_open_day + where open_day <> to_char(sysdate, 'yyyymmdd') + minus + select substr(f_data_time, 1, 8) data_day + from t_200_index + where f_part_code = '029' + order by open_day desc + ) + where rownum < {0} + ) + UNION + SELECT + substr(f_data_time, 1, 8) data_day, + f_part_idx / 100 part_idx, + f_chg_type chg_type, + f_part_chg / 100 part_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + FROM T_200_INDEX + WHERE f_part_code = '029' + order by data_day desc"; + + //const string queryKRX100 = @"select + // substr(f_data_time, 1,8) data_day, + // f_part_idx/100 curr_price, + // f_chg_type chg_type, + // F_PART_CHG/100 net_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // from T_KRX100_INDEX_his + // where f_part_code = '043' + // and Rtrim(f_data_time) in ( + // select open_day || '1535' + // from ( + // select open_day from v_open_day + // where open_day <> to_char(sysdate, 'yyyymmdd') + // minus + // select substr(f_data_time, 1, 8) data_day + // from t_krx100_index + // where f_part_code = '043' + // order by open_day desc + // ) + // where rownum < {0} + // ) + // UNION + // SELECT + // substr(f_data_time, 1, 8) data_day, + // f_part_idx / 100 part_idx, + // f_chg_type chg_type, + // f_part_chg / 100 part_chg, + // round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + // FROM T_KRX100_INDEX + // WHERE f_part_code = '043' + // order by data_day desc"; + + const string queryKRX100 = @"select + f_data_day data_day, + f_part_idx/100 curr_price, + f_chg_type chg_type, + F_PART_CHG/100 net_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + from T_KRX100_INDEX_his_day + where f_part_code = '043' + and f_data_day in ( + select open_day + from ( + select open_day from v_open_day + where open_day <> to_char(sysdate, 'yyyymmdd') + minus + select substr(f_data_time, 1, 8) data_day + from t_krx100_index + where f_part_code = '043' + order by open_day desc + ) + where rownum < {0} + ) + UNION + SELECT + substr(f_data_time, 1, 8) data_day, + f_part_idx / 100 part_idx, + f_chg_type chg_type, + f_part_chg / 100 part_chg, + round((f_part_chg / decode(f_chg_type, '+', (f_part_idx - f_part_chg), '-', (f_part_idx + f_part_chg),1)) * 100, 2) rate + FROM T_KRX100_INDEX + WHERE f_part_code = '043' + order by data_day desc"; + + public override IDataRequest buildData() + { + string bufQuery = string.Empty; + + if (mIndexType == 국내지수종류.KOSPI) + { + bufQuery = String.Format(queryKOSPI, this.mDataLength.GetStringValue()); + } + else if (mIndexType == 국내지수종류.KOSDAQ) + { + bufQuery = String.Format(queryKOSDAQ, this.mDataLength.GetStringValue()); + } + else if (mIndexType == 국내지수종류.KOSPI200) + { + bufQuery = String.Format(queryKOSPI200, this.mDataLength.GetStringValue()); + } + else if (mIndexType == 국내지수종류.KRX100) + { + bufQuery = String.Format(queryKRX100, this.mDataLength.GetStringValue()); + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } + +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/StockYield.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/StockYield.cs new file mode 100644 index 0000000..2ff467e --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/StockYield.cs @@ -0,0 +1,128 @@ +using MMoneyCoderSharp.DB; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.Data.Request +{ + internal class StockYield : ADataObject + { + + /// + /// + /// + /// + /// + public StockYield(string recvStockNameKorean, 데이터기간 recvDataLength, 국내시장종류 recvMarketType) + { + if (recvStockNameKorean == "" || recvStockNameKorean == null) + { + throw new Exception("선그래프, 종목수익률, 종목명이 없음"); + } + + this.mStockNameKorean = recvStockNameKorean; + this.mDataLength = recvDataLength; + this.mMarketType = recvMarketType; + } + + private string mStockNameKorean = ""; + + private 데이터기간 mDataLength; + + private 국내시장종류 mMarketType; + + const string queryKOSPI = @"select O.open_day data_day , X.curr_price, X.chg_type, + X.rate, X.net_chg, X.f_stock_wanname + from(select a.f_stock_code, a.f_data_date data_day, a.f_curr_price curr_price, a.f_chg_type chg_type, a.F_net_CHG net_chg, + b.f_stock_wanname, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + from t_candle_history a, t_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{0}' + and b.f_mkt_halt = 'N') X, + (select open_day from(select open_day from v_open_day + minus + select substr(f_data_time, 1, 8) data_day + from t_index + where f_part_code = '001' + order by open_day desc) + where rownum< {1}) O + where X.data_day(+) = o.open_day + UNION + select(select substr(f_data_time, 1, 8) data_day from t_index where f_part_code = '001') data_day, + a.f_curr_price curr_price, a.f_chg_type chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate, + a.F_net_CHG net_chg, b.f_stock_wanname + from t_online1 a, t_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{0}' + and b.f_mkt_halt = 'N' + order by data_day desc"; + + const string queryKOSDAQ = @"select O.open_day data_day , X.curr_price, X.chg_type, + X.rate, X.net_chg, X.f_stock_wanname + from(select a.f_stock_code, a.f_data_date data_day, a.f_curr_price curr_price, a.f_chg_type chg_type, a.F_net_CHG net_chg, + b.f_stock_wanname, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + from t_kosdaq_candle_history a, t_kosdaq_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{0}' + and b.f_mkt_halt = 'N') X, + (select open_day from(select open_day from v_open_day + minus + select substr(f_data_time, 1, 8) data_day + from t_index + where f_part_code = '001' + order by open_day desc) + where rownum < {1}) O + where X.data_day(+) = o.open_day + UNION + select(select substr(f_data_time, 1, 8) data_day from t_index where f_part_code = '001') data_day, + a.f_curr_price curr_price, a.f_chg_type chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate, + a.F_net_CHG net_chg, b.f_stock_wanname + from t_kosdaq_online1 a, t_kosdaq_stock b + where a.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{0}' + and b.f_mkt_halt = 'N' + order by data_day desc"; + + public override IDataRequest buildData() + { + string bufQuery = string.Empty; + + if (mMarketType == 국내시장종류.KOSPI) + { + bufQuery = String.Format(queryKOSPI, this.mStockNameKorean, this.mDataLength.GetStringValue()); + } + else + { + bufQuery = String.Format(queryKOSDAQ, this.mStockNameKorean, this.mDataLength.GetStringValue()); + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } + +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Trading.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Trading.cs new file mode 100644 index 0000000..7a358e1 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/선그래프/Trading.cs @@ -0,0 +1,296 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// 10번컷 + /// + internal class Trading : ADataObject + { + + + public Trading(선그래프데이터분류 recvDataType) + { + this.mDataType = recvDataType; + } + + private 선그래프데이터분류 mDataType; + + #region 개인쿼리 + + string queryRetailNumber = @"select + '코스피' name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover))/100000000) amt + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE = '8000' + UNION + select + '코스닥' name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE = '8000' + union + select + '코스피200' name, + round((sum(F_SELL_turnover) / 100000000) - (sum(F_BUY_turnover) / 100000000)) as amt + from t_invest + where F_PART_CODE = '029' + and F_INVEST_CODE = '8000'"; + + string queryRetailGraph = @"select + '코스피' f_name, + f_data_time f_data_time, + round((F_SELL_turnover - F_BUY_turnover) / 100000000) price + from t_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE = '8000' + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + union + select + '코스닥' f_name, + f_data_time f_data_time, + round((F_SELL_turnover - F_BUY_turnover) / 100000000) price + from t_kosdaq_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE = '8000' + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + union + select + '코스피200' f_name, + f_data_time f_data_time, + round((F_SELL_turnover - F_BUY_turnover) / 100000000) price + from t_invest_his + where F_PART_CODE = '029' + and F_INVEST_CODE = '8000' + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + order by f_name, f_data_time"; + + #endregion + + #region "외국인" + + string queryForgienNumber = @"select + '코스피' name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover))/100000000) amt + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('9000', '9001') + UNION + select + '코스닥' name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('9000', '9001') + union + select + '코스피200' name, + round((sum(F_SELL_turnover) / 100000000) - (sum(F_BUY_turnover) / 100000000)) as amt + from t_invest + where F_PART_CODE = '029' + and F_INVEST_CODE in('9000', '9001')"; + + string queryForgienGraph = @"select + '코스피' f_name, + f_data_time f_data_time, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) price + from t_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('9000', '9001') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time + union + select + '코스닥' f_name, + f_data_time f_data_time, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) price + from t_kosdaq_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('9000', '9001') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time + union + select + '코스피200' f_name, + f_data_time f_data_time, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) price + from t_invest_his + where F_PART_CODE = '029' + and F_INVEST_CODE in('9000', '9001') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time + order by f_name, f_data_time"; + + #endregion + + #region "기관" + + string queryInstitutionalNumber = @"select + '코스피' f_name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover))/100000000) amt + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000') + group by f_part_code + UNION + select + '코스닥' f_name, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) amt + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000') + group by f_part_code + union + select + '코스피200' f_name, + round((sum(F_SELL_turnover) / 100000000) - (sum(F_BUY_turnover) / 100000000)) as amt + from t_invest + where F_PART_CODE = '029' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000')"; + + string queryInstitutionalGraph = @"select + '코스피' f_name, + f_data_time f_data_time, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) price + from t_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time + union + select + '코스닥' f_name, + f_data_time f_data_time, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) price + from t_kosdaq_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time + union + select + '코스피200' f_name, + f_data_time f_data_time, + round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000) price + from t_invest_his + where F_PART_CODE = '029' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time + order by f_name, f_data_time"; + + #endregion + + #region "코스피" + + string queryKOSPINumber = @"select + sum(decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover))/100000000),0) ) ""개인"", + sum(decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) ""외국인"", + sum(decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000))) ""기관"" + from t_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by f_invest_code"; + + string queryKOSPIGraph = @"select + f_data_time, sum(p_1) ""개인"", + sum(p_2) ""외국인"", + sum(p_3) ""기관"" + from( + select + f_data_time f_data_time, + decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_1, + decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_2, + decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000)) p_3 + from t_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time, f_invest_code + ) + group by f_data_time + order by f_data_time"; + + #endregion + + #region "코스닥" + + string queryKOSDAQNumber = @"select + sum(decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover))/100000000),0) ) ""개인"", + sum(decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0)) ""외국인"", + sum(decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000))) ""기관"" + from t_kosdaq_invest + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + group by f_invest_code"; + + string queryKOSDAQGraph = @"select + f_data_time, + sum(p_1) ""개인"", + sum(p_2) ""외국인"", + sum(p_3) ""기관"" + from( + select + f_data_time f_data_time, + decode(f_invest_code, '8000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_1, + decode(f_invest_code, '9000', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), '9001', round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000), 0) p_2, + decode(f_invest_code, '8000', 0, '9000', 0, '9001', 0, round((sum(F_SELL_turnover) - sum(F_BUY_turnover)) / 100000000)) p_3 + from t_kosdaq_invest_his + where F_PART_CODE = '001' + and F_INVEST_CODE in('1000', '2000', '3000', '3100', '4000', '5000', '6000', '7000', '8000', '9000', '9001') + and f_data_time like(select max(open_day) || '%' data_time from v_open_day) + group by f_data_time, f_invest_code + ) + group by f_data_time + order by f_data_time"; + + #endregion + + public override IDataRequest buildData() + { + + string bufQueryNumber = ""; + + string bufQueryGraph = ""; + + switch (this.mDataType) + { + case 선그래프데이터분류.개인매매동향: + bufQueryNumber = queryRetailNumber; + bufQueryGraph = queryRetailGraph; + break; + case 선그래프데이터분류.기관매매동향: + bufQueryNumber = queryInstitutionalNumber; + bufQueryGraph = queryInstitutionalGraph; + break; + case 선그래프데이터분류.외국인매매동향: + bufQueryNumber = queryForgienNumber; + bufQueryGraph = queryForgienGraph; + break; + case 선그래프데이터분류.코스피매매동향: + bufQueryNumber = queryKOSPINumber; + bufQueryGraph = queryKOSPIGraph; + break; + case 선그래프데이터분류.코스닥매매동향: + bufQueryNumber = queryKOSDAQNumber; + bufQueryGraph = queryKOSDAQGraph; + break; + default: + throw new Exception("잘못 참조한 데이터(매매동향에 없는 데이터)"); + } + + mRequestQuery.Add("현재지수", bufQueryNumber); + mRequestQuery.Add("그래프데이터", bufQueryGraph); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapAsia.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapAsia.cs new file mode 100644 index 0000000..f8b7f5d --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapAsia.cs @@ -0,0 +1,49 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class MapAsia : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"SELECT + '한국' NAME, + round(f_part_idx/100,2) curr_price, + round(f_part_chg/100,2) net_chg, + f_chg_type chg_type, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg)) * 100, 2) rate + FROM t_index + WHERE f_part_code = '001' + UNION + SELECT + decode(f_symb, 'SHS@000001', '중국', 'HSI@HSI', '홍콩', 'NII@NI225', '일본', 'TWS@TI01', '대만') NAME, + to_number(f_last) curr_price, + to_number(f_diff) net_chg, + f_sign chg_type, + to_number(f_rate) rate + FROM t_world_ix_eq_sise + WHERE f_symb in('SHS@000001', 'HSI@HSI', 'NII@NI225', 'TWS@TI01')"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapEurope.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapEurope.cs new file mode 100644 index 0000000..2ef97a8 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapEurope.cs @@ -0,0 +1,40 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class MapEurope : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"SELECT + decode(f_symb, 'LNS@FTSE100', '영국', 'XTR@DAX30', '독일', 'PAS@CAC40', '프랑스', 'ITI@FTSEMIB', '이탈리아') NAME, + to_number(f_last) curr_price, + to_number(f_diff) net_chg, + f_sign chg_type, + to_number(f_rate) rate + FROM t_world_ix_eq_sise + WHERE f_symb in('LNS@FTSE100', 'XTR@DAX30', 'PAS@CAC40', 'ITI@FTSEMIB')"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapUSA.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapUSA.cs new file mode 100644 index 0000000..c8208c6 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapUSA.cs @@ -0,0 +1,40 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class MapUSA : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"SELECT + decode(f_symb, 'DJI@DJI', '다우', 'NAS@IXIC', '나스닥', 'SPI@SPX', 'S&P') NAME, + to_number(f_last) curr_price, + to_number(f_diff) net_chg, + f_sign chg_type, + to_number(f_rate) rate + FROM t_world_ix_eq_sise + WHERE f_symb in('DJI@DJI', 'NAS@IXIC', 'SPI@SPX')"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapWorld.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapWorld.cs new file mode 100644 index 0000000..2b544f7 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/지도데이터/MapWorld.cs @@ -0,0 +1,49 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class MapWorld : ADataObject + { + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"SELECT + '한국' NAME, + round(f_part_idx / 100, 2) curr_price, + round(f_part_chg / 100, 2) net_chg, + f_chg_type chg_type, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg)) * 100, 2) rate + FROM t_index + WHERE f_part_code = '001' + UNION + SELECT + decode(f_symb, 'SHS@000001', '중국', 'HSI@HSI', '홍콩', 'NII@NI225', '일본', 'TWS@TI01', '대만', 'DJI@DJI', '다우', 'NAS@IXIC', '나스닥', 'SPI@SPX', 'S&P', 'LNS@FTSE100', '영국', 'XTR@DAX30', '독일', 'PAS@CAC40', '프랑스') NAME, + to_number(f_last) curr_price, + to_number(f_diff) net_chg, + f_sign chg_type, + to_number(f_rate) rate + FROM t_world_ix_eq_sise + WHERE f_symb in('SHS@000001', 'HSI@HSI', 'NII@NI225', 'TWS@TI01', 'DJI@DJI', 'NAS@IXIC', 'SPI@SPX', 'LNS@FTSE100', 'XTR@DAX30', 'PAS@CAC40')"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/ETF.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/ETF.cs new file mode 100644 index 0000000..3a4daea --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/ETF.cs @@ -0,0 +1,88 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class ETF : ADataObject + { + + internal ETF(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_curr_price curr_price, + a.f_net_chg net_chg, a.f_chg_type chg_type, + b.f_list_num * a.f_curr_price sigachong, + round((a.f_net_chg/decode(a.f_chg_type,'1', (a.f_curr_price-a.f_net_chg), + '2', (a.f_curr_price-a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price+a.f_net_chg), + '5', -1*(a.f_curr_price+a.f_net_chg)) ) * 100,2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price <> 0 + AND f_sect_code = 'EF' + ORDER BY sigachong DESC"; + + string queryKOSDAQ = @"select + b.f_stock_code, + b.f_stock_wanname, + d.f_curr_price, + d.f_chg_type, + d.f_net_chg, + round((d.f_net_chg / decode(d.f_chg_type, '1', d.f_curr_price - d.f_net_chg, + '2', d.f_curr_price - d.f_net_chg, + '3', d.f_curr_price, + '4', -1*(d.f_curr_price + d.f_net_chg), + '5', -1*(d.f_curr_price + d.f_net_chg))) * 100, 2) rate + from ( + select f_stock_code, max(f_low_price) f_low_price + from t_kosdaq_candle_history + where f_data_date between '{0}' and '{1}' + group by f_stock_code) a, + t_kosdaq_stock b, t_kosdaq_online1 d + where a.f_stock_code = b.f_stock_code + and d.f_mkt_halt = 'N' + and d.f_curr_price > 0 + and a.f_stock_code = d.f_stock_code + and a.f_low_price <= d.f_low_price order by rate desc"; + + + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_capital_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_capital_5dan.cs new file mode 100644 index 0000000..6c9551a --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_capital_5dan.cs @@ -0,0 +1,73 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_capital_5dan : Nxt_ADataObject + { + + internal Nxt_capital_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + // + } + + 국내시장종류 mDataType; + + #region 쿼리 + string queryNXT_KOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_curr_price curr_price, + a.f_net_chg net_chg, a.f_chg_type chg_type, + b.f_list_num * a.f_curr_price sigachong, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_online a, n_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + ORDER BY sigachong DESC"; + + string queryNXT_KOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_curr_price curr_price, + a.f_net_chg net_chg, a.f_chg_type chg_type, + b.f_list_num * a.f_curr_price sigachong, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_kosdaq_online a, n_kosdaq_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + ORDER BY sigachong DESC"; + + #endregion + + public override Nxt_IDataRequest Nxt_buildData() + { + + switch (this.mDataType) + { + case 국내시장종류.NXT_KOSPI: + Nxt_mRequestQuery.Add("", queryNXT_KOSPI); + break; + case 국내시장종류.NXT_KOSDAQ: + Nxt_mRequestQuery.Add("", queryNXT_KOSDAQ); + break; + } + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_high_overtime_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_high_overtime_5dan.cs new file mode 100644 index 0000000..46a7ffd --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_high_overtime_5dan.cs @@ -0,0 +1,80 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_high_overtime_5dan : Nxt_ADataObject + { + + internal Nxt_high_overtime_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + + string queryNXT_KOSPI = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_NAME wanname, a.f_net_chg net_chg, a.f_chg_type chg_type, a.f_curr_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_overtime a, n_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in ('1', '2') + ORDER BY rate DESC"; + + + string queryNXT_KOSDAQ = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_NAME wanname, + a.f_net_chg net_chg, + a.f_chg_type chg_type, + a.f_curr_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_kosdaq_overtime a, n_kosdaq_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in ('1', '2') + ORDER BY rate DESC"; + + #endregion + + public override Nxt_IDataRequest Nxt_buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.NXT_KOSPI: + Nxt_mRequestQuery.Add("", queryNXT_KOSPI); + break; + case 국내시장종류.NXT_KOSDAQ: + Nxt_mRequestQuery.Add("", queryNXT_KOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_low_overtime_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_low_overtime_5dan.cs new file mode 100644 index 0000000..a128c9f --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_low_overtime_5dan.cs @@ -0,0 +1,75 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_low_overtime_5dan : Nxt_ADataObject + { + + internal Nxt_low_overtime_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + string queryNXT_KOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, a.f_net_chg net_chg, + a.f_chg_type chg_type, a.f_curr_price, a.f_init_price, a.f_high_price, a.f_low_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_overtime a, n_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in('4', '5') + ORDER BY rate"; + + + string queryNXT_KOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, a.f_net_chg net_chg, + a.f_chg_type chg_type, a.f_curr_price, a.f_init_price, a.f_high_price, a.f_low_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_kosdaq_overtime a, n_kosdaq_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in('4', '5') + ORDER BY rate"; + + + #endregion + + public override Nxt_IDataRequest Nxt_buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.NXT_KOSPI: + Nxt_mRequestQuery.Add("", queryNXT_KOSPI); + break; + case 국내시장종류.NXT_KOSDAQ: + Nxt_mRequestQuery.Add("", queryNXT_KOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_lower_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_lower_5dan.cs new file mode 100644 index 0000000..8478f30 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_lower_5dan.cs @@ -0,0 +1,79 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_lower_5dan : Nxt_ADataObject + { + + internal Nxt_lower_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryNXT_KOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, a.f_curr_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_online a, n_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in('4', '5') + ORDER BY rate"; + + + + string queryNXT_KOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, a.f_curr_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_kosdaq_online a, n_kosdaq_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in('4', '5') + ORDER BY rate"; + + + + + #endregion + + public override Nxt_IDataRequest Nxt_buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.NXT_KOSPI: + Nxt_mRequestQuery.Add("", queryNXT_KOSPI); + break; + case 국내시장종류.NXT_KOSDAQ: + Nxt_mRequestQuery.Add("", queryNXT_KOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_upper_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_upper_5dan.cs new file mode 100644 index 0000000..f97a9b2 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_upper_5dan.cs @@ -0,0 +1,79 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_upper_5dan : Nxt_ADataObject + { + + internal Nxt_upper_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryNXT_KOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, + a.f_curr_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_online a, n_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in('1', '2') + ORDER BY rate DESC"; + + + + string queryNXT_KOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, + a.f_curr_price, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_kosdaq_online a, n_kosdaq_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + AND a.f_chg_type in('1', '2') + ORDER BY rate DESC"; + + + #endregion + + public override Nxt_IDataRequest Nxt_buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.NXT_KOSPI: + Nxt_mRequestQuery.Add("", queryNXT_KOSPI); + break; + case 국내시장종류.NXT_KOSDAQ: + Nxt_mRequestQuery.Add("", queryNXT_KOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_vol_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_vol_5dan.cs new file mode 100644 index 0000000..cb2c9af --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/Nxt_vol_5dan.cs @@ -0,0 +1,77 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_vol_5dan : Nxt_ADataObject + { + + internal Nxt_vol_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryNXT_KOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, + a.f_curr_price, a.f_net_vol, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_online a, n_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + ORDER BY a.F_NET_VOL desc "; + + + + string queryNXT_KOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, + a.f_curr_price, a.f_net_vol, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate + FROM n_kosdaq_online a, n_kosdaq_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price != 0 + ORDER BY a.F_NET_VOL desc"; + + + #endregion + + public override Nxt_IDataRequest Nxt_buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.NXT_KOSPI: + Nxt_mRequestQuery.Add("", queryNXT_KOSPI); + break; + case 국내시장종류.NXT_KOSDAQ: + Nxt_mRequestQuery.Add("", queryNXT_KOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_5dan.cs new file mode 100644 index 0000000..596d6f3 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_5dan.cs @@ -0,0 +1,114 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class capital_5dan : ADataObject + { + + internal capital_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + // + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 +// string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + // a.f_curr_price curr_price, + // a.f_net_chg net_chg, a.f_chg_type chg_type, + // b.f_list_num * a.f_curr_price sigachong, + // round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + // '2', (a.f_curr_price - a.f_net_chg), + // '3', (a.f_curr_price), + // '4', -1*(a.f_curr_price + a.f_net_chg), + // '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + // FROM t_online1 a, t_stock b + // WHERE b.f_mkt_halt = 'N' + // AND b.f_stock_nickname is not null + // AND a.f_stock_code = b.f_stock_code + //AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + // AND a.f_curr_price < > 0 + // ORDER BY sigachong DESC"; + + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_curr_price curr_price, + a.f_net_chg net_chg, a.f_chg_type chg_type, + b.f_list_num * a.f_curr_price sigachong, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND a.f_curr_price < > 0 + ORDER BY sigachong DESC"; + + + + // string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + // a.f_curr_price curr_price, + // a.f_net_chg net_chg, a.f_chg_type chg_type, + // b.f_list_num * a.f_curr_price sigachong, + // round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + // '2', (a.f_curr_price - a.f_net_chg), + // '3', (a.f_curr_price), + // '4', -1*(a.f_curr_price + a.f_net_chg), + // '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + // FROM t_kosdaq_online1 a, t_kosdaq_stock b + // WHERE b.f_mkt_halt = 'N' + // AND b.f_stock_nickname is not null + // AND a.f_stock_code = b.f_stock_code + //AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + // AND a.f_curr_price < > 0 + // ORDER BY sigachong DESC"; + string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_curr_price curr_price, + a.f_net_chg net_chg, a.f_chg_type chg_type, + b.f_list_num * a.f_curr_price sigachong, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND a.f_curr_price < > 0 + ORDER BY sigachong DESC"; + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + return this; + } + + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_forecast_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_forecast_5dan.cs new file mode 100644 index 0000000..96a55ed --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/capital_forecast_5dan.cs @@ -0,0 +1,116 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class capital_forecast_5dan : ADataObject + { + + internal capital_forecast_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_fore_price curr_price, + ABS((a.f_fore_price - c.f_final_price)) net_chg, + CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE + CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, + b.F_LIST_NUM * a.f_fore_price sigachong, + round(((a.f_fore_price - c.f_final_price) / c.f_final_price)* 100, 2) rate + FROM t_online1_call a, t_stock b, t_batch_day c + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_fore_price <> 0 + AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 + ORDER BY sigachong DESC"; + +//////// string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, +//////// b.F_STOCK_WANNAME wanname, +//////// a.f_fore_price curr_price, +//////// ABS((a.f_fore_price - c.f_final_price)) net_chg, +//////// CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE +//////// CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, +//////// b.F_LIST_NUM * a.f_fore_price sigachong, +//////// ABS(round(((a.f_fore_price - c.f_final_price) / c.f_final_price)* 100, 2)) rate +//////// FROM t_online1 a, t_stock b, t_batch_day c +//////// WHERE b.f_mkt_halt = 'N' +//////// AND b.f_stock_nickname is not null +//////// AND a.f_stock_code = b.f_stock_code +//////// AND a.f_fore_price <> 0 +////////AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') +//////// AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 +//////// ORDER BY sigachong DESC"; + + + string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_fore_price curr_price, + ABS((a.f_fore_price - c.f_final_price)) net_chg, + CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE + CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, + b.F_LIST_NUM * a.f_fore_price sigachong, + round(((a.f_fore_price - c.f_final_price) / c.f_final_price)* 100, 2) rate + FROM t_kosdaq_online1_call a, t_kosdaq_stock b, t_kosdaq_batch_day c + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_fore_price < > 0 + AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 + ORDER BY sigachong DESC"; + +//// string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, +//// b.F_STOCK_WANNAME wanname, +//// a.f_fore_price curr_price, +//// ABS((a.f_fore_price - c.f_final_price)) net_chg, +//// CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE +//// CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, +//// b.F_LIST_NUM * a.f_fore_price sigachong, +//// round(((a.f_fore_price - c.f_final_price) / c.f_final_price)* 100, 2) rate +//// FROM t_kosdaq_online1 a, t_kosdaq_stock b, t_kosdaq_batch_day c +//// WHERE b.f_mkt_halt = 'N' +//// AND b.f_stock_nickname is not null +//// AND a.f_stock_code = b.f_stock_code +//// AND a.f_fore_price < > 0 +////AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') +//// AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 +//// ORDER BY sigachong DESC"; + + + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high52_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high52_5dan.cs new file mode 100644 index 0000000..bf08e5c --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high52_5dan.cs @@ -0,0 +1,101 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class high52_5dan : ADataObject + { + + internal high52_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryKOSPI = @"select + b.f_stock_code, + b.f_stock_wanname, + d.f_curr_price, + d.f_chg_type, + d.f_net_chg, + round((d.f_net_chg / decode(d.f_chg_type, '1', d.f_curr_price - d.f_net_chg, + '2', d.f_curr_price - d.f_net_chg, + '3', d.f_curr_price, + '4', -1*(d.f_curr_price + d.f_net_chg), + '5', -1*(d.f_curr_price + d.f_net_chg))) * 100, 2) rate + from + (select f_stock_code, max(f_high_price) f_high_price + from t_candle_history + where f_data_date between '{0}' and '{1}' + group by f_stock_code) a, + t_stock b, t_online1 d + where a.f_stock_code = b.f_stock_code + and d.f_mkt_halt = 'N' + and d.f_curr_price > 0 + and a.f_stock_code = d.f_stock_code +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + and a.f_high_price <= d.f_high_price order by rate desc"; + + + + string queryKOSDAQ = @"select + b.f_stock_code, + b.f_stock_wanname, + d.f_curr_price, + d.f_chg_type, + d.f_net_chg, + round((d.f_net_chg / decode(d.f_chg_type, '1', d.f_curr_price - d.f_net_chg, + '2', d.f_curr_price - d.f_net_chg, + '3', d.f_curr_price, + '4', -1*(d.f_curr_price + d.f_net_chg), + '5', -1*(d.f_curr_price + d.f_net_chg))) * 100, 2) rate + from ( + select f_stock_code, max(f_high_price) f_high_price + from t_kosdaq_candle_history + where f_data_date between '{0}' and '{1}' + group by f_stock_code) a, + t_kosdaq_stock b, t_kosdaq_online1 d + where a.f_stock_code = b.f_stock_code + and d.f_mkt_halt = 'N' + and d.f_curr_price > 0 + and a.f_stock_code = d.f_stock_code +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + and a.f_high_price <= d.f_high_price order by rate desc"; + + + + + #endregion + + public override IDataRequest buildData() + { + + string bufStartDay = DateTime.Now.ToString("yyyyMMdd"); + string bufEndDay = (DateTime.Now - TimeSpan.FromDays(52*7)).ToString("yyyyMMdd"); + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", string.Format(queryKOSPI, bufEndDay, bufStartDay)); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", string.Format(queryKOSDAQ, bufEndDay, bufStartDay)); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high_overtime_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high_overtime_5dan.cs new file mode 100644 index 0000000..0308705 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/high_overtime_5dan.cs @@ -0,0 +1,119 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class high_overtime_5dan : ADataObject + { + + internal high_overtime_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + //string queryKOSPI = @"SELECT DISTINCT + // b.f_stock_code stock_code, + // b.F_STOCK_WANNAME wanname, + // a.f_net_chg net_chg, + // a.f_chg_type chg_type, + // a.f_curr_price, + // round((a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, '2', a.f_curr_price - a.f_net_chg)) * 100, 2) rate + // FROM t_overtime_sise a, t_stock b + // WHERE b.f_mkt_halt = 'N' + // AND b.f_stock_nickname is not null + // AND a.f_stock_code = b.f_stock_code + // AND a.f_curr_price < > 0 + // AND a.f_chg_type in('1', '2') + // AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + // ORDER BY rate DESC"; + + string queryKOSPI = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, + a.f_chg_type chg_type, + a.f_curr_price, + round((a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, '2', a.f_curr_price - a.f_net_chg)) * 100, 2) rate + FROM t_overtime_sise a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 + AND a.f_chg_type in('1', '2') + AND b.f_sect_code = 'ST' + ORDER BY rate DESC"; + + + + // string queryKOSDAQ = @"SELECT DISTINCT + // b.f_stock_code stock_code, + // b.F_STOCK_WANNAME wanname, + // a.f_net_chg net_chg, + // a.f_chg_type chg_type, + // a.f_curr_price, + // round( + // a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, + // '2', a.f_curr_price - a.f_net_chg, '3', a.f_curr_price, '4', + // -1 * (a.f_curr_price + a.f_net_chg), '5', + // -1 * (a.f_curr_price + a.f_net_chg)) * 100, 2) rate + // FROM t_kosdaq_overtime_sise a, t_kosdaq_stock b + // WHERE b.f_mkt_halt = 'N' + // AND b.f_stock_nickname is not null + // AND a.f_stock_code = b.f_stock_code + // AND a.f_curr_price < > 0 + // AND a.f_chg_type in('1', '2') + //AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + // ORDER BY rate DESC"; + + + string queryKOSDAQ = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, + a.f_chg_type chg_type, + a.f_curr_price, + round( + a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, + '2', a.f_curr_price - a.f_net_chg, '3', a.f_curr_price, '4', + -1 * (a.f_curr_price + a.f_net_chg), '5', + -1 * (a.f_curr_price + a.f_net_chg)) * 100, 2) rate + FROM t_kosdaq_overtime_sise a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 + AND a.f_chg_type in('1', '2') + AND b.f_sect_code = 'ST' + ORDER BY rate DESC"; + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/kospi200.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/kospi200.cs new file mode 100644 index 0000000..f173eb3 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/kospi200.cs @@ -0,0 +1,113 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class kospi200 : ADataObject + { + + internal kospi200(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + //string queryKOSPI = @"select + // b.f_stock_code, + // b.f_stock_wanname, + // d.f_curr_price, + // d.f_chg_type, + // d.f_net_chg, + // round((d.f_net_chg / decode(d.f_chg_type, '1', d.f_curr_price - d.f_net_chg, + // '2', d.f_curr_price - d.f_net_chg, + // '3', d.f_curr_price, + // '4', -1*(d.f_curr_price + d.f_net_chg), + // '5', -1*(d.f_curr_price + d.f_net_chg))) * 100, 2) rate + // from + // (select f_stock_code, max(f_low_price) f_low_price + // from t_candle_history + // where f_data_date between '{0}' and '{1}' + // group by f_stock_code) a, + // t_stock b, t_online1 d + // where a.f_stock_code = b.f_stock_code + // and d.f_mkt_halt = 'N' + // and d.f_curr_price > 0 + // and a.f_stock_code = d.f_stock_code + // and a.f_low_price <= d.f_low_price order by rate"; + + + + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_curr_price curr_price, + a.f_net_chg net_chg, a.f_chg_type chg_type, + b.f_list_num* a.f_curr_price sigachong, + round((a.f_net_chg/decode(a.f_chg_type,'1', (a.f_curr_price-a.f_net_chg), + '2', (a.f_curr_price-a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price+a.f_net_chg), + '5', -1*(a.f_curr_price+a.f_net_chg)) ) * 100,2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price<> 0 + AND b.f_kospi200_gubun<> '0' + ORDER BY sigachong DESC"; + + string queryKOSDAQ = @"select + b.f_stock_code, + b.f_stock_wanname, + d.f_curr_price, + d.f_chg_type, + d.f_net_chg, + round((d.f_net_chg / decode(d.f_chg_type, '1', d.f_curr_price - d.f_net_chg, + '2', d.f_curr_price - d.f_net_chg, + '3', d.f_curr_price, + '4', -1*(d.f_curr_price + d.f_net_chg), + '5', -1*(d.f_curr_price + d.f_net_chg))) * 100, 2) rate + from ( + select f_stock_code, max(f_low_price) f_low_price + from t_kosdaq_candle_history + where f_data_date between '{0}' and '{1}' + group by f_stock_code) a, + t_kosdaq_stock b, t_kosdaq_online1 d + where a.f_stock_code = b.f_stock_code + and d.f_mkt_halt = 'N' + and d.f_curr_price > 0 + and a.f_stock_code = d.f_stock_code + and a.f_low_price <= d.f_low_price order by rate desc"; + + + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low52_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low52_5dan.cs new file mode 100644 index 0000000..ddfbc4a --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low52_5dan.cs @@ -0,0 +1,101 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class low52_5dan : ADataObject + { + + internal low52_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryKOSPI = @"select + b.f_stock_code, + b.f_stock_wanname, + d.f_curr_price, + d.f_chg_type, + d.f_net_chg, + round((d.f_net_chg / decode(d.f_chg_type, '1', d.f_curr_price - d.f_net_chg, + '2', d.f_curr_price - d.f_net_chg, + '3', d.f_curr_price, + '4', -1*(d.f_curr_price + d.f_net_chg), + '5', -1*(d.f_curr_price + d.f_net_chg))) * 100, 2) rate + from + (select f_stock_code, max(f_low_price) f_low_price + from t_candle_history + where f_data_date between '{0}' and '{1}' + group by f_stock_code) a, + t_stock b, t_online1 d + where a.f_stock_code = b.f_stock_code + and d.f_mkt_halt = 'N' + and d.f_curr_price > 0 + and a.f_stock_code = d.f_stock_code +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + and a.f_low_price <= d.f_low_price order by rate"; + + + + string queryKOSDAQ = @"select + b.f_stock_code, + b.f_stock_wanname, + d.f_curr_price, + d.f_chg_type, + d.f_net_chg, + round((d.f_net_chg / decode(d.f_chg_type, '1', d.f_curr_price - d.f_net_chg, + '2', d.f_curr_price - d.f_net_chg, + '3', d.f_curr_price, + '4', -1*(d.f_curr_price + d.f_net_chg), + '5', -1*(d.f_curr_price + d.f_net_chg))) * 100, 2) rate + from ( + select f_stock_code, max(f_low_price) f_low_price + from t_kosdaq_candle_history + where f_data_date between '{0}' and '{1}' + group by f_stock_code) a, + t_kosdaq_stock b, t_kosdaq_online1 d + where a.f_stock_code = b.f_stock_code + and d.f_mkt_halt = 'N' + and d.f_curr_price > 0 + and a.f_stock_code = d.f_stock_code +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + and a.f_low_price <= d.f_low_price order by rate desc"; + + + + + #endregion + + public override IDataRequest buildData() + { + + string bufStartDay = DateTime.Now.ToString("yyyyMMdd"); + string bufEndDay = (DateTime.Now - TimeSpan.FromDays(52 * 7)).ToString("yyyyMMdd"); + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", string.Format(queryKOSPI, bufEndDay, bufStartDay)); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", string.Format(queryKOSDAQ, bufEndDay, bufStartDay)); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low_overtime_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low_overtime_5dan.cs new file mode 100644 index 0000000..f1d6722 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/low_overtime_5dan.cs @@ -0,0 +1,125 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class low_overtime_5dan : ADataObject + { + + internal low_overtime_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + // string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, + // b.F_STOCK_WANNAME wanname, + // a.f_net_chg net_chg, + // a.f_chg_type chg_type, + // a.f_curr_price, + // a.f_init_price, + // a.f_high_price, + // a.f_low_price, + // round((a.f_net_chg / decode(a.f_chg_type, '4', -1 * (a.f_curr_price + a.f_net_chg), + // '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + // FROM t_overtime_sise a, t_stock b + // WHERE b.f_mkt_halt = 'N' + // AND b.f_stock_nickname is not null + // AND a.f_stock_code = b.f_stock_code + // AND a.f_curr_price < > 0 + //AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + // AND a.f_chg_type in('4', '5') + // ORDER BY rate"; + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, + a.f_chg_type chg_type, + a.f_curr_price, + a.f_init_price, + a.f_high_price, + a.f_low_price, + round((a.f_net_chg / decode(a.f_chg_type, '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_overtime_sise a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 + AND b.f_sect_code = 'ST' + AND a.f_chg_type in('4', '5') + ORDER BY rate"; + + + + // string queryKOSDAQ = @"SELECT DISTINCT + // b.f_stock_code stock_code, + // b.F_STOCK_WANNAME wanname, + // a.f_net_chg net_chg, + // a.f_chg_type chg_type, + // a.f_curr_price, + // a.f_init_price, + // a.f_high_price, + // a.f_low_price, + // round((a.f_net_chg / decode('4', a.f_curr_price + a.f_net_chg, + // '5', a.f_curr_price + a.f_net_chg) * -1) * 100, 2) rate + // FROM t_kosdaq_overtime_sise a, t_kosdaq_stock b + // WHERE b.f_mkt_halt = 'N' + // AND b.f_stock_nickname is not null + // AND a.f_stock_code = b.f_stock_code + // AND a.f_curr_price < > 0 + //AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + // AND a.f_chg_type in('4', '5') + // ORDER BY rate "; + + string queryKOSDAQ = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, + a.f_chg_type chg_type, + a.f_curr_price, + a.f_init_price, + a.f_high_price, + a.f_low_price, + round((a.f_net_chg / decode('4', a.f_curr_price + a.f_net_chg, + '5', a.f_curr_price + a.f_net_chg) * -1) * 100, 2) rate + FROM t_kosdaq_overtime_sise a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 + AND b.f_sect_code = 'ST' + AND a.f_chg_type in('4', '5') + ORDER BY rate "; + + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/lower_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/lower_5dan.cs new file mode 100644 index 0000000..1c58967 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/lower_5dan.cs @@ -0,0 +1,87 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class lower_5dan : ADataObject + { + + internal lower_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, + a.f_curr_price, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_online1 a, t_stock b, t_batch_day c + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND a.f_chg_type in('4', '5') + ORDER BY rate"; + + + + string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, a.f_net_vol net_vol, a.F_NET_TURNOVER, a.f_chg_type chg_type, + b.F_LIST_NUM * A.F_CURR_PRICE sigachong, + a.f_init_price, + a.f_high_price, + a.f_low_price, + a.f_curr_price, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND a.f_chg_type in('4', '5') + ORDER BY rate"; + + + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/suggest_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/suggest_5dan.cs new file mode 100644 index 0000000..ea39a83 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/suggest_5dan.cs @@ -0,0 +1,77 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class suggest_5dan : ADataObject + { + + internal suggest_5dan(List recvStockList) + { + this.mStockCodeList = recvStockList; + } + + //국내시장종류 mDataType; + + List mStockCodeList = null; + + #region 쿼리 + //코스피 상단 + string query = @"SELECT 'KOSPI' gubun, b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_curr_price CURR_PRICE, + a.f_net_chg NET_CHG, + a.f_chg_type CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_stock_code = '{0}' + union + SELECT 'KOSDAQ' gubun, b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_curr_price CURR_PRICE, + a.f_net_chg NET_CHG, + a.f_chg_type CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_stock_code = '{0}' "; + + + + + #endregion + + public override IDataRequest buildData() + { + + + mStockCodeList.ForEach(s => + { + mRequestQuery.Add(s, string.Format(query, s)); + }); + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_5dan.cs new file mode 100644 index 0000000..95a2c06 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_5dan.cs @@ -0,0 +1,76 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class theme_5dan : ADataObject + { + + internal theme_5dan(List recvStockList) + { + this.mStockCodeList = recvStockList; + } + + + List mStockCodeList = null; + + #region 쿼리 + //코스피 상단 + string query = @"SELECT 'KOSPI' gubun, b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_curr_price CURR_PRICE, + a.f_net_chg NET_CHG, + a.f_chg_type CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_stock_wanname in('{0}') + union + SELECT 'KOSDAQ' gubun, b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_curr_price CURR_PRICE, + a.f_net_chg NET_CHG, + a.f_chg_type CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_stock_wanname in('{0}')"; + + + + + #endregion + + public override IDataRequest buildData() + { + + + mStockCodeList.ForEach(s => + { + mRequestQuery.Add(s, string.Format(query, s)); + }); + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_yesang_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_yesang_5dan.cs new file mode 100644 index 0000000..7d71dfc --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/theme_yesang_5dan.cs @@ -0,0 +1,102 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class theme_yesang_5dan : ADataObject + { + + internal theme_yesang_5dan(List recvStockList) + { + this.mStockCodeList = recvStockList; + } + + + List mStockCodeList = null; + + #region 쿼리 + //코스피 상단 + string query = @"SELECT 'KOSPI' gubun, b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_fore_price CURR_PRICE, + ABS((a.f_fore_price - c.f_final_price)) net_chg, + CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE + CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, + ABS(round(((a.f_fore_price - c.f_final_price) / c.f_final_price), 4) * 100) rate + FROM t_online1_call a, t_stock b, t_batch_day c + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_fore_price < > 0 + AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 + AND b.f_stock_code = '{0}' + union + SELECT 'KOSDAQ' gubun, b.f_stock_code STOCK_CODE, + b.f_stock_wanname STOCK_NAME, + a.f_fore_price CURR_PRICE, + ABS((a.f_fore_price - c.f_final_price)) net_chg, + CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE + CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, + ABS(round(((a.f_fore_price - c.f_final_price) / c.f_final_price), 4) * 100) rate + FROM t_kosdaq_online1_call a, t_kosdaq_stock b, t_kosdaq_batch_day c + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_fore_price < > 0 + AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 + AND b.f_stock_code = '{0}' "; + + + //////////// string query = @"SELECT 'KOSPI' gubun, b.f_stock_code STOCK_CODE, + ////////////b.f_stock_wanname STOCK_NAME, + ////////////a.f_fore_price CURR_PRICE, + ////////////ABS((a.f_fore_price - c.f_final_price)) net_chg, + //////////// CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE + ////////////CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, + ////////////ABS(round(((a.f_fore_price - c.f_final_price) / c.f_final_price), 4) * 100) rate + //////////// FROM t_online1 a, t_stock b, t_batch_day c + ////////////WHERE b.f_mkt_halt = 'N' + ////////////AND b.f_stock_nickname is not null + ////////////AND a.f_stock_code = b.f_stock_code + ////////////AND a.f_fore_price < > 0 + ////////////AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 + ////////////AND b.f_stock_code = '{0}' + ////////////union + ////////////SELECT 'KOSDAQ' gubun, b.f_stock_code STOCK_CODE, + ////////////b.f_stock_wanname STOCK_NAME, + ////////////a.f_fore_price CURR_PRICE, + ////////////ABS((a.f_fore_price - c.f_final_price)) net_chg, + //////////// CASE WHEN(a.f_fore_price - c.f_final_price) > 0 THEN '2' ELSE + ////////////CASE WHEN(a.f_fore_price - c.f_final_price) < 0 THEN '5' ELSE '3' END END CHG_TYPE, + //////////// ABS(round(((a.f_fore_price - c.f_final_price) / c.f_final_price), 4) * 100) rate + //////////// FROM t_kosdaq_online1 a, t_kosdaq_stock b, t_kosdaq_batch_day c + ////////////WHERE b.f_mkt_halt = 'N' + ////////////AND b.f_stock_nickname is not null + ////////////AND a.f_stock_code = b.f_stock_code + ////////////AND a.f_fore_price < > 0 + ////////////AND c.f_stock_code = a.f_stock_code AND c.f_final_price < > 0 + ////////////AND b.f_stock_code = '{0}' "; + + + + #endregion + + public override IDataRequest buildData() + { + + + mStockCodeList.ForEach(s => + { + mRequestQuery.Add(s, string.Format(query, s)); + }); + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upjong_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upjong_5dan.cs new file mode 100644 index 0000000..7b8cb9b --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upjong_5dan.cs @@ -0,0 +1,71 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class upjong_5dan : ADataObject + { + + internal upjong_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryKOSPI = @"select + b.f_part_name, + a.F_PART_IDX/100 part_idx, + a.F_CHG_TYPE, + a.F_PART_CHG/100 part_chg, + round(a.f_part_chg / decode(a.f_chg_type, '+', (a.f_part_idx / 100) - (a.f_part_chg / 100), '-', (a.f_part_idx / 100) + (a.f_part_chg / 100)), 2) rate + from t_index a, t_part b + where a.f_part_code = b.f_part_code and a.f_part_code <> '001' + order by a.f_part_code"; + + + + string queryKOSDAQ = @"select + b.f_part_name, + a.F_PART_IDX/100 part_idx, + a.F_CHG_TYPE, + a.F_PART_CHG/100 part_chg, + round(a.f_part_chg / decode(a.f_chg_type, '+', (a.f_part_idx / 100) - (a.f_part_chg / 100), '-', (a.f_part_idx / 100) + (a.f_part_chg / 100)), 2) rate + from t_kosdaq_index a, t_kosdaq_part b + where a.f_part_code = b.f_part_code and a.f_part_code <> '001' + order by a.f_part_code"; + + + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upper_5dan.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upper_5dan.cs new file mode 100644 index 0000000..536ea59 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판5단/upper_5dan.cs @@ -0,0 +1,87 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class upper_5dan : ADataObject + { + + internal upper_5dan(국내시장종류 recvDataType) + { + this.mDataType = recvDataType; + + } + + 국내시장종류 mDataType; + + #region 쿼리 + //코스피 상단 + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, a.f_chg_type chg_type, + a.f_curr_price, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND a.f_chg_type in('1', '2') + ORDER BY rate DESC"; + + + + string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, a.f_net_vol net_vol, a.F_NET_TURNOVER, a.f_chg_type chg_type, + b.F_LIST_NUM * A.F_CURR_PRICE sigachong, + a.f_init_price, + a.f_high_price, + a.f_low_price, + a.f_curr_price, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 +AND b.f_sect_code in ( 'ST', 'FS','DR', 'RT', 'IF') + AND a.f_chg_type in('1', '2') + ORDER BY rate DESC"; + + + + + #endregion + + public override IDataRequest buildData() + { + + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + mRequestQuery.Add("", queryKOSPI); + break; + case 국내시장종류.KOSDAQ: + mRequestQuery.Add("", queryKOSDAQ); + break; + } + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/DataObject_3PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/DataObject_3PAN.cs new file mode 100644 index 0000000..6d4ea3c --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/DataObject_3PAN.cs @@ -0,0 +1,471 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class DataObject_3PAN : ADataObject + { + + internal DataObject_3PAN(판3데이터분류 recvDataType) + { + this.mDataType = recvDataType; + } + + 판3데이터분류 mDataType; + + #region "쿼리" + + string query주요지수200 = @"SELECT 'KOSPI' name, f_part_idx / 100 part_idx, f_chg_type chg_type, ABS(f_part_chg / 100) part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, + '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM t_index + WHERE f_part_code = '001' + union + + SELECT '코스닥' name, f_part_idx / 100 part_idx, f_chg_type chg_type, ABS(f_part_chg / 100) part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, + '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM T_KOSDAQ_INDEX + WHERE f_part_code = '001' + union + + SELECT '코스피200' name, f_part_idx / 100 part_idx, f_chg_type chg_type, ABS(f_part_chg / 100) part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, + '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM T_200_INDEX + WHERE f_part_code = '029'"; + + string query주요지수선물 = @"SELECT 'KOSPI' name,f_part_idx/100 part_idx, f_chg_type chg_type, f_part_chg/100 part_chg, + round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), + '-', (f_part_idx / 100) + (f_part_chg / 100), 1), 2) rate + FROM t_index + WHERE f_part_code = '001' + union + SELECT 'KOSQ' name, f_part_idx / 100 part_idx, f_chg_type chg_type, f_part_chg / 100 part_chg, + round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), + '-', (f_part_idx / 100) + (f_part_chg / 100), 1), 2) rate + FROM T_KOSDAQ_INDEX + WHERE f_part_code = '001' + union + SELECT '선물' name, part_idx part_idx, chg_type, ABS(part_chg) part_chg, + ABS(round(part_chg / decode(chg_type, '+', (part_idx / 100) - (part_chg / 100), + '-', (part_idx / 100) + (part_chg / 100), 1), 2)) rate + FROM(SELECT decode(a.f_curr_price,0, b.F_JUN_LAST_PRICE/100, a.f_curr_price/100) part_idx, + decode(a.f_curr_price, 0, 0, (a.f_curr_price - b.F_JUN_LAST_PRICE*100)/100) part_chg, + decode(a.f_curr_price, 0, ' ', decode(sign(a.f_curr_price -b.F_JUN_LAST_PRICE*100),1,'+',-1,'-',0,' ')) chg_type + FROM t_sunmul_online a, t_sunmul_batch b + WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_seq = 1 + AND b.f_market_date = (select max(OPEN_DAY) from v_open_day) + AND b.F_MONTH_GUBUN = '1')"; + + + string query예상지수200 = @"SELECT 'KOSPI' name,f_part_idx/100 part_idx, f_chg_type chg_type, ABS(f_part_chg/100) part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, + '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM t_fo_index + WHERE f_part_code = '001' + UNION + SELECT '코스닥' name, f_part_idx / 100 part_idx, f_chg_type chg_type, ABS(f_part_chg / 100) part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, + '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM T_KOSDAQ_FO_INDEX + WHERE f_part_code = '001' + UNION + SELECT '코스피200' name, f_part_idx / 100 part_idx, f_chg_type chg_type, ABS(f_part_chg / 100) part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, + '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM T_200_FO_INDEX + WHERE f_part_code = '029'"; + + + string query예상지수선물 = @"SELECT 'KOSPI' name,f_part_idx/100 part_idx, f_chg_type chg_type, f_part_chg/100 part_chg, + round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), + '-', (f_part_idx / 100) + (f_part_chg / 100),1), 2) rate + FROM t_fo_index + WHERE f_part_code = '001' + UNION + SELECT 'KOSQ' name, f_part_idx / 100 part_idx, f_chg_type chg_type, f_part_chg / 100 part_chg, + round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), + '-', (f_part_idx / 100) + (f_part_chg / 100),1), 2) rate + FROM T_KOSDAQ_FO_INDEX + WHERE f_part_code = '001' + UNION + SELECT '선물' name, part_idx part_idx, chg_type, ABS(part_chg) part_chg, + ABS(round(part_chg / decode(chg_type, '+', (part_idx / 100) - (part_chg / 100), + '-', (part_idx / 100) + (part_chg / 100),1), 2)) rate + FROM(SELECT decode(a.f_fo_price,0, b.F_JUN_LAST_PRICE, a.f_fo_price) part_idx, + decode(a.f_fo_price, 0, 0, (a.f_fo_price - b.F_JUN_LAST_PRICE)/100) part_chg, + decode(a.f_fo_price, 0, ' ', decode(sign(a.f_fo_price -b.F_JUN_LAST_PRICE),1,'+',-1,'-',0,' ')) chg_type + FROM t_sunmul_online a, t_sunmul_batch b +WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_seq = 1 + AND b.f_market_date = (select max(OPEN_DAY) from v_open_day) + AND b.F_MONTH_GUBUN = '1')"; + + + + + string query미국 = @"select decode(a.f_symb, 'DJI@DJI', 1, + 'NAS@IXIC', 2, + 'SPI@SPX', 3) ss, + a.f_input_name name, round(b.f_last, 2) part_idx, b.f_sign chg_type, round(b.f_diff, 2) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('DJI@DJI', 'NAS@IXIC', 'SPI@SPX')"; + + + string query중화권 = @"select decode(a.f_symb, 'HSI@HSI', 1, + 'SHS@000001', 2, + 'TWS@TI01', 3) ss, + a.f_input_name name, round(b.f_last, 2) part_idx, b.f_sign chg_type, ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('SHS@000001', 'HSI@HSI', 'TWS@TI01') + order by ss"; + + + string query유럽 = @"select decode(a.f_symb, 'LNS@FTSE100', 1, + 'PAS@CAC40', 2, + 'XTR@DAX30', 3) ss, + a.f_input_name name, round(b.f_last, 2) part_idx, b.f_sign chg_type, ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('PAS@CAC40', 'XTR@DAX30', 'LNS@FTSE100') + order by ss"; + + + string query아시아 = @"select decode(a.f_symb, 'SHS@000001', 1, + 'TWS@TI01', 2, + 'NII@NI225', 3) ss, + a.f_input_name name, round(b.f_last, 2) part_idx, b.f_sign chg_type, ABS(round(b.f_diff, 2)) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('SHS@000001', 'TWS@TI01', 'NII@NI225') + order by ss"; + + + string query달러환율 = @"select decode(a.f_symb, 'USDJPYCOMP', 1, + 'EURUSDCOMP', 2, + 'USDCNYCOMP', 3) ss, + a.f_input_name name, ABS(b.f_last) part_idx, + ABS(b.f_diff) part_chg, + case when to_number(b.f_diff) > 0 then '+' when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate, 2) rate + from t_world_forex_master a, t_world_forex_sise b + where a.f_symb = b.f_symb + and a.f_symb in('USDJPYCOMP', 'EURUSDCOMP', 'USDCNYCOMP') --USDJPYCOMP 엔, USDCNYCOMP 위안화, EURUSDCOMP유로 + order by ss"; + +// string query원환율 = @"select decode(a.f_input_code,'A09','원/달러','A10','원/엔','A91','원/유로') name, + // a.f_curr_price part_idx, a.f_chg_type chg_type, ABS(a.f_net_chg) part_chg, + // round(a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price / 100) - (ABS(a.f_net_chg) / 100), + // '-', (a.f_curr_price / 100) + ((a.f_net_chg) / 100)), 2) rate + // from t_input_index a, t_input_code b + //where a.f_input_code in('A09', 'A10', 'A91') + // and a.f_input_code = b.f_input_code + // order by a.f_input_code"; + string query원환율 = @"select decode(a.f_input_code,'A09','원/달러','A10','원/엔','A91','원/유로') name, + a.f_curr_price part_idx, a.f_chg_type chg_type, ABS(a.f_net_chg) part_chg, + round(a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price / 100) - (ABS(a.f_net_chg) / 100), + '-', (a.f_curr_price / 100) + ((a.f_net_chg) / 100), 1), 2) rate + from t_input_index a, t_input_code b + where a.f_input_code in('A09', 'A10', 'A91') + and a.f_input_code = b.f_input_code + order by a.f_input_code"; + + + string query미국국채 = @"select decode(a.f_symb, 'GVO@TR02Y', 1, + 'GVO@TR03Y', 2, + 'GVO@TR05Y', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + b.f_sign chg_type, round(b.f_diff, 2) part_chg, round(b.f_rate, 2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb in('GVO@TR02Y', 'GVO@TR03Y', 'GVO@TR05Y') + order by ss"; + + + string query채권금리 = @"SELECT decode(a.f_symb, 'KIR@CMAA', 1, + 'KIR@NB03Y', 2, + 'KIR@CD91', 3) ss, + b.f_input_name part_name, ABS(round(a.f_last, 2)) part_idx, a.f_sign chg_type, + round(a.f_diff, 2) part_chg, round(a.f_rate, 2) rate + FROM t_world_ix_eq_sise a, t_world_ix_eq_master b + WHERE a.f_symb = b.f_symb + and b.f_symb in('KIR@CMAA', 'KIR@NB03Y', 'KIR@CD91') + order by ss"; + + + string query유가 = @"select decode(a.f_symb, 'SPT@DU', 1, + 'SPT@EB', 2, + 'SPT@CL', 3) ss, + a.f_input_name name, round(b.f_last, 2) part_idx, round(b.f_diff, 2) part_chg, + case when to_number(b.f_diff) > 0 then '+' when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate, 2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in('SPT@DU', 'SPT@EB', 'SPT@CL') --SPT@DU 두바이, SPT@CL' WTI, SPT@EB 브렌트 + order by ss"; + + + string query광물 = @"select decode(a.f_symb, 'COM@GC', 1, + 'COM@SI', 2, + 'LME@CDY', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, ABS(round(b.f_diff, 2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate, 2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in('COM@GC', 'COM@SI', 'LME@CDY') + order by ss"; + + + string query식자재 = @"select decode(a.f_symb, 'CBT$CORN', 1, + 'CBT@SOYBEAN', 2, + 'CBT@WHEAT', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, ABS(round(b.f_diff, 2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate, 2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in('CBT@SOYBEAN', 'CBT$CORN', 'CBT@WHEAT') + order by ss"; + + string query소맥_옥수수_밀 = @"select decode(a.f_symb, 'MK@WHEAT', 1, + 'CBT$CORN', 2, + 'CBT@WHEAT', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + ABS(round(b.f_diff,2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate, 2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('MK@WHEAT', 'CBT$CORN' , 'CBT@WHEAT') + order by ss"; + + string query대두_콩_현미 = @"select decode(a.f_symb, 'CBT@SOYBEAN', 1, + 'MK@BEAN', 2, + 'MK@RICE', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + ABS(round(b.f_diff,2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('CBT@SOYBEAN' , 'MK@BEAN' , 'MK@RICE') + order by ss"; + + string query커피_코코아_설탕 = @"select decode(a.f_symb, 'NYB@KC', 1, + 'MK@COCOA', 2, + 'NYB@SB', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + ABS(round(b.f_diff,2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('NYB@KC' , 'MK@COCOA', 'NYB@SB') + order by ss"; + + string query생우_비육우_돈육 = @"select decode(a.f_symb, 'MK@LC', 1, + 'MK@FC', 2, + 'MK@PORK', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + ABS(round(b.f_diff,2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('MK@LC', 'MK@FC', 'MK@PORK') + order by ss"; + + + string query구리_철광석_니켈 = @"select decode(a.f_symb, 'LME@CDY', 1, + 'MK@IRON', 2, + 'LME@NDY', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + ABS(round(b.f_diff,2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('LME@CDY', 'MK@IRON', 'LME@NDY') + order by ss"; + + string query천연가스_백금_팔라듐 = @"select decode(a.f_symb, 'NYM@NG', 1, + 'NYM@PL', 2, + 'NYM@PA', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + ABS(round(b.f_diff,2)) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('NYM@NG', 'NYM@PL', 'NYM@PA') + order by ss"; + + string query납_아연_주석 = @"select decode(a.f_symb, 'MK@PDA', 1, + 'MK@ZDA', 2, + 'LME@SDY', 3) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + round(b.f_diff,2) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('MK@PDA', 'MK@ZDA', 'LME@SDY') + order by ss"; + + string query원면_목화 = @"select decode(a.f_symb, 'MK@COTTON', 1, + 'NYB@CT', 2) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + round(b.f_diff,2) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('MK@COTTON', 'NYB@CT') + order by ss"; + + string query국제금 = @"select decode(a.f_symb, 'COM@GC', 1, + 'COM@SI', 2) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + round(b.f_diff,2) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('COM@GC' , 'COM@SI') + order by ss"; + + string query국내금 = @"select decode(a.f_symb, 'MK@GC', 1, + 'MK@SI', 2) ss, + a.f_input_name name, ABS(round(b.f_last, 2)) part_idx, + round(b.f_diff,2) part_chg, + case when to_number(b.f_diff) > 0 then '+' + when to_number(b.f_diff) < 0 then '-' else '' end sign, + round(b.f_rate,2) rate + from t_world_future_master a, t_world_future_sise b + where a.f_symb = b.f_symb + and a.f_symb in ('MK@GC', 'MK@SI') + order by ss"; + + #endregion + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (mDataType) + { + case 판3데이터분류.주요지수_코스피_코스닥_코스피200: + bufQuery = query주요지수200; + break; + case 판3데이터분류.주요지수_코스피_코스닥_선물: + bufQuery = query주요지수선물; + break; + case 판3데이터분류.예상체결지수_코스피_코스닥_코스피200: + bufQuery = query예상지수200; + break; + case 판3데이터분류.예상체결지수_코스피_코스닥_선물: + bufQuery = query예상지수선물; + break; + case 판3데이터분류.미국지수: + bufQuery = query미국; + break; + case 판3데이터분류.중화권지수: + bufQuery = query중화권; + break; + case 판3데이터분류.유럽지수: + bufQuery = query유럽; + break; + case 판3데이터분류.아시아지수_상해_대만_일본: + bufQuery = query아시아; + break; + case 판3데이터분류.달러환율_엔_위안_유로: + bufQuery = query달러환율; + break; + case 판3데이터분류.원환율_달러_엔_유로: + bufQuery = query원환율; + break; + case 판3데이터분류.미국국채: + bufQuery = query미국국채; + break; + case 판3데이터분류.채권금리: + bufQuery = query채권금리; + break; + case 판3데이터분류.유가_두바이_WTI_브랜트: + bufQuery = query유가; + break; + case 판3데이터분류.광물: + bufQuery = query광물; + break; + case 판3데이터분류.식자재: + bufQuery = query식자재; + break; + + case 판3데이터분류.소맥_옥수수_밀: + bufQuery = query소맥_옥수수_밀; + break; + + case 판3데이터분류.대두_콩_현미: + bufQuery = query대두_콩_현미; + break; + + case 판3데이터분류.커피_코코아_설탕: + bufQuery = query커피_코코아_설탕; + break; + + case 판3데이터분류.생우_비육우_돈육: + bufQuery = query생우_비육우_돈육; + break; + + case 판3데이터분류.구리_철광석_니켈: + bufQuery = query구리_철광석_니켈; + break; + + case 판3데이터분류.천연가스_백금_팔라듐: + bufQuery = query천연가스_백금_팔라듐; + break; + + case 판3데이터분류.납_아연_주석: + bufQuery = query납_아연_주석; + break; + + case 판3데이터분류.원면_목화: + bufQuery = query원면_목화; + break; + + case 판3데이터분류.국제금: + bufQuery = query국제금; + break; + + case 판3데이터분류.국내금: + bufQuery = query국내금; + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/EXCHANGE_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/EXCHANGE_PAN.cs new file mode 100644 index 0000000..54313e9 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/EXCHANGE_PAN.cs @@ -0,0 +1,81 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class EXCHANGE_PAN : ADataObject + { + + internal EXCHANGE_PAN(원환율 recvDataType) + { + this.mDataType = recvDataType; + } + + 원환율 mDataType; + + #region "쿼리" + + string queryDOLLOR = @"SELECT a.f_input_code stock_code, '원/달러' stock_name, + a.f_curr_price curr_price, a.f_net_chg net_chg, a.f_chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price - f_net_chg), '-', (a.f_curr_price + f_net_chg), 1)) * 100, 2) rate + FROM t_input_index a, t_input_code b + WHERE a.f_input_code = b.f_input_code + AND a.f_input_code = 'A09'"; + + string queryJPY = @"SELECT a.f_input_code stock_code, '원/엔' stock_name, + a.f_curr_price curr_price, a.f_net_chg net_chg, a.f_chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price - f_net_chg), '-', (a.f_curr_price + f_net_chg), 1)) * 100, 2) rate + FROM t_input_index a, t_input_code b + WHERE a.f_input_code = b.f_input_code + AND a.f_input_code = 'A10'"; + + string queryYUAN = @"SELECT a.f_input_code stock_code, '원/위엔' stock_name, + a.f_curr_price curr_price, abs(a.f_net_chg) net_chg, a.f_chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price - f_net_chg), '-', (a.f_curr_price + f_net_chg), 1)) * 100, 2) rate + FROM t_input_index a, t_input_code b + WHERE a.f_input_code = b.f_input_code + AND a.f_input_code = 'A90'"; + + string queryEURO = @"SELECT a.f_input_code stock_code, '원/유로' stock_name, + a.f_curr_price curr_price, a.f_net_chg net_chg, a.f_chg_type, + round((a.f_net_chg / decode(a.f_chg_type, '+', (a.f_curr_price - f_net_chg), '-', (a.f_curr_price + f_net_chg), 1)) * 100, 2) rate + FROM t_input_index a, t_input_code b + WHERE a.f_input_code = b.f_input_code + AND a.f_input_code = 'A91'"; + + #endregion + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (mDataType) + { + case 원환율.원위엔: + bufQuery = queryYUAN; + break; + case 원환율.원달러: + bufQuery = queryDOLLOR; + break; + case 원환율.원엔: + bufQuery = queryJPY; + break; + case 원환율.원유로: + bufQuery = queryEURO; + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/NXT_SANGSE_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/NXT_SANGSE_PAN.cs new file mode 100644 index 0000000..fa1ea06 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/NXT_SANGSE_PAN.cs @@ -0,0 +1,370 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_SANGSE_PAN : Nxt_ADataObject + { + + internal Nxt_SANGSE_PAN(국내시장종류 recvDataType, 상세판데이터분류 recvDataType2, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataType2 = recvDataType2; + this.mStockCode = recvStockCode; + } + + 국내시장종류 mDataType; + + 상세판데이터분류 mDataType2; + + string mStockCode = ""; + + #region 쿼리 + + // 시가 + string queryKOSPI1 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.init_price, decode(a.final_price, 0, round(((a.init_price - a.base_price) / a.base_price) * 100,2), + round(((a.init_price - a.final_price) / a.final_price) * 100,2)) init_rate, + a.high_price, decode(a.final_price, 0, round(((a.high_price - a.base_price) / a.base_price) * 100,2), + round(((a.high_price - a.final_price) / a.final_price) * 100,2)) high_rate, + a.low_price, decode(a.final_price, 0, round(((a.low_price - a.base_price) / a.base_price) * 100,2), + round(((a.low_price - a.final_price) / a.final_price) * 100,2)) low_rate + FROM V_2 a + WHERE a.stock_code = '{0}'"; + + // 시가_코스닥 + string queryKOSDAQ1 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.init_price, decode(a.final_price, 0, round(((a.init_price - a.base_price) / a.base_price) * 100,2), + round(((a.init_price - a.final_price) / a.final_price) * 100,2)) init_rate, + a.high_price, decode(a.final_price, 0, round(((a.high_price - a.base_price) / a.base_price) * 100,2), + round(((a.high_price - a.final_price) / a.final_price) * 100,2)) high_rate, + a.low_price, decode(a.final_price, 0, round(((a.low_price - a.base_price) / a.base_price) * 100,2), + round(((a.low_price - a.final_price) / a.final_price) * 100,2)) low_rate + FROM V_2_kosdaq a + WHERE a.stock_code = '{0}'"; + + // 시가_NXT + string queryNXT_KOSPI1 = @"SELECT a.f_stock_code stock_code, b.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + a.f_init_price, if (c.f_final_price = 0, round(((a.f_init_price - c.f_base_price) / c.f_base_price) * 100,2), + round(((a.f_init_price - c.f_final_price) / c.f_final_price) * 100,2)) init_rate, + a.f_high_price, if (c.f_final_price = 0, round(((a.f_high_price - c.f_base_price) / c.f_base_price) * 100,2), + round(((a.f_high_price - c.f_final_price) / c.f_final_price) * 100,2)) high_rate, + a.f_low_price, if (c.f_final_price = 0, round(((a.f_low_price - c.f_base_price) / c.f_base_price) * 100,2), + round(((a.f_low_price - c.f_final_price) / c.f_final_price) * 100,2)) low_rate + FROM n_online a, n_stock b, n_batch_his c + WHERE a.f_stock_code = b.f_stock_code + and a.f_stock_code = c.f_stock_code + and a.f_curr_price != 0 + and a.f_stock_code = b.F_STOCK_CODE + and c.f_data_day = (select max(f_data_day) from n_batch_his where f_stock_code = a.f_stock_code) + and a.f_stock_code = '{0}'"; + + // 시가_코스닥_NXT + string queryNXT_KOSDAQ1 = @"SELECT a.f_stock_code stock_code, b.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + a.f_init_price, if (c.f_final_price = 0, round(((a.f_init_price - c.f_base_price) / c.f_base_price) * 100,2), + round(((a.f_init_price - c.f_final_price) / c.f_final_price) * 100,2)) init_rate, + a.f_high_price, if (c.f_final_price = 0, round(((a.f_high_price - c.f_base_price) / c.f_base_price) * 100,2), + round(((a.f_high_price - c.f_final_price) / c.f_final_price) * 100,2)) high_rate, + a.f_low_price, if (c.f_final_price = 0, round(((a.f_low_price - c.f_base_price) / c.f_base_price) * 100,2), + round(((a.f_low_price - c.f_final_price) / c.f_final_price) * 100,2)) low_rate + FROM n_kosdaq_online a, n_kosdaq_stock b, n_kosdaq_batch_his c + WHERE a.f_stock_code = b.f_stock_code + and a.f_stock_code = c.f_stock_code + and a.f_curr_price != 0 + and a.f_stock_code = b.F_STOCK_CODE + and c.f_data_day = (select max(f_data_day) from n_kosdaq_batch_his where f_stock_code = a.f_stock_code) + and a.f_stock_code = '{0}'"; + + // 액면가 + string queryKOSPI2 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.list_price, a.capital_price, a.siga_price, b.rank_num + FROM V_2 A, + (select z.f_stock_code stock_code, + rank() over(order by(z.f_list_num * y.f_curr_price) desc) rank_num + from t_online1 y, t_stock z + where y.f_stock_code = z.f_stock_code + and z.f_mkt_halt = 'N') B + WHERE a.stock_code = b.stock_code + and a.stock_code = '{0}'"; + + // 액면가_코스닥 + string queryKOSDAQ2 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.list_price, a.capital_price, a.siga_price, b.rank_num + FROM V_2_kosdaq A, + (select z.f_stock_code stock_code, + rank() over(order by(z.f_list_num * y.f_curr_price) desc) rank_num + from t_kosdaq_online1 y, t_kosdaq_stock z + where y.f_stock_code = z.f_stock_code + and z.f_mkt_halt = 'N') B + WHERE a.stock_code = b.stock_code + and a.stock_code = '{0}'"; + + // 액면가_NXT + string queryNXT_KOSPI2 = + @"SELECT a.f_stock_code stock_code, b.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + b.f_list_price list_price, b.f_capital_price capital_price, b.f_list_num * a.f_curr_price siga_price, b.rank_num + FROM n_online a, + (select z.f_stock_code f_stock_code, z.f_stock_name, z.f_list_price, z.f_capital_price, z.f_list_num, + rank() over(order by(z.f_list_num * y.f_curr_price) desc) rank_num + from n_online y, n_stock z + where y.f_stock_code = z.f_stock_code + and z.f_stop_gubun = 'N') b + WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_code = '{0}'"; + + // 액면가_코스닥_NXT + string queryNXT_KOSDAQ2 = + @"SELECT a.f_stock_code stock_code, b.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + b.f_list_price list_price, b.f_capital_price capital_price, b.f_list_num * a.f_curr_price siga_price, b.rank_num + FROM n_kosdaq_online a, + (select z.f_stock_code f_stock_code, z.f_stock_name, z.f_list_price, z.f_capital_price, z.f_list_num, + rank() over(order by(z.f_list_num * y.f_curr_price) desc) rank_num + from n_kosdaq_online y, n_kosdaq_stock z + where y.f_stock_code = z.f_stock_code + and z.f_stop_gubun = 'N') b + WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_code = '{0}'"; + + // PBR + string queryKOSPI3 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.pbr, a.per, a.bps, a.eps + FROM V_2 A + WHERE a.stock_code = '{0}'"; + + // PBR_코스닥 + string queryKOSDAQ3 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.pbr, a.per, a.bps, a.eps + FROM V_2_kosdaq A + WHERE a.stock_code = '{0}'"; + + // PBR_NXT + string queryNXT_KOSPI3 = + @"SELECT a.f_stock_code stock_code, b.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + 0 pbr, 0 per, 0 bps, 0 eps + FROM n_online a, n_stock b + WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_code = '{0}'"; + + // PBR_코스닥 + string queryNXT_KOSDAQ3 = + @"SELECT a.f_stock_code stock_code, b.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + 0 pbr, 0 per, 0 bps, 0 eps + FROM n_kosdaq_online a, n_kosdaq_stock b + WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_code = '{0}'"; + + // 거래량 + string queryKOSPI4 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.net_vol, a.net_turnover, nvl(c.avg_5,0) avg_5, nvl(d.avg_20,0) avg_20 + FROM V_2 a, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 5) avg_5 + FROM (SELECT f_stock_code, f_curr_price + FROM T_CANDLE_HISTORY + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{0}' + AND ROWNUM < 5 + ORDER BY F_DATA_DATE DESC) a, t_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) c, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 20) avg_20 + FROM (SELECT f_stock_code, b1.f_curr_price + FROM T_CANDLE_HISTORY b1 + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{1}' + AND ROWNUM < 20 + ORDER BY F_DATA_DATE DESC) a, t_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) d + WHERE a.stock_code = c.f_stock_code (+) + AND a.stock_code = d.f_stock_code (+) + AND a.stock_code = '{1}' "; + + // 거래량_코스닥 + string queryKOSDAQ4 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.net_vol, a.net_turnover, nvl(c.avg_5,0) avg_5, nvl(d.avg_20,0) avg_20 + FROM V_2_kosdaq a, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 5) avg_5 + FROM (SELECT f_stock_code, f_curr_price + FROM T_kosdaq_CANDLE_HISTORY + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{0}' + AND ROWNUM < 5 + ORDER BY F_DATA_DATE DESC) a, t_kosdaq_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) c, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 20) avg_20 + FROM (SELECT f_stock_code, b1.f_curr_price + FROM T_kosdaq_CANDLE_HISTORY b1 + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{1}' + AND ROWNUM < 20 + ORDER BY F_DATA_DATE DESC) a, t_kosdaq_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) d + WHERE a.stock_code = c.f_stock_code (+) + AND a.stock_code = d.f_stock_code (+) + AND a.stock_code = '{1}' "; + + // 거래량_NXT + string queryNXT_KOSPI4 = @"SELECT a.f_stock_code stock_code, z.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / + case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + a.f_net_vol net_vol, a.f_net_turnover net_turnover, 0 avg_5, 0 avg_20 + FROM n_online a, n_stock z + WHERE a.f_stock_code = z.f_stock_code + AND a.f_stock_code = '{1}' "; + + // 거래량_코스닥 + string queryNXT_KOSDAQ4 = @"SELECT a.f_stock_code stock_code, z.f_stock_name stock_name, a.f_curr_price curr_price, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_chg net_chg, + round((a.f_net_chg / + case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , + a.f_net_vol net_vol, a.f_net_turnover net_turnover, 0 avg_5, 0 avg_20 + FROM n_kosdaq_online a, n_kosdaq_stock z + WHERE a.f_stock_code = z.f_stock_code + AND a.f_stock_code = '{1}' "; + + #endregion + + public override Nxt_IDataRequest Nxt_buildData() + { + string bufQuery = ""; + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + switch (this.mDataType2) + { + case 상세판데이터분류.시가: + bufQuery = String.Format(queryKOSPI1, mStockCode); + break; + case 상세판데이터분류.액면가: + bufQuery = String.Format(queryKOSPI2, mStockCode); + break; + case 상세판데이터분류.PBR: + bufQuery = String.Format(queryKOSPI3, mStockCode); + break; + case 상세판데이터분류.거래량: + bufQuery = String.Format(queryKOSPI4, mStockCode, mStockCode); + break; + } + break; + case 국내시장종류.KOSDAQ: + + switch (this.mDataType2) + { + case 상세판데이터분류.시가: + bufQuery = String.Format(queryKOSDAQ1, mStockCode); + break; + case 상세판데이터분류.액면가: + bufQuery = String.Format(queryKOSDAQ2, mStockCode); + break; + case 상세판데이터분류.PBR: + bufQuery = String.Format(queryKOSDAQ3, mStockCode); + break; + case 상세판데이터분류.거래량: + bufQuery = String.Format(queryKOSDAQ4, mStockCode, mStockCode); + break; + } + break; + case 국내시장종류.NXT_KOSPI: + switch (this.mDataType2) + { + case 상세판데이터분류.시가: + bufQuery = String.Format(queryNXT_KOSPI1, mStockCode); + break; + case 상세판데이터분류.액면가: + bufQuery = String.Format(queryNXT_KOSPI2, mStockCode); + break; + case 상세판데이터분류.PBR: + bufQuery = String.Format(queryNXT_KOSPI3, mStockCode); + break; + case 상세판데이터분류.거래량: + bufQuery = String.Format(queryNXT_KOSPI4, mStockCode, mStockCode); + break; + } + break; + case 국내시장종류.NXT_KOSDAQ: + + switch (this.mDataType2) + { + case 상세판데이터분류.시가: + bufQuery = String.Format(queryNXT_KOSDAQ1, mStockCode); + break; + case 상세판데이터분류.액면가: + bufQuery = String.Format(queryNXT_KOSDAQ2, mStockCode); + break; + case 상세판데이터분류.PBR: + bufQuery = String.Format(queryNXT_KOSDAQ3, mStockCode); + break; + case 상세판데이터분류.거래량: + bufQuery = String.Format(queryNXT_KOSDAQ4, mStockCode, mStockCode); + break; + } + break; + } + + Nxt_mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/SANGSE_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/SANGSE_PAN.cs new file mode 100644 index 0000000..63bf630 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/SANGSE_PAN.cs @@ -0,0 +1,199 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class SANGSE_PAN : ADataObject + { + + internal SANGSE_PAN(국내시장종류 recvDataType, 상세판데이터분류 recvDataType2, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataType2 = recvDataType2; + this.mStockCode = recvStockCode; + } + + 국내시장종류 mDataType; + + 상세판데이터분류 mDataType2; + + string mStockCode = ""; + + #region 쿼리 + // string queryKOSPI1 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + //a.init_price, round(((a.init_price - a.final_price) / a.final_price) * 100, 2) init_rate, + //a.high_price, round(((a.high_price - a.final_price) / a.final_price) * 100, 2) high_rate, + //a.low_price, round(((a.low_price - a.final_price) / a.final_price) * 100, 2) low_rate + //FROM V_2 a + //WHERE a.stock_code = '{0}'"; + + string queryKOSPI1 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.init_price, decode(a.final_price, 0, round(((a.init_price - a.base_price) / a.base_price) * 100,2), + round(((a.init_price - a.final_price) / a.final_price) * 100,2)) init_rate, + a.high_price, decode(a.final_price, 0, round(((a.high_price - a.base_price) / a.base_price) * 100,2), + round(((a.high_price - a.final_price) / a.final_price) * 100,2)) high_rate, + a.low_price, decode(a.final_price, 0, round(((a.low_price - a.base_price) / a.base_price) * 100,2), + round(((a.low_price - a.final_price) / a.final_price) * 100,2)) low_rate + FROM V_2 a + WHERE a.stock_code = '{0}'"; + + + // string queryKOSDAQ1 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + //a.init_price, round(((a.init_price - a.final_price) / a.final_price) * 100, 2) init_rate, + //a.high_price, round(((a.high_price - a.final_price) / a.final_price) * 100, 2) high_rate, + //a.low_price, round(((a.low_price - a.final_price) / a.final_price) * 100, 2) low_rate + //FROM V_2_kosdaq a + //WHERE a.stock_code = '{0}'"; + + string queryKOSDAQ1 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.init_price, decode(a.final_price, 0, round(((a.init_price - a.base_price) / a.base_price) * 100,2), + round(((a.init_price - a.final_price) / a.final_price) * 100,2)) init_rate, + a.high_price, decode(a.final_price, 0, round(((a.high_price - a.base_price) / a.base_price) * 100,2), + round(((a.high_price - a.final_price) / a.final_price) * 100,2)) high_rate, + a.low_price, decode(a.final_price, 0, round(((a.low_price - a.base_price) / a.base_price) * 100,2), + round(((a.low_price - a.final_price) / a.final_price) * 100,2)) low_rate + FROM V_2_kosdaq a + WHERE a.stock_code = '{0}'"; + + + string queryKOSPI2 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.list_price, a.capital_price, a.siga_price, b.rank_num + FROM V_2 A, + (select z.f_stock_code stock_code, + rank() over(order by(z.f_list_num * y.f_curr_price) desc) rank_num + from t_online1 y, t_stock z + where y.f_stock_code = z.f_stock_code and z.f_mkt_halt = 'N') B + WHERE a.stock_code = b.stock_code + and a.stock_code = '{0}'"; + + string queryKOSDAQ2 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.list_price, a.capital_price, a.siga_price, b.rank_num + FROM V_2_kosdaq A, + (select z.f_stock_code stock_code, + rank() over(order by(z.f_list_num * y.f_curr_price) desc) rank_num + from t_kosdaq_online1 y, t_kosdaq_stock z + where y.f_stock_code = z.f_stock_code and z.f_mkt_halt = 'N') B + WHERE a.stock_code = b.stock_code + and a.stock_code = '{0}'"; + + string queryKOSPI3 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.pbr, a.per, a.bps, a.eps + FROM V_2 A + WHERE a.stock_code = '{0}'"; + + string queryKOSDAQ3 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.pbr, a.per, a.bps, a.eps + FROM V_2_kosdaq A + WHERE a.stock_code = '{0}'"; + + string queryKOSPI4 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.net_vol, a.net_turnover, nvl(c.avg_5,0) avg_5, nvl(d.avg_20,0) avg_20 + FROM V_2 a, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 5) avg_5 + FROM (SELECT f_stock_code, f_curr_price + FROM T_CANDLE_HISTORY + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{0}' + AND ROWNUM < 5 + ORDER BY F_DATA_DATE DESC) a, t_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) c, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 20) avg_20 + FROM (SELECT f_stock_code, b1.f_curr_price + FROM T_CANDLE_HISTORY b1 + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{1}' + AND ROWNUM < 20 + ORDER BY F_DATA_DATE DESC) a, t_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) d + WHERE a.stock_code = c.f_stock_code (+) + AND a.stock_code = d.f_stock_code (+) + AND a.stock_code = '{1}' "; + + string queryKOSDAQ4 = @"SELECT a.stock_code, a.stock_name, a.curr_price, a.chg_type, a.net_chg, a.rate, + a.net_vol, a.net_turnover, nvl(c.avg_5,0) avg_5, nvl(d.avg_20,0) avg_20 + FROM V_2_kosdaq a, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 5) avg_5 + FROM (SELECT f_stock_code, f_curr_price + FROM T_kosdaq_CANDLE_HISTORY + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{0}' + AND ROWNUM < 5 + ORDER BY F_DATA_DATE DESC) a, t_kosdaq_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) c, + (SELECT b.f_stock_code, round((SUM(a.F_CURR_PRICE) + b.f_curr_price) / 20) avg_20 + FROM (SELECT f_stock_code, b1.f_curr_price + FROM T_kosdaq_CANDLE_HISTORY b1 + WHERE F_DATA_DATE < (select max(open_day) from v_open_day) + AND f_stock_code = '{1}' + AND ROWNUM < 20 + ORDER BY F_DATA_DATE DESC) a, t_kosdaq_online1 b + WHERE a.f_stock_code = b.f_stock_code + GROUP by b.f_stock_code, b.f_curr_price) d + WHERE a.stock_code = c.f_stock_code (+) + AND a.stock_code = d.f_stock_code (+) + AND a.stock_code = '{1}' "; + + + + #endregion + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + switch (this.mDataType2) + { + case 상세판데이터분류.시가: + bufQuery = String.Format(queryKOSPI1, mStockCode); + break; + case 상세판데이터분류.액면가: + bufQuery = String.Format(queryKOSPI2, mStockCode); + break; + case 상세판데이터분류.PBR: + bufQuery = String.Format(queryKOSPI3, mStockCode); + break; + case 상세판데이터분류.거래량: + bufQuery = String.Format(queryKOSPI4, mStockCode, mStockCode); + break; + } + break; + case 국내시장종류.KOSDAQ: + + switch (this.mDataType2) + { + case 상세판데이터분류.시가: + bufQuery = String.Format(queryKOSDAQ1, mStockCode); + break; + case 상세판데이터분류.액면가: + bufQuery = String.Format(queryKOSDAQ2, mStockCode); + break; + case 상세판데이터분류.PBR: + bufQuery = String.Format(queryKOSDAQ3, mStockCode); + break; + case 상세판데이터분류.거래량: + bufQuery = String.Format(queryKOSDAQ4, mStockCode, mStockCode); + break; + } + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_FORGIEN_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_FORGIEN_PAN.cs new file mode 100644 index 0000000..9165766 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_FORGIEN_PAN.cs @@ -0,0 +1,47 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class INDUSTRY_FORGIEN_PAN : ADataObject + { + + public INDUSTRY_FORGIEN_PAN(string recvCode) + { + this.mDataCode = recvCode; + } + + string mDataCode = ""; + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"SELECT b.f_knam part_name, + a.f_last part_idx, + a.f_sign chg_type, + ABS(round(a.f_diff, 2)) part_chg, + round(a.f_rate, 2) rate + FROM t_world_ix_eq_sise a, t_world_ix_eq_master b + WHERE a.f_symb = b.f_symb + and b.f_knam = '{0}'"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday, mDataCode); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_PAN.cs new file mode 100644 index 0000000..f797ae7 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/업종/INDUSTRY_PAN.cs @@ -0,0 +1,66 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class INDUSTRY_PAN : ADataObject + { + + + internal INDUSTRY_PAN(국내시장종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataCode = recvStockCode; + } + + 국내시장종류 mDataType; + + string mDataCode = String.Empty; + + #region "쿼리" + + string queryKOSPI = @"SELECT b.f_part_name, + round(a.f_part_idx / 100, 2) part_idx, a.f_chg_type chg_type, round(a.f_part_chg / 100, 2) part_chg, + round((a.f_part_chg / decode(a.f_chg_type, '+', a.f_part_idx - a.f_part_chg, '-', a.f_part_idx + a.f_part_chg)) * 100, 2) rate + FROM t_index a, t_part b + WHERE a.f_part_code = b.f_part_code + and b.f_part_name = '{0}'"; + + string queryKOSDAQ = @"SELECT b.f_part_name, + round(a.f_part_idx / 100, 2) part_idx, a.f_chg_type chg_type, round(a.f_part_chg / 100, 2) part_chg, + round((a.f_part_chg / decode(a.f_chg_type, '+', a.f_part_idx - a.f_part_chg, '-', a.f_part_idx + a.f_part_chg)) * 100, 2) rate + FROM t_kosdaq_index a, t_kosdaq_part b + WHERE a.f_part_code = b.f_part_code + and b.f_part_name = '{0}'"; + + #endregion + + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (mDataType) + { + case 국내시장종류.KOSPI: + bufQuery = string.Format(queryKOSPI, mDataCode); + break; + case 국내시장종류.KOSDAQ: + bufQuery = string.Format(queryKOSDAQ, mDataCode); + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/Nxt_STOCK_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/Nxt_STOCK_PAN.cs new file mode 100644 index 0000000..9327662 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/Nxt_STOCK_PAN.cs @@ -0,0 +1,122 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Nxt_STOCK_PAN : Nxt_ADataObject + { + + internal Nxt_STOCK_PAN(국내시장종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataCode = recvStockCode; + } + + 국내시장종류 mDataType; + + string mDataCode = String.Empty; + + #region "쿼리" + + string queryNXT_KOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME stock_name , a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / + case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , 'NXT_KOSPI' market + FROM n_online a, n_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_curr_price != 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_name = '{0}'"; + + string queryNXT_KOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME stock_name , a.f_curr_price curr_price, a.f_net_chg net_chg, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / + case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , 'NXT_KOSDAQ' market + FROM n_kosdaq_online a, n_kosdaq_stock b + WHERE b.f_stop_gubun = 'N' + AND a.f_curr_price != 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_name = '{0}'"; + + // string queryNXT_Dis = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME stock_name , a.f_curr_price curr_price, + //ABS(a.f_net_chg) net_chg, + //case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + // when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_vol net_vol, + //round((a.f_net_chg / + // case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + // when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + // when a.f_chg_type = '3' then (a.f_curr_price) + // when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + // when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , , 'NXT_KOSPI' market + //FROM n_stop_online a, n_stock b + //WHERE b.f_stop_gubun = 'Y' + //AND a.f_curr_price != 0 + //AND a.f_stock_code = b.f_stock_code + //and b.f_STOCK_name = '{0}'"; + + // string queryNXT_Disk = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME stock_name , a.f_curr_price curr_price, + //ABS(a.f_net_chg) net_chg, + //case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + // when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_vol net_vol, + //round((a.f_net_chg / + // case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + // when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + // when a.f_chg_type = '3' then (a.f_curr_price) + // when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + // when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , 'NXT_KOSDAQ' market + //FROM n_stop_kosdaq_online a, t_kosdaq_stock b + //WHERE b.f_stop_gubun = 'Y' + //AND a.f_curr_price != 0 + //AND a.f_stock_code = b.f_stock_code + //and b.f_STOCK_name = '{0}'"; + + + #endregion + + + public override Nxt_IDataRequest Nxt_buildData() + { + + string bufQuery = ""; + + switch (mDataType) + { + case 국내시장종류.NXT_KOSPI: + bufQuery = string.Format(queryNXT_KOSPI, mDataCode); + break; + case 국내시장종류.NXT_KOSDAQ: + bufQuery = string.Format(queryNXT_KOSDAQ, mDataCode); + break; + //case 국내시장종류.거래정지: + // bufQuery = string.Format(queryNXT_Dis, mDataCode); + // break; + //case 국내시장종류.거래정지K: + // bufQuery = string.Format(queryNXT_Disk, mDataCode); + // break; + } + + Nxt_mRequestQuery.Add("", bufQuery); + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORECAST_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORECAST_PAN.cs new file mode 100644 index 0000000..abc7353 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORECAST_PAN.cs @@ -0,0 +1,108 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class STOCK_FORECAST_PAN : ADataObject + { + + + internal STOCK_FORECAST_PAN(국내시장종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataCode = recvStockCode; + } + + 국내시장종류 mDataType; + + string mDataCode = String.Empty; + + #region "쿼리" + + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.f_stock_nickname nickname, b.F_STOCK_WANNAME wanname, a.f_fore_price curr_price, + a.f_fore_vol net_vol, c.f_final_price final_price, + ABS(a.f_fore_price - c.f_final_price) net_chg, '' f_net_chg, + case when(a.f_fore_price - c.f_final_price) > 0 then '+' + when(a.f_fore_price - c.f_final_price) = 0 then '' + when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + FROM t_online1_call a, t_stock b, t_batch_day c + WHERE b.f_stock_code = a.f_stock_code + AND c.f_stock_code = a.f_stock_code + AND b.f_mkt_halt = 'N' + and b.f_STOCK_wanname = '{0}' + and a.f_fore_price <> 0"; + ////////// string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.f_stock_nickname nickname, b.F_STOCK_WANNAME wanname, a.f_fore_price curr_price, + //////////a.f_fore_vol net_vol, c.f_final_price final_price, + //////////a.f_fore_price - c.f_final_price net_chg, a.f_net_chg, + //////////case when(a.f_fore_price - c.f_final_price) > 0 then '+' + //////////when(a.f_fore_price - c.f_final_price) = 0 then '' + //////////when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + //////////round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + //////////FROM t_online1 a, t_stock b, t_batch_day c + //////////WHERE b.f_stock_code = a.f_stock_code + //////////AND c.f_stock_code = a.f_stock_code + //////////AND b.f_mkt_halt = 'N' + //////////and b.f_STOCK_wanname = '{0}' + ////////// and a.f_fore_price <> 0"; +// and a.f_fore_price < > 0"; + + string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.f_stock_nickname nickname, b.F_STOCK_WANNAME wanname, a.f_fore_price curr_price, + a.f_fore_vol net_vol, c.f_final_price final_price, + ABS(a.f_fore_price - c.f_final_price) net_chg, '' f_net_chg, + case when(a.f_fore_price - c.f_final_price) > 0 then '+' + when(a.f_fore_price - c.f_final_price) = 0 then '' + when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + FROM t_kosdaq_online1_call a, t_kosdaq_stock b, t_kosdaq_batch_day c + WHERE a.f_stock_code = b.f_stock_code + AND b.f_mkt_halt = 'N' + AND c.f_stock_code = b.f_stock_code + and b.f_stock_wanname = '{0}' + and a.f_fore_price <> 0"; + //////////////// string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.f_stock_nickname nickname, b.F_STOCK_WANNAME wanname, a.f_fore_price curr_price, + ////////////////a.f_fore_vol net_vol, c.f_final_price final_price, + ////////////////a.f_fore_price - c.f_final_price net_chg, a.f_net_chg, + ////////////////case when(a.f_fore_price - c.f_final_price) > 0 then '+' + ////////////////when(a.f_fore_price - c.f_final_price) = 0 then '' + ////////////////when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + ////////////////round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + ////////////////FROM t_kosdaq_online1 a, t_kosdaq_stock b, t_kosdaq_batch_day c + ////////////////WHERE a.f_stock_code = b.f_stock_code + ////////////////AND b.f_mkt_halt = 'N' + ////////////////AND c.f_stock_code = b.f_stock_code + ////////////////and b.f_stock_wanname = '{0}' + //////////////// and a.f_fore_price <> 0"; + //////////////// // and a.f_fore_price < > 0"; + + #endregion + + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (mDataType) + { + case 국내시장종류.KOSPI: + bufQuery = string.Format(queryKOSPI, mDataCode); + break; + case 국내시장종류.KOSDAQ: + bufQuery = string.Format(queryKOSDAQ, mDataCode); + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORGIEN_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORGIEN_PAN.cs new file mode 100644 index 0000000..2c711d1 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_FORGIEN_PAN.cs @@ -0,0 +1,47 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class STOCK_FORGIEN_PAN : ADataObject + { + + public STOCK_FORGIEN_PAN(string recvCode) + { + this.mDataCode = recvCode; + } + + string mDataCode = ""; + + /// + /// 금일 데이터 쿼리 + /// + string queryToday = @"SELECT b.f_input_name part_name, + a.f_last part_idx, + a.f_sign chg_type, + ABS(round(a.f_diff, 2)) part_chg, + round(a.f_rate, 2) rate + FROM t_world_ix_eq_sise a, t_world_ix_eq_master b + WHERE a.f_symb = b.f_symb + and b.f_input_name = '{0}'"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryToday, mDataCode); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_OVERTIME_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_OVERTIME_PAN.cs new file mode 100644 index 0000000..f156e21 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_OVERTIME_PAN.cs @@ -0,0 +1,116 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class STOCK_OVERTIME_PAN : ADataObject + { + + + internal STOCK_OVERTIME_PAN(국내시장종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataCode = recvStockCode; + } + + 국내시장종류 mDataType; + + string mDataCode = String.Empty; + + #region "쿼리" + + // string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.f_stock_nickname nickname, b.F_STOCK_WANNAME wanname, a.f_fore_price curr_price, + //a.f_fore_vol net_vol, c.f_final_price final_price, + //ABS(a.f_fore_price - c.f_final_price) net_chg, '' f_net_chg, + //case when(a.f_fore_price - c.f_final_price) > 0 then '+' + //when(a.f_fore_price - c.f_final_price) = 0 then '' + //when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + //round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + //FROM t_online1_call a, t_stock b, t_batch_day c + //WHERE b.f_stock_code = a.f_stock_code + //AND c.f_stock_code = a.f_stock_code + //AND b.f_mkt_halt = 'N' + //and b.f_STOCK_wanname = '{0}' + // and a.f_fore_price <> 0"; + string queryKOSPI = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, + a.f_curr_price, + round( + a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, + '2', a.f_curr_price - a.f_net_chg, '3', a.f_curr_price, + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg)) * 100, 2) rate + FROM t_overtime_sise a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 + AND b.f_sect_code = 'ST' + AND b.f_STOCK_wanname = '{0}' + ORDER BY rate DESC"; + + // string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.f_stock_nickname nickname, b.F_STOCK_WANNAME wanname, a.f_fore_price curr_price, + //a.f_fore_vol net_vol, c.f_final_price final_price, + //ABS(a.f_fore_price - c.f_final_price) net_chg, '' f_net_chg, + //case when(a.f_fore_price - c.f_final_price) > 0 then '+' + //when(a.f_fore_price - c.f_final_price) = 0 then '' + //when(a.f_fore_price - c.f_final_price) < 0 then '-' end chg_type, + //round(((a.f_fore_price - c.f_final_price) / c.f_final_price) * 100, 2) rate + //FROM t_kosdaq_online1_call a, t_kosdaq_stock b, t_kosdaq_batch_day c + //WHERE a.f_stock_code = b.f_stock_code + //AND b.f_mkt_halt = 'N' + //AND c.f_stock_code = b.f_stock_code + //and b.f_stock_wanname = '{0}' + // and a.f_fore_price <> 0"; + string queryKOSDAQ = @"SELECT DISTINCT + b.f_stock_code stock_code, + b.F_STOCK_WANNAME wanname, + a.f_net_chg net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, + a.f_curr_price, + round( + a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, + '2', a.f_curr_price - a.f_net_chg, '3', a.f_curr_price, + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg)) * 100, 2) rate + FROM t_kosdaq_overtime_sise a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_stock_code = b.f_stock_code + AND a.f_curr_price < > 0 + AND b.f_sect_code = 'ST' + AND b.f_STOCK_wanname = '{0}' + ORDER BY rate DESC"; + + #endregion + + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (mDataType) + { + case 국내시장종류.KOSPI: + bufQuery = string.Format(queryKOSPI, mDataCode); + break; + case 국내시장종류.KOSDAQ: + bufQuery = string.Format(queryKOSDAQ, mDataCode); + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_PAN.cs new file mode 100644 index 0000000..b4b7bd9 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/종목/STOCK_PAN.cs @@ -0,0 +1,162 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class STOCK_PAN : ADataObject + { + + internal STOCK_PAN(국내시장종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataCode = recvStockCode; + } + + 국내시장종류 mDataType; + + string mDataCode = String.Empty; + + #region "쿼리" + + string queryKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME stock_name , a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate , 'KOSPI' market + FROM t_online1 a, t_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_wanname = '{0}'"; + + string queryKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME stock_name , a.f_curr_price curr_price, a.f_net_chg net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate , 'KOSDAQ' market + FROM t_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_wanname = '{0}'"; + + string queryNXTKOSPI = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME stock_name , a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / + case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , 'KOSPI' market + FROM n_online a, n_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price != 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_name = '{0}'"; + + string queryNXTKOSDAQ = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_NAME stock_name , a.f_curr_price curr_price, a.f_net_chg net_chg, + case when a.f_chg_type = '1' then '상한' when a.f_chg_type = '2' then '상승' when a.f_chg_type = '3' then '보합' + when a.f_chg_type = '4' then '하한' when a.f_chg_type = '5' then '하락' end chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / + case when a.f_chg_type = '1' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '2' then (a.f_curr_price - a.f_net_chg) + when a.f_chg_type = '3' then (a.f_curr_price) + when a.f_chg_type = '4' then -1*(a.f_curr_price + a.f_net_chg) + when a.f_chg_type = '5' then -1*(a.f_curr_price + a.f_net_chg) end) * 100, 2) rate , 'KOSDAQ' market + FROM n_kosdaq_online a, n_kosdaq_stock b + WHERE b.f_mkt_halt = 'N' + AND a.f_curr_price != 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_name = '{0}'"; + + string queryDis = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME stock_name , a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_stop_online1 a, t_stock b + WHERE b.f_mkt_halt = 'Y' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_wanname = '{0}'"; + + string queryDisk = @"SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME stock_name , a.f_curr_price curr_price, + ABS(a.f_net_chg) net_chg, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, a.f_net_vol net_vol, + round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), + '2', (a.f_curr_price - a.f_net_chg), + '3', (a.f_curr_price), + '4', -1 * (a.f_curr_price + a.f_net_chg), + '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate + FROM t_stop_kosdaq_online1 a, t_kosdaq_stock b + WHERE b.f_mkt_halt = 'Y' + AND a.f_curr_price < > 0 + AND a.f_stock_code = b.f_stock_code + and b.f_STOCK_wanname = '{0}'"; + + + // SELECT DISTINCT b.f_stock_code stock_code, b.F_STOCK_WANNAME stock_name, a.f_curr_price curr_price, \ + + // ABS(a.f_net_chg) net_chg, \ + //decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') chg_type, \ + //round((a.f_net_chg / decode(a.f_chg_type, '1', (a.f_curr_price - a.f_net_chg), \ + // '2', (a.f_curr_price - a.f_net_chg), \ + // '3', (a.f_curr_price), \ + // '4', -1 * (a.f_curr_price + a.f_net_chg), \ + // '5', -1 * (a.f_curr_price + a.f_net_chg))) * 100, 2) rate \ + //FROM t_stop_kosdaq_online1 a, t_kosdaq_stock b \ + + // WHERE b.f_mkt_halt = 'Y' \ + //AND a.f_curr_price<> 0 \ + + // AND a.f_stock_code = b.f_stock_code \ + + // AND b.f_stock_wanname = '%s'" + #endregion + + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (mDataType) + { + case 국내시장종류.KOSPI: + bufQuery = string.Format(queryKOSPI, mDataCode); + break; + case 국내시장종류.KOSDAQ: + bufQuery = string.Format(queryKOSDAQ, mDataCode); + break; + case 국내시장종류.거래정지: + bufQuery = string.Format(queryDis, mDataCode); + break; + case 국내시장종류.거래정지K: + bufQuery = string.Format(queryDisk, mDataCode); + break; + } + + mRequestQuery.Add("", bufQuery); + + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORECAST_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORECAST_PAN.cs new file mode 100644 index 0000000..cc75d5b --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORECAST_PAN.cs @@ -0,0 +1,92 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class INDEX_FORECAST_PAN : ADataObject + { + + internal INDEX_FORECAST_PAN(국내지수종류 recvDataType) + { + this.mDataType = recvDataType; + } + + 국내지수종류 mDataType; + + #region 쿼리 + string queryKOSPI = @"SELECT '코스피 예상체결지수' NAME, + round(f_part_idx / 100, 2) part_idx, f_chg_type chg_type, ABS(round(f_part_chg / 100, 2)) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_fo_index + WHERE f_part_code = '001'"; + + string queryKOSDAQ = @"SELECT '코스닥 예상체결지수' NAME, + round(f_part_idx / 100, 2) part_idx, f_chg_type chg_type, ABS(round(f_part_chg / 100, 2)) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_kosdaq_fo_index + WHERE f_part_code = '001'"; + + string queryKOSPI200 = @"SELECT '코스피200 예상체결지수' name,f_part_idx/100 part_idx, f_chg_type chg_type, + ABS(round(f_part_chg / 100, 2)) part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, + '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM T_200_FO_INDEX + WHERE f_part_code = '029'"; + + string queryKRX100 = @"SELECT 'KRX100 예상체결지수' name,f_part_idx/100 part_idx, f_chg_type chg_type, f_part_chg/100 part_chg, + round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), '-', (f_part_idx / 100) + (f_part_chg / 100), 1), 2) rate + FROM t_krx100_FO_index WHERE f_part_code = '043'"; + + + string queryFUTURE = @"SELECT '선물 예상체결지수' name, part_idx part_idx, chg_type, ABS(part_chg) part_chg, + round(part_chg / decode(chg_type, '+', (part_idx / 100) - (part_chg / 100), + '-', (part_idx / 100) + (part_chg / 100), 1), 2) rate + FROM(SELECT f_fo_price / 100 part_idx, + round((f_fo_price - f_base_price) / 100, 2) part_chg, + decode(sign(f_fo_price - f_base_price), 1, '+', -1, '-', 0, ' ') chg_type + FROM t_sunmul_online + WHERE f_stock_code = (select f_stock_code from t_sunmul_batch + where f_market_date = (select max(f_market_date) + from t_sunmul_batch) + and substr(f_stock_code, 4, 1) = '1' + and F_MONTH_GUBUN = '1'))"; + + #endregion + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (this.mDataType) + { + case 국내지수종류.KOSPI: + bufQuery = queryKOSPI; + break; + case 국내지수종류.KOSDAQ: + bufQuery = queryKOSDAQ; + break; + case 국내지수종류.KOSPI200: + bufQuery = queryKOSPI200; + break; + case 국내지수종류.KRX100: + bufQuery = queryKRX100; + break; + case 국내지수종류.선물: + bufQuery = queryFUTURE; + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORGIEN_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORGIEN_PAN.cs new file mode 100644 index 0000000..62dcb44 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_FORGIEN_PAN.cs @@ -0,0 +1,45 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class INDEX_FORGIEN_PAN : ADataObject + { + + internal INDEX_FORGIEN_PAN(해외지수종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + this.mDataCode = recvStockCode; + } + + 해외지수종류 mDataType; + + string mDataCode = String.Empty; + /// + /// 금일 데이터 쿼리 + /// + string queryBASIC = @"select a.f_input_name stock_name, round(b.f_last,2) curr_price, b.f_sign chg_type, round(b.f_diff,2) net_chg, round(b.f_rate,2) rate + from t_world_ix_eq_master a, t_world_ix_eq_sise b + where a.f_symb = b.f_symb + and a.f_symb = '{0}'"; + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + bufQuery += String.Format(queryBASIC, mDataCode); + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_PAN.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_PAN.cs new file mode 100644 index 0000000..ae82cb5 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/판데이터기본/지수/INDEX_PAN.cs @@ -0,0 +1,105 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class INDEX_PAN : ADataObject + { + + internal INDEX_PAN(국내지수종류 recvDataType) + { + this.mDataType = recvDataType; + } + + 국내지수종류 mDataType; + + #region 쿼리 + string queryKOSPI = @"SELECT '코스피' name, round(f_part_idx/100,2) part_idx, f_chg_type chg_type, round(f_part_chg/100,2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_index + WHERE f_part_code = '001'"; + + string queryKOSDAQ = @"SELECT '코스닥' name, round(f_part_idx/100,2) part_idx, f_chg_type chg_type, round(f_part_chg/100,2) part_chg, + round((f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1)) * 100, 2) rate + FROM t_kosdaq_index + WHERE f_part_code = '001'"; + + string queryKOSPI200 = @"SELECT '코스피200' name,f_part_idx/100 part_idx, f_chg_type chg_type, f_part_chg/100 part_chg, + round(f_part_chg / decode(f_chg_type, '+', f_part_idx - f_part_chg, '-', f_part_idx + f_part_chg, 1) * 100, 2) rate + FROM T_200_INDEX + WHERE f_part_code = '029'"; + + //string queryKRX100 = @"SELECT 'KRX100' name, f_part_idx/100 part_idx, f_chg_type chg_type, f_part_chg/100 part_chg, 1 + //round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), '-', (f_part_idx / 100) + (f_part_chg / 100)), 2) rate + //FROM t_krx100_index WHERE f_part_code = '043'"; + string queryKRX100 = @"SELECT 'KRX100' name, f_part_idx/100 part_idx, f_chg_type chg_type, f_part_chg/100 part_chg, + round(f_part_chg / decode(f_chg_type, '+', (f_part_idx / 100) - (f_part_chg / 100), '-', (f_part_idx / 100) + (f_part_chg / 100)), 2) rate + FROM t_krx100_index WHERE f_part_code = '043'"; + + + //string queryFUTURE = @"SELECT '선물' name, part_idx part_idx, chg_type, ABS(part_chg) part_chg,F_NET_VOL,f_out_vol, F_NET_TURNOVER, + // ABS(round(part_chg / decode(chg_type, '+', (part_idx / 100) - (part_chg / 100), + // '-', (part_idx / 100) + (part_chg / 100), 1), 2)) rate + // FROM(SELECT f_curr_price / 100 part_idx, F_NET_VOL, f_out_vol, F_NET_TURNOVER, + // (f_curr_price - f_base_price) / 100 part_chg, + // decode(sign(f_curr_price - f_base_price), 1, '+', -1, '-', 0, ' ') chg_type + // FROM t_sunmul_online + // WHERE f_stock_code = (select f_stock_code from t_sunmul_batch + //where f_market_date = (select max(f_market_date) + // from t_sunmul_batch) + // and substr(f_stock_code, 4, 1) = '1' + // and F_MONTH_GUBUN = '1'))"; + + + string queryFUTURE = @"SELECT '선물' name, part_idx part_idx, chg_type, ABS(part_chg) part_chg,F_NET_VOL,f_out_vol, F_NET_TURNOVER, + ABS(round(part_chg / decode(chg_type, '+', (part_idx / 100) - (part_chg / 100), + '-', (part_idx / 100) + (part_chg / 100), 1), 2)) rate + FROM(SELECT decode(a.f_curr_price,0, b.F_JUN_LAST_PRICE/100, a.f_curr_price/100) part_idx, a.F_NET_VOL, a.f_out_vol, a.F_NET_TURNOVER, + decode(a.f_curr_price, 0, 0, (a.f_curr_price - b.F_JUN_LAST_PRICE*100)/100) part_chg, + decode(a.f_curr_price, 0, ' ', decode(sign(a.f_curr_price -b.F_JUN_LAST_PRICE*100),1,'+',-1,'-',0,' ')) chg_type + FROM t_sunmul_online a, t_sunmul_batch b + WHERE a.f_stock_code = b.f_stock_code + AND a.f_stock_seq = 1 + AND b.f_market_date = (select max(OPEN_DAY) from v_open_day) + AND b.F_MONTH_GUBUN = '1') "; + + + #endregion + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (this.mDataType) + { + case 국내지수종류.KOSPI: + bufQuery = queryKOSPI; + break; + case 국내지수종류.KOSDAQ: + bufQuery = queryKOSDAQ; + break; + case 국내지수종류.KOSPI200: + bufQuery = queryKOSPI200; + break; + case 국내지수종류.KRX100: + bufQuery = queryKRX100; + break; + case 국내지수종류.선물: + bufQuery = queryFUTURE; + break; + } + + mRequestQuery.Add("", bufQuery); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/호가/Quote_Stocks.cs b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/호가/Quote_Stocks.cs new file mode 100644 index 0000000..b70e5ec --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/LegacyData/Request/호가/Quote_Stocks.cs @@ -0,0 +1,109 @@ +using MMoneyCoderSharp.Data.Request; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MMoneyCoderSharp.DBDefine; + +namespace MMoneyCoderSharp.DB +{ + /// + /// + internal class Quote_Stocks : ADataObject + { + + internal Quote_Stocks(국내시장종류 recvDataType, string recvStockCode) + { + this.mDataType = recvDataType; + + this.mStockCode = recvStockCode; + } + + 국내시장종류 mDataType; + + string mStockCode = ""; + + #region 쿼리 + string queryKOSPI = @"select a.f_stock_code , b.f_stock_wanname, a.f_curr_price, + a.f_net_chg NET_CHG, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, + '2', a.f_curr_price - a.f_net_chg, + '3', a.f_curr_price, + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate, + c.f_call_sell_1, + c.f_call_sell_2, + c.f_call_sell_3, + c.f_call_sell_jan_1, + c.f_call_sell_jan_2, + c.f_call_sell_jan_3, + c.f_call_buy_1, + c.f_call_buy_2, + c.f_call_buy_3, + c.f_call_buy_jan_1, + c.f_call_buy_jan_2, + c.f_call_buy_jan_3, + c.f_t_call_sell_jan, + c.f_t_call_buy_jan + from t_online1 a, t_stock b , t_online1_CALL c + where a.f_stock_code = b.f_stock_code + and a.f_stock_code = c.f_stock_code + and a.f_mkt_halt = 'N' + and a.f_curr_price > 0 + and a.f_stock_code = '{0}'"; + + string queryKOSDAQ = @"select a.f_stock_code , b.f_stock_wanname, a.f_curr_price, + a.f_net_chg NET_CHG, + decode(a.f_chg_type, '1', '상한', '2', '상승', '3', '보합', '4', '하한', '5', '하락') CHG_TYPE, + round((a.f_net_chg / decode(a.f_chg_type, '1', a.f_curr_price - a.f_net_chg, + '2', a.f_curr_price - a.f_net_chg, + '3', a.f_curr_price, + '4', -1*(a.f_curr_price + a.f_net_chg), + '5', -1*(a.f_curr_price + a.f_net_chg))) * 100, 2) rate, + c.f_call_sell_1, + c.f_call_sell_2, + c.f_call_sell_3, + c.f_call_sell_jan_1, + c.f_call_sell_jan_2, + c.f_call_sell_jan_3, + c.f_call_buy_1, + c.f_call_buy_2, + c.f_call_buy_3, + c.f_call_buy_jan_1, + c.f_call_buy_jan_2, + c.f_call_buy_jan_3, + c.f_t_call_sell_jan, + c.f_t_call_buy_jan + FROM t_kosdaq_online1 a, t_kosdaq_stock b , t_kosdaq_online1_CALL c + where a.f_stock_code = b.f_stock_code + and a.f_stock_code = c.f_stock_code + and a.f_mkt_halt = 'N' + and a.f_curr_price > 0 + and a.f_stock_code = '{0}'"; + + + #endregion + + public override IDataRequest buildData() + { + + string bufQuery = ""; + + switch (this.mDataType) + { + case 국내시장종류.KOSPI: + bufQuery = queryKOSPI; + break; + case 국내시장종류.KOSDAQ: + bufQuery = queryKOSDAQ; + break; + } + + mRequestQuery.Add("", String.Format(bufQuery, this.mStockCode)); + + return this; + } + } +} diff --git a/src/MBN_STOCK_WEBVIEW.Core/MBN_STOCK_WEBVIEW.Core.csproj b/src/MBN_STOCK_WEBVIEW.Core/MBN_STOCK_WEBVIEW.Core.csproj new file mode 100644 index 0000000..4f68472 --- /dev/null +++ b/src/MBN_STOCK_WEBVIEW.Core/MBN_STOCK_WEBVIEW.Core.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + disable + latest + MBN_STOCK_WEBVIEW.Core + MBN_STOCK_WEBVIEW.Core + $(NoWarn);CS0414 + + +