64 비트 수정
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
|
||||
@@ -32,6 +32,26 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<LangVersion>7.3</LangVersion>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
|
||||
@@ -14,6 +14,7 @@ using Million.FileDBManagement;
|
||||
using Million.Manager;
|
||||
using Million.SaveData;
|
||||
using Microsoft.CodeAnalysis.CSharp.Scripting;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Million_Hunter
|
||||
{
|
||||
@@ -59,7 +60,7 @@ namespace Million_Hunter
|
||||
// 트리리스트 와 클래스 리스트 연결
|
||||
treeList_BuySetupList.DataSource = _saveResultData.BuySetupList = new List<object>();
|
||||
treeList_SellSetupList.DataSource = _saveResultData.SellSetupList = new List<object>();
|
||||
|
||||
|
||||
|
||||
// 지표 새로 추가 시 수정/삭제 버튼 Visible 처리
|
||||
simpleButton_SetupEdit.Visible = false;
|
||||
@@ -67,7 +68,7 @@ namespace Million_Hunter
|
||||
simpleButton_TobuyList.Visible = true;
|
||||
simpleButton_ToSellList.Visible = true;
|
||||
|
||||
DbServiceFunctions.GetMarketTable_FromDB("Upbit");
|
||||
DbServiceFunctions.GetMarketTable_FromDB("Upbit", "KRW");
|
||||
}
|
||||
|
||||
// 지표 콤보박스 클릭 시 이벤트
|
||||
@@ -75,7 +76,7 @@ namespace Million_Hunter
|
||||
{
|
||||
var comboboxEdit = sender as ComboBoxEdit;
|
||||
if (comboboxEdit == null) return;
|
||||
if(comboboxEdit.SelectedIndex < 0) return;
|
||||
if (comboboxEdit.SelectedIndex < 0) return;
|
||||
|
||||
Enum.TryParse(comboBoxEdit_IndicatorSelection.SelectedItem.ToString(),
|
||||
out CommonProperty.IndicatorType indicatorType);
|
||||
@@ -91,7 +92,7 @@ namespace Million_Hunter
|
||||
|
||||
// 현재 수정/삭제 대기중인 클래스의 초기화
|
||||
_curIndicatorSetup = null;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 지표 조건 설정 폼 생성하기
|
||||
@@ -111,7 +112,7 @@ namespace Million_Hunter
|
||||
private void simpleButton_BuySellButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
var button = sender as SimpleButton;
|
||||
|
||||
|
||||
// 예외처리
|
||||
if (_curruentIndicatorform == null || comboBoxEdit_IndicatorSelection.SelectedItem == null) return;
|
||||
|
||||
@@ -121,7 +122,7 @@ namespace Million_Hunter
|
||||
|
||||
// Buy Sell 구분
|
||||
Enum.TryParse(button.Tag.ToString(), out CommonProperty.BuySellType buySelltype);
|
||||
_curIndicatorSetup = (IndicatorCoditionSetup) _curruentIndicatorform.SaveIndicatorSetup(true);
|
||||
_curIndicatorSetup = (IndicatorCoditionSetup)_curruentIndicatorform.SaveIndicatorSetup(true);
|
||||
_curIndicatorSetup.ByBuySellType = buySelltype;
|
||||
_curIndicatorSetup.IndexString = _lastIndexString.ToString();
|
||||
|
||||
@@ -136,7 +137,7 @@ namespace Million_Hunter
|
||||
treeList_SellSetupList.RefreshDataSource();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
_lastIndexString++;
|
||||
// 현재 수정/삭제 대기중인 클래스의 초기화
|
||||
_curIndicatorSetup = null;
|
||||
@@ -151,10 +152,10 @@ namespace Million_Hunter
|
||||
if (treeList == null) return;
|
||||
|
||||
var hitInfo = treeList.CalcHitInfo(e.Location);
|
||||
|
||||
|
||||
if (hitInfo.HitInfoType != HitInfoType.Cell) return;
|
||||
|
||||
var indicatorType = (CommonProperty.IndicatorType) hitInfo.Node["IndicatorType"];
|
||||
var indicatorType = (CommonProperty.IndicatorType)hitInfo.Node["IndicatorType"];
|
||||
|
||||
var indicatorSetupClassData = treeList.GetDataRecordByNode(hitInfo.Node);
|
||||
|
||||
@@ -196,7 +197,7 @@ namespace Million_Hunter
|
||||
private void simpleButton_SetupDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_curIndicatorSetup == null) return;
|
||||
|
||||
|
||||
// 해당 List안에 있는 Class를 삭제
|
||||
if (_saveResultData.BuySetupList.Contains(_curIndicatorSetup))
|
||||
{
|
||||
@@ -208,13 +209,13 @@ namespace Million_Hunter
|
||||
_saveResultData.SellSetupList.Remove(_curIndicatorSetup);
|
||||
treeList_SellSetupList.RefreshDataSource();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 조건 설정 창 초기화
|
||||
_curruentIndicatorform = null;
|
||||
panelControl_IndicatorSetup.Controls.Clear();
|
||||
comboBoxEdit_IndicatorSelection.Text = "";
|
||||
|
||||
|
||||
// 지표 새로 추가 시 수정/삭제 버튼 Visible 처리
|
||||
simpleButton_SetupEdit.Visible = false;
|
||||
simpleButton_SetupDelete.Visible = false;
|
||||
@@ -269,65 +270,85 @@ namespace Million_Hunter
|
||||
candleTypeList = candleTypeList.Distinct().ToList();
|
||||
|
||||
var tableList = CommonProperty.selectedMarketOfPlaceList;
|
||||
|
||||
var totalResultList = new List<SearchResult>();
|
||||
//임시로 하나만
|
||||
var selectTable = tableList.FirstOrDefault(t => t.CodeFullName == "KRW-BTC");
|
||||
//data setting
|
||||
var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicator);
|
||||
Parallel.For(0, tableList.Count, i =>
|
||||
|
||||
var dic = new Dictionary<CommonProperty.MCandleTimeType, List<List<CandleData>>>();
|
||||
|
||||
foreach(var item in candleTypeList)
|
||||
//foreach (var selectTable in tableList)
|
||||
{
|
||||
var candleDataListClass = DbServiceFunctions.GetCandleData(selectTable,
|
||||
_saveResultData.StartDateTime, _saveResultData.EndDateTime, item);
|
||||
var selectTable = tableList[i];
|
||||
//data setting
|
||||
var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicator);
|
||||
|
||||
var indicatorSetUpList = distinctIndicator.Where(t => t.MCandleTimeType == item).ToList();
|
||||
foreach (var setup in indicatorSetUpList)
|
||||
{
|
||||
setup.excute(candleDataListClass.CandleDataLists_Im);
|
||||
var dic = new Dictionary<CommonProperty.MCandleTimeType, List<List<CandleData>>>();
|
||||
|
||||
foreach (var item in candleTypeList)
|
||||
{
|
||||
var candleDataListClass = DbServiceFunctions.GetCandleData(selectTable,
|
||||
_saveResultData.StartDateTime, _saveResultData.EndDateTime, item);
|
||||
|
||||
var indicatorSetUpList = distinctIndicator.Where(t => t.MCandleTimeType == item).ToList();
|
||||
foreach (var setup in indicatorSetUpList)
|
||||
{
|
||||
setup.excute(candleDataListClass.CandleDataLists_Im);
|
||||
}
|
||||
|
||||
dic[item] = ValidationCheckManager.SplitValidationCandleDataList(candleDataListClass.CandleDataLists_Im, item);
|
||||
}
|
||||
|
||||
var resultCandleDataList = new List<CandleData>();
|
||||
|
||||
// buy, sell 계산
|
||||
var lossIndicator = new List<IndicatorCoditionSetup>();
|
||||
var totalCalculateCandleList = new List<CandleData>();
|
||||
foreach (var item in dic[CommonProperty.MCandleTimeType.M1])
|
||||
resultCandleDataList.AddRange(item);
|
||||
|
||||
foreach (var indicator in totalIndicator)
|
||||
{
|
||||
if (indicator.IndicatorType == CommonProperty.IndicatorType.가격비율)
|
||||
lossIndicator.Add(indicator);
|
||||
else
|
||||
totalCalculateCandleList.AddRange(CalculateManager.SwitchFun(indicator, dic[indicator.MCandleTimeType], resultCandleDataList));
|
||||
}
|
||||
|
||||
//계산되지 않는 범위의 데이터 Filter
|
||||
totalCalculateCandleList = totalCalculateCandleList.Where(t => t.DateTime >= _saveResultData.StartDateTime && t.DateTime < _saveResultData.EndDateTime).ToList();
|
||||
|
||||
var resultLsit = ResultLogicManager.GetSearchResultList(resultCandleDataList, lossIndicator,
|
||||
_saveResultData.BuyRegularExpression, _saveResultData.SellRegularExpression, selectTable, totalIndicator);
|
||||
totalResultList.AddRange(resultLsit);
|
||||
}
|
||||
|
||||
dic[item] = ValidationCheckManager.SplitValidationCandleDataList(candleDataListClass.CandleDataLists_Im, item);
|
||||
}
|
||||
|
||||
var resultCandleDataList = new List<CandleData>();
|
||||
|
||||
// buy, sell 계산
|
||||
var lossIndicator = new List<IndicatorCoditionSetup>();
|
||||
|
||||
foreach (var item in dic[CommonProperty.MCandleTimeType.M1])
|
||||
resultCandleDataList.AddRange(item);
|
||||
|
||||
foreach (var indicator in totalIndicator)
|
||||
{
|
||||
if (indicator.IndicatorType == CommonProperty.IndicatorType.가격비율)
|
||||
lossIndicator.Add(indicator);
|
||||
else
|
||||
CalculateManager.SwitchFun(indicator, dic[indicator.MCandleTimeType], resultCandleDataList);
|
||||
}
|
||||
|
||||
//계산되지 않는 범위의 데이터 Filter
|
||||
resultCandleDataList = resultCandleDataList.Where(t => t.DateTime >= _saveResultData.StartDateTime && t.DateTime < _saveResultData.EndDateTime).ToList();
|
||||
|
||||
var resultLsit = ResultLogicManager.GetSearchResultList(resultCandleDataList, lossIndicator,
|
||||
_saveResultData.BuyRegularExpression, _saveResultData.SellRegularExpression, selectTable, totalIndicator);
|
||||
|
||||
);
|
||||
|
||||
double totalVal = 0;
|
||||
int win = 0;
|
||||
int lose = 0;
|
||||
double win = 0;
|
||||
double lose = 0;
|
||||
//승률, 수익률 계산
|
||||
foreach(var item in resultLsit)
|
||||
foreach (var item in totalResultList)
|
||||
{
|
||||
win += item.WinCount;
|
||||
lose += item.LoseCount;
|
||||
totalVal += item.TotalEarningRate;
|
||||
}
|
||||
_saveResultData.WinRate = (win / (win + lose)) * 100;
|
||||
_saveResultData.ProfitRate = totalVal / resultLsit.Count;
|
||||
_saveResultData.SearchResultList = resultLsit;
|
||||
|
||||
var winRate = 0.0;
|
||||
if (win == 0)
|
||||
{
|
||||
winRate = 0;
|
||||
}
|
||||
else if (lose == 0)
|
||||
{
|
||||
winRate = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
winRate = (win * 100 / (win + lose));
|
||||
}
|
||||
_saveResultData.WinRate = winRate;
|
||||
_saveResultData.ProfitRate = totalVal / totalResultList.Count;
|
||||
_saveResultData.SearchResultList = totalResultList;
|
||||
|
||||
// 3. 자동으로 저장하기
|
||||
if (FileManager.SaveResultDataToFile(_saveResultData))
|
||||
MessageBox.Show("데이터 저장 성공");
|
||||
@@ -346,7 +367,7 @@ namespace Million_Hunter
|
||||
return;
|
||||
}
|
||||
|
||||
var resultViewerForm = new ResultViewerForm(_saveResultData) { StartPosition = FormStartPosition.CenterScreen};
|
||||
var resultViewerForm = new ResultViewerForm(_saveResultData) { StartPosition = FormStartPosition.CenterScreen };
|
||||
resultViewerForm.Visible = true;
|
||||
}
|
||||
|
||||
@@ -355,7 +376,7 @@ namespace Million_Hunter
|
||||
{
|
||||
var savedResultViewerForm = new SavedResultViewerForm(this) { StartPosition = FormStartPosition.CenterScreen };
|
||||
if (savedResultViewerForm.ShowDialog() != DialogResult.OK) return;
|
||||
|
||||
|
||||
// 시간 데이터 추가
|
||||
dateEdit_StartDateTime.Text = _saveResultData.StartDateTime.Date.ToString();
|
||||
dateEdit_EndDateTime.Text = _saveResultData.EndDateTime.Date.ToString();
|
||||
@@ -401,4 +422,3 @@ namespace Million_Hunter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
|
||||
22
Million.sln
22
Million.sln
@@ -16,29 +16,51 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{10EF08CB-BF38-4882-A92A-30DB34E8E8BD}.Release|x64.Build.0 = Release|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}.Release|x64.Build.0 = Release|Any CPU
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Debug|x64.Build.0 = Debug|x64
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Release|x64.ActiveCfg = Release|x64
|
||||
{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Release|x64.Build.0 = Release|x64
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{828206F2-6876-4B32-8B41-B925D809A1E7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{359B3045-ADB0-4708-AEEE-FCA9E706707F}.Release|x64.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -66,9 +66,9 @@ namespace Million.DbManagement
|
||||
/// </summary>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
public static void GetMarketTable_FromDB(string tableName)
|
||||
public static void GetMarketTable_FromDB(string tableName, string payment = null)
|
||||
{
|
||||
selectedMarketOfPlaceList = GetMarketDatas(tableName);
|
||||
selectedMarketOfPlaceList = GetMarketDatas(tableName, payment);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Million.Manager
|
||||
|
||||
}
|
||||
|
||||
public static void SwitchFun(IndicatorCoditionSetup setUp, List<List<CandleData>> parentCandleDataList,
|
||||
public static List<CandleData> SwitchFun(IndicatorCoditionSetup setUp, List<List<CandleData>> parentCandleDataList,
|
||||
List<CandleData> childrenCandleDataList)
|
||||
{
|
||||
var parentList = new List<CandleData>();
|
||||
@@ -225,25 +225,26 @@ namespace Million.Manager
|
||||
//돌파
|
||||
if (setUp.OverStatusEnumList.Count > 0)
|
||||
{
|
||||
Transpierce(setUp, parentList, childrenCandleDataList);
|
||||
return Transpierce(setUp, parentList, childrenCandleDataList);
|
||||
}
|
||||
//단순비교
|
||||
else if (setUp.IndicatorOver != CommonProperty.Indicator_over.없음)
|
||||
{
|
||||
SimpleComparison(setUp, parentList, childrenCandleDataList);
|
||||
}
|
||||
return SimpleComparison(setUp, parentList, childrenCandleDataList);
|
||||
}
|
||||
return new List<CandleData>();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 상향, 하향으로 뚫었을 경우
|
||||
/// </summary>
|
||||
public static void Transpierce(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList, List<CandleData> childrenCandleDataList)
|
||||
public static List<CandleData> Transpierce(IndicatorCoditionSetup setUp, List<CandleData> parentCandleDataList, List<CandleData> childrenCandleDataList)
|
||||
{
|
||||
var key = GetKeyData(setUp);
|
||||
|
||||
if (key == null) return;
|
||||
|
||||
if (key == null) return new List<CandleData>();
|
||||
var returnData = new List<CandleData>();
|
||||
foreach (var item in parentCandleDataList)
|
||||
{
|
||||
if (!item.IndicatorDic.ContainsKey(key)) continue;
|
||||
@@ -253,9 +254,17 @@ namespace Million.Manager
|
||||
|
||||
if (setUp.OverStatusEnumList.Any(t => t == item.IndicatorDic[key].overStatus))
|
||||
{
|
||||
//시간봉 계산
|
||||
var childList = GetChildrenDatas(item, setUp.MCandleTimeType, childrenCandleDataList);
|
||||
|
||||
var childList = new List<CandleData>();
|
||||
if (item.CandleTimeType == (int)MCandleTimeType.M1)
|
||||
{
|
||||
var child = childrenCandleDataList.FirstOrDefault(t => t.DateTime == item.DateTime);
|
||||
if (child == null) continue;
|
||||
childList.Add(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
childList = GetChildrenDatas(item, setUp.MCandleTimeType, childrenCandleDataList);
|
||||
}
|
||||
for (var i = 0; i < childList.Count; i++)
|
||||
{
|
||||
var child = childList[i];
|
||||
@@ -284,8 +293,10 @@ namespace Million.Manager
|
||||
child.IndicatorDic[key].overlapValue = overlapData;
|
||||
}
|
||||
}
|
||||
returnData.AddRange(childList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -299,8 +310,8 @@ namespace Million.Manager
|
||||
//비교할 데이터 Key 설정
|
||||
var key = GetKeyData(setUp);
|
||||
|
||||
if (key == null) return null;
|
||||
|
||||
if (key == null) return new List<CandleData>();
|
||||
var returnData = new List<CandleData>();
|
||||
foreach (var item in parentCandleDataList)
|
||||
{
|
||||
if (!item.IndicatorDic.ContainsKey(key)) continue;
|
||||
@@ -309,8 +320,17 @@ namespace Million.Manager
|
||||
|
||||
if (CompareSettingValueOfTranspierce(setUp.IndicatorOver, overlapData, value))
|
||||
{
|
||||
var childList = GetChildrenDatas(item, setUp.MCandleTimeType, childrenCandleDataList);
|
||||
|
||||
var childList = new List<CandleData>();
|
||||
if (item.CandleTimeType == (int)MCandleTimeType.M1)
|
||||
{
|
||||
var child = childrenCandleDataList.FirstOrDefault(t => t.DateTime == item.DateTime);
|
||||
if (child == null) continue;
|
||||
childList.Add(child);
|
||||
}
|
||||
else
|
||||
{
|
||||
childList = GetChildrenDatas(item, setUp.MCandleTimeType, childrenCandleDataList);
|
||||
}
|
||||
/**
|
||||
* 시가 계산법 : Parent가 T 시 Children은 모두 T
|
||||
* 종가 계산법 : Parent가 T 시 Children 하나하나 종가 데이터를 기준으로 T, F 계산
|
||||
@@ -386,10 +406,11 @@ namespace Million.Manager
|
||||
}
|
||||
}
|
||||
}
|
||||
returnData.AddRange(childList);
|
||||
}
|
||||
}
|
||||
|
||||
return childrenCandleDataList;
|
||||
return returnData;
|
||||
}
|
||||
/// <summary>
|
||||
/// 단순비교 조건 시 Data 비교 함수
|
||||
@@ -546,14 +567,15 @@ namespace Million.Manager
|
||||
{
|
||||
var startDate = parentCandleData.DateTime;
|
||||
var endDate = startDate;
|
||||
if (parentCadleType == CommonProperty.MCandleTimeType.M1)
|
||||
{
|
||||
endDate = endDate.AddMinutes(1);
|
||||
var temp = new List<CandleData>();
|
||||
temp.Add(childrenCandleDatas.FirstOrDefault(t => t.DateTime == startDate));
|
||||
return temp;
|
||||
}
|
||||
else if (parentCadleType == CommonProperty.MCandleTimeType.M3)
|
||||
//if (parentCadleType == CommonProperty.MCandleTimeType.M1)
|
||||
//{
|
||||
// endDate = endDate.AddMinutes(1);
|
||||
// var temp = new List<CandleData>();
|
||||
// temp.Add(childrenCandleDatas.FirstOrDefault(t => t.DateTime == startDate));
|
||||
// return temp;
|
||||
//}
|
||||
//else
|
||||
if (parentCadleType == CommonProperty.MCandleTimeType.M3)
|
||||
{
|
||||
endDate = endDate.AddMinutes(3);
|
||||
}
|
||||
|
||||
@@ -14,6 +14,30 @@ namespace Million.Manager
|
||||
/// </summary>
|
||||
public static class ResultLogicManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Indicate value 데이터 Return
|
||||
/// </summary>
|
||||
/// <param name="indicateDic"></param>
|
||||
/// <param name="totalIndicator"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
private static Dictionary<string, double> GetIndicateValue(Dictionary<string, bool> indicateDic, List<IndicatorCoditionSetup> totalIndicator, CandleData item)
|
||||
{
|
||||
var valDic = new Dictionary<string, double>();
|
||||
|
||||
foreach (var key in indicateDic)
|
||||
{
|
||||
var indicate = totalIndicator.FirstOrDefault(t => t.IndexString == key.Key);
|
||||
|
||||
var keyData = CalculateManager.GetKeyData(indicate);
|
||||
if (item.IndicatorDic.ContainsKey(keyData))
|
||||
valDic.Add(key.Key, item.IndicatorDic[keyData].overlapValue);
|
||||
else
|
||||
valDic.Add(key.Key, 0);
|
||||
}
|
||||
return valDic;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 정규식 기준 ResultList 계산 로직
|
||||
/// </summary>
|
||||
@@ -56,21 +80,10 @@ namespace Million.Manager
|
||||
#region Sell
|
||||
//기본 조건
|
||||
var dic = item.CalculateFlag;
|
||||
var valDic = new Dictionary<string, double>();
|
||||
//Buy Value 계산 로직
|
||||
foreach (var key in dic)
|
||||
{
|
||||
var indicate = totalIndicator.FirstOrDefault(t => t.IndexString == key.Key);
|
||||
|
||||
var keyData = CalculateManager.GetKeyData(indicate);
|
||||
if(item.IndicatorDic.ContainsKey(keyData))
|
||||
valDic.Add(key.Key, item.IndicatorDic[keyData].overlapValue);
|
||||
else
|
||||
valDic.Add(key.Key, 0);
|
||||
}
|
||||
|
||||
if (buyList.Count > 0)
|
||||
{
|
||||
var valDic = GetIndicateValue(dic, totalIndicator, item);
|
||||
//기본 False처리
|
||||
foreach (var sellIndicator in sellRateIndicators)
|
||||
dic[sellIndicator.IndexString] = false;
|
||||
@@ -93,7 +106,6 @@ namespace Million.Manager
|
||||
{
|
||||
foreach (var buy in buyList)
|
||||
{
|
||||
|
||||
var buyValue = buy.BuyValue;
|
||||
foreach (var sellIndicator in sellRateIndicators)
|
||||
{
|
||||
@@ -115,6 +127,11 @@ namespace Million.Manager
|
||||
|
||||
if (sellFlag)
|
||||
{
|
||||
var termList = datas.Where(t => t.DateTime >= buyList[0].DateTime && t.DateTime < item.DateTime).ToList();
|
||||
var errorList = ValidationCheckManager.ValidateCandleDataList(termList, "", MCandleTimeType.M1);
|
||||
if (errorList.Count > 0)
|
||||
continue;
|
||||
|
||||
var val = CalculateManager.GetConditionValue(sellRegularExpression, valDic, dic);
|
||||
|
||||
if (deafultSellFlag) {
|
||||
@@ -125,7 +142,7 @@ namespace Million.Manager
|
||||
}
|
||||
|
||||
val = OrderbookManager.GetAskPrice(val, false);
|
||||
item.SellValue = val - Math.Round(val * 0.05);
|
||||
item.SellValue = val - Math.Round(val * 0.0005);
|
||||
|
||||
var result = new SearchResult();
|
||||
var rate = ((item.SellValue - buyValue) / buyValue) * 100;
|
||||
@@ -139,13 +156,9 @@ namespace Million.Manager
|
||||
result.TotalEarningRate = rate;
|
||||
result.WinCount = rate > 0 ? 1 : 0;
|
||||
result.LoseCount = rate < 0 ? 1 : 0;
|
||||
result.TermCandleDataList = datas.Where(t => t.DateTime >= buy.DateTime && t.DateTime < item.DateTime).ToList();
|
||||
var errorList = ValidationCheckManager.ValidateCandleDataList(result.TermCandleDataList, "", MCandleTimeType.M1);
|
||||
if (errorList.Count == 0)
|
||||
{
|
||||
resultList.Add(result);
|
||||
removeBuyList.Add(buy);
|
||||
}
|
||||
result.TermCandleDataList = termList;
|
||||
resultList.Add(result);
|
||||
removeBuyList.Add(buy);
|
||||
}
|
||||
}
|
||||
foreach (var remove in removeBuyList)
|
||||
@@ -155,8 +168,16 @@ namespace Million.Manager
|
||||
if (deafultSellFlag)
|
||||
if (buyList.Count > 0)
|
||||
{
|
||||
var termList = datas.Where(t => t.DateTime >= buyList[0].DateTime && t.DateTime < item.DateTime).ToList();
|
||||
var errorList = ValidationCheckManager.ValidateCandleDataList(termList, "", MCandleTimeType.M1);
|
||||
if (errorList.Count > 0)
|
||||
{
|
||||
buyList.Clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
var val = OrderbookManager.GetAskPrice(defaultSellValue, false);
|
||||
item.SellValue = val - Math.Round(val * 0.05);
|
||||
item.SellValue = val - Math.Round(val * 0.0005);
|
||||
var result = new SearchResult();
|
||||
|
||||
result.BuyList.ConGoodsData = market;
|
||||
@@ -183,13 +204,11 @@ namespace Million.Manager
|
||||
}
|
||||
|
||||
result.StartDate = result.BuyList.CandleDataLists_Im[0].DateTime;
|
||||
result.TermCandleDataList = datas.Where(t => t.DateTime >= buyList[0].DateTime && t.DateTime < item.DateTime).ToList();
|
||||
var errorList = ValidationCheckManager.ValidateCandleDataList(result.TermCandleDataList, "", MCandleTimeType.M1);
|
||||
if (errorList.Count == 0)
|
||||
{
|
||||
result.TotalEarningRate = totalRate;
|
||||
resultList.Add(result);
|
||||
}
|
||||
result.TermCandleDataList = termList;
|
||||
|
||||
result.TotalEarningRate = totalRate;
|
||||
resultList.Add(result);
|
||||
|
||||
buyList.Clear();
|
||||
}
|
||||
}
|
||||
@@ -199,8 +218,9 @@ namespace Million.Manager
|
||||
var flag = buyScript.DicExcuteScript(dic);
|
||||
if (flag)
|
||||
{
|
||||
var valDic = GetIndicateValue(dic, totalIndicator, item);
|
||||
var val = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(buyRegularExpression, valDic, dic));
|
||||
item.BuyValue = val + Math.Round(val * 0.05);
|
||||
item.BuyValue = val + Math.Round(val * 0.0005);
|
||||
|
||||
buyList.Add(item);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Million.SaveData
|
||||
|
||||
// 결과 정리
|
||||
// 승률
|
||||
public float WinRate { get; set; }
|
||||
public double WinRate { get; set; }
|
||||
// 수익휼
|
||||
public double ProfitRate { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user