feat: initialize WinUI 3 WebView migration

This commit is contained in:
2026-07-10 04:32:15 +09:00
commit 5aa90e4aaa
103 changed files with 10903 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#nullable enable
using System.Data;
namespace MMoneyCoderSharp.Data;
/// <summary>
/// Identifies a legacy data source without coupling the core project to a provider package.
/// </summary>
public enum DataSourceKind
{
Oracle,
MariaDb
}
/// <summary>
/// Executes a migrated query. Infrastructure code supplies the provider implementation.
/// </summary>
public interface IDataQueryExecutor
{
DataTable Execute(DataSourceKind source, string tableName, string query);
}
/// <summary>
/// Compatibility seam used while the legacy request objects are migrated incrementally.
/// </summary>
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;
}

View File

@@ -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
{
,
,
,
}
/// <summary>
/// Cut_5,10참조
/// </summary>
public enum
{
,
,
,
,
,
,
200,
KRX100수익률,
,
,
,
,
,
,
,
,
}
/// <summary>
/// Cut_7참조
/// </summary>
public enum
{
KOSPI,
KOSDAQ,
KOSPI200,
KRX100,
,
,
,
,
,
,
,
,
k
}
/// <summary>
/// Cut_7 세부종목
/// KRX100, 업종지수는 예상지수가 없음.
/// </summary>
public enum
{
,
,
}
/// <summary>
/// Cut_8, Cut_9 참조
/// </summary>
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
/// <summary>
/// Holds the stringvalue for a value in an enum.
/// </summary>
public string StringValue { get; protected set; }
#endregion
#region Constructor
/// <summary>
/// Constructor used to init a StringValue Attribute
/// </summary>
/// <param name="value"></param>
public StringValueAttribute(string value)
{
this.StringValue = value;
}
#endregion
}
}
}

View File

@@ -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
{
/// <summary>
/// 데이터의 입/출력에 관한 정의를 위해 만든 추상화 빌더객체.
/// 필요한 데이터를 순서대로 빌드 할 수 있도록 리턴값으로 유도하고,
/// 모든 데이터가 있다면 최종적인 객체를 Struct형태로 리턴이 가능하도록 유도한다.
///
/// 내부의 데이터에 관련된 내용은 enum으로 정의하고 Int로 최종적으로 리턴받아 멤버변수로 보유한다.
///
/// 20210207 규합할수 없는 부분(지수와 종목의 쿼리합)에 대한 정의가 불가능하여 버린다.
/// 데이터를 기반으로 씬에 접근하려는 계획은 포기해야겠다. 이미 쿼리 자체가 그래픽에 파편화되어있어서 데이터를 기반으로 추상화 하기 불가능하다.
/// </summary>
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();
// }
}
}

View File

@@ -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
{
/// <summary>
/// 씬단위로 요청사항을 매핑해서 DB에서 받은 데이터를 리턴해줄 매니저 객체.
/// </summary>
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
/// <summary>
/// 스탁포멧정리기준.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. 영업이익 막대그래프 -> 쿼리가 없음
/// </summary>
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);
}
/// <summary>
/// 선그래프 데이터 요청 메서드
/// 마지막 매개변수는 종목일때는 한글종목명, 지수일때는 분류코드.
///
/// 여기가 기존 코드 중 cut_5,10으로 검색해서 나오는 데이터 모두.
///
/// </summary>
/// <param name="recvDataType">선그래프씬 데이터 분류</param>
/// <param name="recvDataLength">선그래프씬 데이터 길이</param>
/// <param name="recvArgData">종목은 해당 종목의 한글명으로, 지수는 코드값으로....</param>
/// <returns></returns>
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();
}
/// <summary>
/// 봉차트를 위한데이터
/// 종목과 업종지수 모두 추가 데이터로는 Code를 받는다.
///
/// 기존 코드에서 6,7컷부분
/// </summary>
/// <param name="recvDataTypeMain"></param>
/// <param name="recvDataTypeSub"></param>
/// <param name="recvDataLength"></param>
/// <param name="recvArgData">종목은 코드값 지수는 한글명..</param>
/// <returns></returns>
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();
}
/// <summary>
/// 그리드표 그래프 데이터
/// 컷14번은 쿼리가 없음
/// </summary>
/// <param name=""></param>
/// <returns></returns>
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();
}
/// <summary>
/// 20번컷 사각그래프용 데이터.
/// 국내시장 업종별 네모그래프
/// 15개종목이 이미 정해져있음.(선택불가)
/// </summary>
/// <param name="recvDataType">시장종류</param>
/// <returns></returns>
public DataSet createSquareChartData_Cut20( recvDataType)
{
IDataRequest bufInstance = new Square20(recvDataType);
bufInstance.buildData();
return bufInstance.getResult();
}
/// <summary>
/// 12번컷 데이터.
/// HWP 표와는 다르게 선물은 없음.
/// </summary>
/// <param name=""></param>
/// <returns></returns>
public DataSet createCut12StickData( recvDataType)
{
IDataRequest bufInstance = new Stick12(recvDataType);
bufInstance.buildData();
return bufInstance.getResult();
}
/// <summary>
/// 21번컷 데이터.
/// 12번과 헷갈리지 말 것
/// </summary>
/// <param name=""></param>
/// <returns></returns>
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 "판데이터"
/// <summary>
/// 1열판 국내지수류 데이터
/// </summary>
/// <param name="recvDataList"></param>
/// <param name="recvDataType"></param>
/// <returns></returns>
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();
}
/// <summary>
/// 1열판 산업종목류 데이터
/// </summary>
/// <param name="recvDataList"></param>
/// <param name="recvDataType"></param>
/// <param name="recvDataCode"></param>
/// <returns></returns>
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();
}
}
/// <summary>
/// 1열판 해외산업종목 데이터
/// </summary>
/// <param name="recvDataList"></param>
/// <param name="recvDataCode"></param>
/// <returns></returns>
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();
}
/// <summary>
/// 1열판해외지수류 데이터
/// </summary>
/// <param name="recvDataList"></param>
/// <returns></returns>
public DataSet createPlateData( recvDataList, string recvDataCode)
{
IDataRequest bufInstance = new INDEX_FORGIEN_PAN(recvDataList, recvDataCode);
bufInstance.buildData();
return bufInstance.getResult();
}
/// <summary>
/// 1열판원환율
/// </summary>
/// <param name="recvDataList"></param>
/// <returns></returns>
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<string> )
{
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();
}
}
}

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MMoneyCoderSharp
{
/// <summary>
/// 콜백 인터페이스
/// </summary>
public interface IDBDataHandle
{
void onDataReceived();
void onDBError();
}
}

View File

@@ -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
{
/// <summary>
/// Data Access Object
/// </summary>
public abstract class ADataObject : IDataRequest
{
public ADataObject()
{
mRequestQuery = new Dictionary<string, string>();
mReturnDataSet = new DataSet();
}
/// <summary>
/// 완성되어 DB로 전송될 쿼리
/// </summary>
protected Dictionary<string, string> mRequestQuery = new Dictionary<string, string>();
/// <summary>
/// 완성되어 결과를 리턴할 데이터 셋
/// </summary>
protected DataSet mReturnDataSet = null;
public string getQuery(string tableName)
{
return mRequestQuery[tableName];
}
public abstract IDataRequest buildData();
public DataSet getResult()
{
foreach (KeyValuePair<string, string> item in mRequestQuery)
{
mReturnDataSet.Tables.Add(
DataQueryExecutor.Current.Execute(DataSourceKind.Oracle, item.Key, item.Value));
}
return mReturnDataSet;
}
}
}

View File

@@ -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();
}
}

View File

@@ -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
{
/// <summary>
/// Data Access Object
/// </summary>
public abstract class Nxt_ADataObject : Nxt_IDataRequest
{
public Nxt_ADataObject()
{
Nxt_mRequestQuery = new Dictionary<string, string>();
Nxt_mReturnDataSet = new DataSet();
}
/// <summary>
/// 완성되어 DB로 전송될 쿼리
/// </summary>
protected Dictionary<string, string> Nxt_mRequestQuery = new Dictionary<string, string>();
/// <summary>
/// 완성되어 결과를 리턴할 데이터 셋
/// </summary>
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<string, string> item in Nxt_mRequestQuery)
{
Nxt_mReturnDataSet.Tables.Add(
DataQueryExecutor.Current.Execute(DataSourceKind.MariaDb, item.Key, item.Value));
}
return Nxt_mReturnDataSet;
}
}
}

View File

@@ -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();
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Grid11 : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Grid13 : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Grid14 : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
string queryToday = @"";
public override IDataRequest buildData()
{
string bufQuery = "";
bufQuery += String.Format(queryToday);
mRequestQuery.Add("", bufQuery);
return this;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Grid8 : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Grid9 : ADataObject
{
public Grid9( recvMarketType)
{
this.mMarketType = recvMarketType;
}
private mMarketType;
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Stick12 : ADataObject
{
public Stick12( recvMarketType)
{
this.mMarketType = recvMarketType;
}
private mMarketType;
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Stick21 : ADataObject
{
public Stick21( recvDataType)
{
this.mDataType = recvDataType;
}
private mDataType;
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
///
/// </summary>
/// <param name="recvStockName"></param>
/// <param name="recvDataLength"></param>
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();
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}
}

View File

@@ -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
}
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}
}

View File

@@ -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
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class Square20 : ADataObject
{
public Square20( recvMarketType)
{
this.mMarketType = recvMarketType;
}
private mMarketType;
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// 환율선그래프관련 DB데이터 쿼리매핑 오브젝트.
///
/// 오늘데이터를 가져오는 쿼리와 기존 데이터 목록을 가져오는 쿼리가 각각 정리되어있다.
/// 선그래프등의 여러 데이터를 가져와야하는 쿼리의 경우 해당 쿼리를 union하여 더해서 리턴한다.
/// </summary>
internal class Exchange : ADataObject
{
public Exchange( recvDataType, recvDataLength)
{
this.dataType = recvDataType;
this.dataLenght = recvDataLength;
}
/// <summary>
/// 환율데이터 종류
/// </summary>
private dataType;
/// <summary>
/// 가져올 데이터 기간
/// </summary>
private dataLenght;
/// <summary>
/// 누적데이터 쿼리
/// </summary>
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}
)
";
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
///
/// </summary>
/// <param name="recvStockName"></param>
/// <param name="recvDataLength"></param>
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;
}
}
}

View File

@@ -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
{
/// <summary>
///
/// </summary>
/// <param name="recvStockName"></param>
/// <param name="recvDataLength"></param>
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;
}
}
}

View File

@@ -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
{
/// <summary>
///
/// </summary>
/// <param name="recvStockName"></param>
/// <param name="recvDataLength"></param>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// 10번컷
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class MapAsia : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class MapEurope : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class MapUSA : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class MapWorld : ADataObject
{
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class suggest_5dan : ADataObject
{
internal suggest_5dan(List<string> recvStockList)
{
this.mStockCodeList = recvStockList;
}
//국내시장종류 mDataType;
List<string> 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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class theme_5dan : ADataObject
{
internal theme_5dan(List<string> recvStockList)
{
this.mStockCodeList = recvStockList;
}
List<string> 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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class theme_yesang_5dan : ADataObject
{
internal theme_yesang_5dan(List<string> recvStockList)
{
this.mStockCodeList = recvStockList;
}
List<string> 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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class INDUSTRY_FORGIEN_PAN : ADataObject
{
public INDUSTRY_FORGIEN_PAN(string recvCode)
{
this.mDataCode = recvCode;
}
string mDataCode = "";
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class STOCK_FORGIEN_PAN : ADataObject
{
public STOCK_FORGIEN_PAN(string recvCode)
{
this.mDataCode = recvCode;
}
string mDataCode = "";
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
internal class INDEX_FORGIEN_PAN : ADataObject
{
internal INDEX_FORGIEN_PAN( recvDataType, string recvStockCode)
{
this.mDataType = recvDataType;
this.mDataCode = recvStockCode;
}
mDataType;
string mDataCode = String.Empty;
/// <summary>
/// 금일 데이터 쿼리
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -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
{
/// <summary>
/// </summary>
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;
}
}
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>latest</LangVersion>
<RootNamespace>MBN_STOCK_WEBVIEW.Core</RootNamespace>
<AssemblyName>MBN_STOCK_WEBVIEW.Core</AssemblyName>
<NoWarn>$(NoWarn);CS0414</NoWarn>
</PropertyGroup>
</Project>