Revert "조건 비교 관련 바이어에 예외처리 코드 추가"

This reverts commit fc9115fbf1.
This commit is contained in:
kyh
2024-03-11 11:43:25 +09:00
parent 1e4c4f09bb
commit b2a685d9e2
3 changed files with 59 additions and 79 deletions

View File

@@ -29,6 +29,8 @@ namespace Million_Buyer
{
public partial class MainForm : Form
{
BuyerMode programMode = BuyerMode.BuyerRealtime;
private SavedResultData _saveResultData;
//결과 데이터
private List<SearchResult> resultDataList;
@@ -78,7 +80,7 @@ namespace Million_Buyer
public void Init()
{
InitManager.InitFunc("Upbit", PaymentType.KRW);
CommonProperty.programMode = BuyerMode.BuyerRealtime;
cb_BigMoneyVolType.Properties.Items.Clear();
cb_BigMoneyVolType.Properties.Items.AddRange(InitManager.GetCandleTimeTypes());
cb_BuyBigthanHighType.Properties.Items.Clear();
@@ -105,9 +107,9 @@ namespace Million_Buyer
/// <param name="sender"></param>
/// <param name="e"></param>
private void rd_Realtime_CheckedChanged(object sender, EventArgs e)
{
CommonProperty.programMode = BuyerMode.BuyerRealtime;
SetReadOnly(true);
{
programMode = BuyerMode.BuyerRealtime;
SetReadOnly(true);
}
/// <summary>
@@ -116,9 +118,9 @@ namespace Million_Buyer
/// <param name="sender"></param>
/// <param name="e"></param>
private void rd_buyer_CheckedChanged(object sender, EventArgs e)
{
CommonProperty.programMode = BuyerMode.Buyer;
SetReadOnly(false);
{
programMode = BuyerMode.Buyer;
SetReadOnly(false);
}
/// <summary>
@@ -172,11 +174,11 @@ namespace Million_Buyer
TopVolFlag = cb_TopVol.Checked;
BigMoneyVolFlag = ck_BigMoneyVol.Checked;
if (BigMoneyVolFlag)
if(BigMoneyVolFlag)
BigMoneyVolType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.Text.ToString());
BuyBigthanHighValFlag = ck_BuyBigthanHighVal.Checked;
if (BuyBigthanHighValFlag)
if(BuyBigthanHighValFlag)
BuyBigthanHighValType = (MCandleTimeType)Enum.Parse(typeof(MCandleTimeType), cb_BigMoneyVolType.Text.ToString());
bt_BuyStart_Click(null, null);
@@ -390,7 +392,7 @@ namespace Million_Buyer
if (programMode == BuyerMode.BuyerRealtime)
InsertLog("실시간 검증 구동 중..");
else if (programMode == BuyerMode.Buyer)
InsertLog("Buyer 구동 중..");
InsertLog("Buyer 구동 중..");
var cnt = 0;
sw.Start();
@@ -414,7 +416,7 @@ namespace Million_Buyer
realTimeMsg = new RealtimeDataSettingManager(null, programMode, this.payment);
var startDateTime = DateTime.Now;
var endDateTime = startDateTime;
var endDateTime = startDateTime;
dataList = realTimeMsg.GetRealTimeCandleData(candleTypeList, startDateTime, endDateTime, 200);
@@ -444,12 +446,12 @@ namespace Million_Buyer
}
lb_BuyMarketCount.Text = buyList.Count.ToString();
}));
}));
#endregion
firstFlag = false;
sw.Stop();
InsertLog("Deafult Data Setting 완료..\\r\n" + "Default 계산 시간 : " + sw.Elapsed.ToString());
LogManager.WriteLog("Default 계산 시간 : " + sw.Elapsed.ToString());
@@ -480,31 +482,30 @@ namespace Million_Buyer
if (tickDataList == null) tickDataList = new List<Ticker>();
if (tickDataList.Select(t => t.TrendType).Where(t => t == "RISE").ToList().Count > tickDataList.Count * 0.7)
if (tickDataList.Select(t => t.TrendType).Where(t=>t == "RISE").ToList().Count > tickDataList.Count * 0.7)
{
topVolTempCnt = (int)(topVolTempCnt * 15 / 10);
}
if (tickDataList.Count > topVolTempCnt)
{
//var AccumulateTradeVolume = tickDataList.OrderByDescending(t => t.AccumulateTradeVolume).Select(t=>t.CoinFullName).ToList();
//var AccumulateTradePrice = tickDataList.OrderByDescending(t => t.AccumulateTradePrice).Select(t => t.CoinFullName).ToList();
var AccumulateTradeVolume = tickDataList.OrderByDescending(t => t.AccumulateTradeVolume).Select(t=>t.CoinFullName).ToList();
var AccumulateTradePrice = tickDataList.OrderByDescending(t => t.AccumulateTradePrice).Select(t => t.CoinFullName).ToList();
//AccumulateTradeVolume.RemoveRange(topVolTempCnt, AccumulateTradeVolume.Count - topVolTempCnt);
//AccumulateTradePrice.RemoveRange(topVolTempCnt, AccumulateTradePrice.Count - topVolTempCnt);
AccumulateTradeVolume.RemoveRange(topVolTempCnt, AccumulateTradeVolume.Count - topVolTempCnt);
AccumulateTradePrice.RemoveRange(topVolTempCnt, AccumulateTradePrice.Count - topVolTempCnt);
//foreach(var item in AccumulateTradePrice)
//{
// foreach(var item2 in AccumulateTradeVolume)
// {
// if (item == item2) filterNameList.Add(item);
// }
//}
foreach(var item in AccumulateTradePrice)
{
foreach(var item2 in AccumulateTradeVolume)
{
if (item == item2) filterNameList.Add(item);
}
}
//var AccumulateTradeVolume24 = tickDataList.OrderByDescending(t => t.AccumulateTradeVolume24).Select(t => t.CoinFullName).ToList();
var AccumulateTradePrice24 = tickDataList.OrderByDescending(t => t.AccumulateTradePrice24).Select(t => t.CoinFullName).ToList();
AccumulateTradePrice24.RemoveRange(topVolTempCnt, AccumulateTradePrice24.Count - topVolTempCnt);
filterNameList = AccumulateTradePrice24;
//var AccumulateTradePrice24 = tickDataList.OrderByDescending(t => t.AccumulateTradePrice24).Select(t => t.CoinFullName).ToList();
//for (var i = 0; i < 5; i++)
//{
// if (!filterNameList.Any(t => t == AccumulateTradePrice24[i]))
@@ -534,7 +535,7 @@ namespace Million_Buyer
// }
// }
//}
}
}
}
if (buyList.Count == 0) allSell = false;
@@ -574,7 +575,7 @@ namespace Million_Buyer
var recentlyData = DataManager.GetRecentlyData(dic, MCandleTimeType.M1, true);
var recentlyDate = recentlyData.DateTime;
if ((int)smallCandleType < 60) recentlyDate = recentlyDate.AddMinutes(-1 * (int)smallCandleType);
else
{
@@ -608,7 +609,6 @@ namespace Million_Buyer
if (!buyFlag) continue;
var flag = buyScript.DicExcuteScript(recentlyData.CalculateFlag);
if (flag)
{
if (overlapBuyManagementList[item])
@@ -630,7 +630,6 @@ namespace Million_Buyer
subIndicatorStateManagement[indi.IndexString][item] = false;
overlapBuyManagementList[item] = true;
continue;
}
}
@@ -676,9 +675,8 @@ namespace Million_Buyer
{
if (!filterNameList.Any(t => t == item))
{
//InsertLog("거래량이 안됨 : " + item + ", DateTime : " + recentlyData.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
InsertLog("거래량이 안됨 : " + item + ", DateTime : " + recentlyData.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
overlapBuyManagementList[item] = false;
continue;
}
}
@@ -687,12 +685,11 @@ namespace Million_Buyer
InsertLog("Insert Buy Logic");
if (programMode == BuyerMode.Buyer)
{
//LogManager.WriteLog("Buy CoinFullName : " + item + "\r\nCandleData : " + JsonConvert.SerializeObject(recentlyData), "BuySell");
//InsertLog("Buy Coin Name : " + item + ", DateTime : " + recentlyData.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
LogManager.WriteLog("Buy CoinFullName : " + item + "\r\nCandleData : " + JsonConvert.SerializeObject(recentlyData), "BuySell");
InsertLog("Buy Coin Name : " + item + ", DateTime : " + recentlyData.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
if (buyCycleCount >= cycleCount)
{
//InsertLog("Count Over");
InsertLog("Count Over");
continue;
}
@@ -720,7 +717,6 @@ namespace Million_Buyer
if (buyData.Uuid == "")
{
InsertLog("Return Data 가 에러라서 구매 불가. Log 확인 바람");
continue;
}
buyCycleCount++;
@@ -730,7 +726,7 @@ namespace Million_Buyer
string str = "Buy : " + item + ",\r\n Buy Candle Data : " + JsonConvert.SerializeObject(recentlyData) + "\r\n";
LogManager.WriteLog(str, item);
InsertLog("Buy Coin Name : " + item + ", DateTime : " + recentlyData.DateTime.ToString("yyyy-MM-dd HH:mm:ss"));
overlapBuyManagementList[item] = false;
InsertLog(buyData.ConGoodsData.CoinFullName + " Market Data 구입 DateTime : " + time.ToString("yyyy-MM-dd HH:mm:ss"));
@@ -755,12 +751,10 @@ namespace Million_Buyer
sw.Stop();
if (sw.Elapsed.TotalSeconds > 1)
InsertLog("Buy 계산 로직 : " + sw.Elapsed.ToString());
}
}
else
{
overlapBuyManagementList[item] = true;
}
}
@@ -828,7 +822,7 @@ namespace Million_Buyer
//{
// flag = true;
//}
}
}
}
if (flag)
@@ -865,9 +859,9 @@ namespace Million_Buyer
var sellOrder = OrderSell(buyItem.ConGoodsData.CoinFullName, buyItem.Uuid, sellVal);
result.SellCount = sellOrder.ExecutedVolume;
if (sellVal == 0)
{
sellVal = sellItem.EndValue;
if(sellVal == 0)
{
sellVal = sellItem.SellValue;
}
buyCycleCount--;

View File

@@ -312,8 +312,7 @@ namespace Million
//public static string BitThumJasonFilePath = $"{SaveProgramDirecotryPath}\\CoinGoods.txt";
#endregion
//프로그램 타입
public static BuyerMode programMode = BuyerMode.BuyerRealtime;
//TODO 추후 관리 방안 고려
#region # 데이터 베이스 정보 #
@@ -366,8 +365,7 @@ namespace Million
{
BuyerRealtime,
Buyer,
HunterRealtime,
None
HunterRealtime
}
#endregion

View File

@@ -409,18 +409,15 @@ namespace Million.Manager
originValueList.Add(parent.IndicatorDic[originKey].value);
compareValueList.Add(parent.IndicatorDic[compareKey].value);
if (!(CommonProperty.programMode == BuyerMode.Buyer || CommonProperty.programMode == BuyerMode.BuyerRealtime))
if (originSetup.CandlePriceType == CandlePriceType.종가)
{
if (originSetup.CandlePriceType == CandlePriceType.종가)
{
originValueList.Add(parent.IndicatorDic[originKey].highValue);
originValueList.Add(parent.IndicatorDic[originKey].lowValue);
}
if (compareSetup.CandlePriceType == CandlePriceType.종가)
{
compareValueList.Add(parent.IndicatorDic[compareKey].highValue);
compareValueList.Add(parent.IndicatorDic[compareKey].lowValue);
}
originValueList.Add(parent.IndicatorDic[originKey].highValue);
originValueList.Add(parent.IndicatorDic[originKey].lowValue);
}
if (compareSetup.CandlePriceType == CandlePriceType.종가)
{
compareValueList.Add(parent.IndicatorDic[compareKey].highValue);
compareValueList.Add(parent.IndicatorDic[compareKey].lowValue);
}
var cnt = originValueList.Count >= compareValueList.Count ? originValueList.Count : compareValueList.Count;
@@ -452,14 +449,11 @@ namespace Million.Manager
(cSetup.CompareType == CompareType.Origin_Down_Compare_Up && originVal < compareVal) ||
(cSetup.CompareType == CompareType.Origin_DownOrSame_Compare_Up && originVal <= compareVal))
{
if (!(CommonProperty.programMode == BuyerMode.Buyer || CommonProperty.programMode == BuyerMode.BuyerRealtime))
flag = false;
if (!CommonProperty.compareIndicatorState[setUp.IndexString][coinFullName])
{
flag = false;
if (!CommonProperty.compareIndicatorState[setUp.IndexString][coinFullName])
{
CommonProperty.compareIndicatorState[setUp.IndexString][coinFullName] = true;
break;
}
CommonProperty.compareIndicatorState[setUp.IndexString][coinFullName] = true;
break;
}
parent.CalculateFlag[cSetup.IndexString] = true;
@@ -479,14 +473,8 @@ namespace Million.Manager
}
if (!(CommonProperty.programMode == BuyerMode.Buyer || CommonProperty.programMode == BuyerMode.BuyerRealtime))
{
if (flag)
{
CommonProperty.compareIndicatorState[setUp.IndexString][coinFullName] = false;
}
}
if (flag)
CommonProperty.compareIndicatorState[setUp.IndexString][coinFullName] = false;
}
}
@@ -503,7 +491,7 @@ namespace Million.Manager
if (buyData != null)
{
var rate = ((PriceRateCondtionSetup)setUp).Rate;
var rateVal = buyData.BuyValue + (buyData.BuyValue * (rate / 100));
var rateVal = buyData.BuyValue + (buyData.BuyValue * rate / 100);
var key = GetKeyData(setUp);
foreach (var item in parentCandleDataList)
{
@@ -1394,10 +1382,10 @@ namespace Million.Manager
{
value = data.LowValue;
}
else
else if (setUp.CandlePriceType == CommonProperty.CandlePriceType.종가)
{
value = data.EndValue;
}
}
return value;
}