속도 개선
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Million
|
||||
{
|
||||
// 계산 저정 할/ 계산 저장 된 데이터 Class
|
||||
public SavedResultData _saveResultData;
|
||||
|
||||
|
||||
|
||||
// 현재 선택된 Indicator 폼
|
||||
private CommonIndicatorSetupUserForm _curruentIndicatorform;
|
||||
@@ -58,7 +58,7 @@ namespace Million
|
||||
simpleButton_ToSellList.Tag = "Sell";
|
||||
|
||||
// 지표 ComboBox 초기화
|
||||
comboBoxEdit_IndicatorSelection.Properties.Items.Clear();
|
||||
comboBoxEdit_IndicatorSelection.Properties.Items.Clear();
|
||||
comboBoxEdit_IndicatorSelection.Properties.Items.AddRange(InitManager.GetIndicatorTypeList());
|
||||
|
||||
// 저장 할 계산 데이터 클래스 생성
|
||||
@@ -281,29 +281,37 @@ namespace Million
|
||||
|
||||
Dictionary<string, bool> overlapBuyManagementList = null;
|
||||
|
||||
if (rd_RealtimeHunter.Checked)
|
||||
if (rd_RealtimeHunter.Checked)
|
||||
overlapBuyManagementList = new Dictionary<string, bool>();
|
||||
|
||||
InitManager.SettingInit(cb_IncludeClearIndicator.Checked, overlapBuyManagementList, totalIndicator);
|
||||
CommonProperty.UpperMainIndicatorFlag = cb_UpperMainIndi.Checked;
|
||||
CommonProperty.DownBeforeValueFlag = cb_DownBeforeValueFlag.Checked;
|
||||
|
||||
var hunterMode = rd_Hunter.Checked;
|
||||
var hunterMode = rd_Hunter.Checked;
|
||||
|
||||
var buyScript = new InteratorScripter("Buy Script");
|
||||
buyScript.regularExpressionString = _saveResultData.BuyRegularExpression;
|
||||
var sellScript = new InteratorScripter("Sell Script");
|
||||
sellScript.regularExpressionString = _saveResultData.SellRegularExpression;
|
||||
var sellExceptionScript = new InteratorScripter("Sell Exception Script");
|
||||
sellExceptionScript.regularExpressionString = _saveResultData.SellExceptionRegularExpression;
|
||||
|
||||
Parallel.For(0, tableList.Count, i =>
|
||||
{
|
||||
var market = tableList[i];
|
||||
var item = market.CoinFullName;
|
||||
var distinctIndicator = IndicatorSetupManager.Distinct(totalIndicator);
|
||||
|
||||
|
||||
if (hunterMode)
|
||||
{
|
||||
totalResultList.AddRange(CalculateHunter(totalIndicator, startDate, endDate, market, distinctIndicator));
|
||||
totalResultList.AddRange(CalculateHunter(totalIndicator, startDate, endDate, market, distinctIndicator,
|
||||
buyScript, sellScript));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
totalResultList.AddRange(CalculateHunterRealtime(totalIndicator, startDate, endDate,
|
||||
market, distinctIndicator, overlapBuyManagementList));
|
||||
totalResultList.AddRange(CalculateHunterRealtime(totalIndicator, startDate, endDate,
|
||||
market, distinctIndicator, overlapBuyManagementList, buyScript, sellScript, sellExceptionScript));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -389,17 +397,13 @@ namespace Million
|
||||
/// <param name="distinctIndicator"></param>
|
||||
/// <param name=""></param>
|
||||
/// <returns></returns>
|
||||
private List<SearchResult> CalculateHunterRealtime(List<IndicatorCoditionSetup> totalIndicator, DateTime startDate, DateTime endDate, MarketData market,
|
||||
List<IndicatorCoditionSetup> distinctIndicator, Dictionary<string, bool> overlapBuyManagementList)
|
||||
private List<SearchResult> CalculateHunterRealtime(List<IndicatorCoditionSetup> totalIndicator, DateTime startDate, DateTime endDate, MarketData market,
|
||||
List<IndicatorCoditionSetup> distinctIndicator, Dictionary<string, bool> overlapBuyManagementList,
|
||||
InteratorScripter buyScript, InteratorScripter sellScript, InteratorScripter sellExceptionScript)
|
||||
{
|
||||
var buyList = new List<CandleDataList>();
|
||||
var item = market.CoinFullName;
|
||||
var buyScript = new InteratorScripter("Buy Script");
|
||||
buyScript.regularExpressionString = _saveResultData.BuyRegularExpression;
|
||||
var sellScript = new InteratorScripter("Sell Script");
|
||||
sellScript.regularExpressionString = _saveResultData.SellRegularExpression;
|
||||
var sellExceptionScript = new InteratorScripter("Sell Exception Script");
|
||||
sellExceptionScript.regularExpressionString = _saveResultData.SellExceptionRegularExpression;
|
||||
|
||||
var subIndStringiList = DataManager.GetSubIndicatorStringList(totalIndicator);
|
||||
|
||||
var resultData = new List<SearchResult>();
|
||||
@@ -421,7 +425,7 @@ namespace Million
|
||||
var mTotalDataList = DbServiceFunctions.GetCandleData(market, startDate, endDate);
|
||||
foreach (var minData in mTotalDataList.CandleDataLists_Im)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var compareMin = standardData[CommonProperty.MCandleTimeType.M1].LastOrDefault();
|
||||
if (compareMin.DateTime == minData.DateTime) continue;
|
||||
@@ -435,8 +439,8 @@ namespace Million
|
||||
standardData[CommonProperty.MCandleTimeType.M1].Add(minData);
|
||||
|
||||
var compareHour = standardData[CommonProperty.MCandleTimeType.H1].LastOrDefault();
|
||||
|
||||
if(compareHour.DateTime.Hour != minData.DateTime.Hour)
|
||||
|
||||
if (compareHour.DateTime.Hour != minData.DateTime.Hour)
|
||||
{
|
||||
var candle = new CandleData();
|
||||
candle.CandleTimeType = (int)MCandleTimeType.H1;
|
||||
@@ -561,8 +565,9 @@ namespace Million
|
||||
/// <summary>
|
||||
/// Hunter 처리 로직
|
||||
/// </summary>
|
||||
private List<SearchResult> CalculateHunter(List<IndicatorCoditionSetup> totalIndicator, DateTime startDate, DateTime endDate, MarketData market, List<IndicatorCoditionSetup> distinctIndicator)
|
||||
{
|
||||
private List<SearchResult> CalculateHunter(List<IndicatorCoditionSetup> totalIndicator, DateTime startDate, DateTime endDate,
|
||||
MarketData market, List<IndicatorCoditionSetup> distinctIndicator, InteratorScripter buyScript, InteratorScripter sellScript)
|
||||
{
|
||||
// 총 데이터
|
||||
var dic = DataManager.GetStandardData(totalIndicator, startDate, endDate, market, distinctIndicator, true);
|
||||
|
||||
@@ -593,8 +598,8 @@ namespace Million
|
||||
|
||||
// 계산 로직
|
||||
var resultLsit = ResultLogicManager.GetSearchResultList(resultCandleDataList, lossIndicator,
|
||||
_saveResultData.BuyRegularExpression, _saveResultData.SellRegularExpression, market, totalIndicator);
|
||||
|
||||
market, totalIndicator, false, buyScript, sellScript);
|
||||
|
||||
return resultLsit;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,13 +65,10 @@ namespace Million.Manager
|
||||
/// <param name="sellRegularExpression"></param>
|
||||
/// <returns></returns>
|
||||
public static List<SearchResult> GetSearchResultList(List<CandleData> datas, List<IndicatorCoditionSetup> rateIndicators,
|
||||
string buyRegularExpression, string sellRegularExpression, MarketData market, List<IndicatorCoditionSetup> totalIndicator, bool insertTermCandleData = false)
|
||||
MarketData market, List<IndicatorCoditionSetup> totalIndicator, bool insertTermCandleData, InteratorScripter buyScript,
|
||||
InteratorScripter sellScript)
|
||||
{
|
||||
//buy, sell script 선언
|
||||
var buyScript = new InteratorScripter("Buy Script");
|
||||
buyScript.regularExpressionString = buyRegularExpression;
|
||||
var sellScript = new InteratorScripter("Sell Script");
|
||||
sellScript.regularExpressionString = sellRegularExpression;
|
||||
|
||||
|
||||
|
||||
var resultList = new List<SearchResult>();
|
||||
@@ -112,7 +109,7 @@ namespace Million.Manager
|
||||
if (deafultSellFlag)
|
||||
{
|
||||
//Sell Value 계산 로직
|
||||
item.SellValue = CalculateManager.GetConditionValue(sellRegularExpression, valDic, dic);
|
||||
item.SellValue = CalculateManager.GetConditionValue(sellScript.regularExpressionString, valDic, dic);
|
||||
|
||||
|
||||
defaultSellValue = item.SellValue;
|
||||
@@ -151,7 +148,7 @@ namespace Million.Manager
|
||||
if (errorList.Count > 0)
|
||||
continue;
|
||||
|
||||
var val = CalculateManager.GetConditionValue(sellRegularExpression, valDic, dic);
|
||||
var val = CalculateManager.GetConditionValue(sellScript.regularExpressionString, valDic, dic);
|
||||
|
||||
if (deafultSellFlag) {
|
||||
if (defaultSellValue > val)
|
||||
@@ -257,7 +254,7 @@ namespace Million.Manager
|
||||
if (flag)
|
||||
{
|
||||
var valDic = GetIndicateValue(dic, totalIndicator, item);
|
||||
var val = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(buyRegularExpression, valDic, dic));
|
||||
var val = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(buyScript.regularExpressionString, valDic, dic));
|
||||
item.BuyValue = val + Math.Round(val * 0.0005);
|
||||
buyList.Add(item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user