수정 (하루 내내 돌려보고 확인 예정) -> 이상하게 저장되는거 어떻게 처리할지 고민 중

This commit is contained in:
kyh
2022-10-25 16:18:50 +09:00
parent 100dad6469
commit c70caa902e
6 changed files with 109 additions and 100 deletions

View File

@@ -43,11 +43,7 @@
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.lb_StartDate = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.lb_TotalMoneyValue = new System.Windows.Forms.Label();
this.lb_TotalRate = new System.Windows.Forms.Label();
this.lb_BuyMarketCount = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.bt_Start = new System.Windows.Forms.Button();
this.bt_Stop = new System.Windows.Forms.Button();
@@ -225,15 +221,11 @@
//
this.groupBox2.Controls.Add(this.lb_StartDate);
this.groupBox2.Controls.Add(this.label10);
this.groupBox2.Controls.Add(this.lb_TotalMoneyValue);
this.groupBox2.Controls.Add(this.lb_TotalRate);
this.groupBox2.Controls.Add(this.lb_BuyMarketCount);
this.groupBox2.Controls.Add(this.label7);
this.groupBox2.Controls.Add(this.label5);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Location = new System.Drawing.Point(12, 312);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(362, 132);
this.groupBox2.Size = new System.Drawing.Size(362, 72);
this.groupBox2.TabIndex = 6;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "데이터 현황";
@@ -241,7 +233,7 @@
// lb_StartDate
//
this.lb_StartDate.AutoSize = true;
this.lb_StartDate.Location = new System.Drawing.Point(102, 105);
this.lb_StartDate.Location = new System.Drawing.Point(102, 49);
this.lb_StartDate.Name = "lb_StartDate";
this.lb_StartDate.Size = new System.Drawing.Size(0, 12);
this.lb_StartDate.TabIndex = 9;
@@ -249,28 +241,12 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(39, 105);
this.label10.Location = new System.Drawing.Point(39, 49);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(57, 12);
this.label10.TabIndex = 8;
this.label10.Text = "시작 시간";
//
// lb_TotalMoneyValue
//
this.lb_TotalMoneyValue.AutoSize = true;
this.lb_TotalMoneyValue.Location = new System.Drawing.Point(102, 80);
this.lb_TotalMoneyValue.Name = "lb_TotalMoneyValue";
this.lb_TotalMoneyValue.Size = new System.Drawing.Size(0, 12);
this.lb_TotalMoneyValue.TabIndex = 7;
//
// lb_TotalRate
//
this.lb_TotalRate.AutoSize = true;
this.lb_TotalRate.Location = new System.Drawing.Point(102, 53);
this.lb_TotalRate.Name = "lb_TotalRate";
this.lb_TotalRate.Size = new System.Drawing.Size(0, 12);
this.lb_TotalRate.TabIndex = 6;
//
// lb_BuyMarketCount
//
this.lb_BuyMarketCount.AutoSize = true;
@@ -279,24 +255,6 @@
this.lb_BuyMarketCount.Size = new System.Drawing.Size(0, 12);
this.lb_BuyMarketCount.TabIndex = 5;
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(27, 80);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(69, 12);
this.label7.TabIndex = 3;
this.label7.Text = "전체 수익금";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(27, 53);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(69, 12);
this.label5.TabIndex = 2;
this.label5.Text = "전체 수익율";
//
// label3
//
this.label3.AutoSize = true;
@@ -518,10 +476,10 @@
this.lb_log.FormattingEnabled = true;
this.lb_log.HorizontalScrollbar = true;
this.lb_log.ItemHeight = 12;
this.lb_log.Location = new System.Drawing.Point(12, 450);
this.lb_log.Location = new System.Drawing.Point(12, 390);
this.lb_log.Name = "lb_log";
this.lb_log.ScrollAlwaysVisible = true;
this.lb_log.Size = new System.Drawing.Size(362, 280);
this.lb_log.Size = new System.Drawing.Size(362, 340);
this.lb_log.TabIndex = 16;
//
// bt_alive
@@ -750,15 +708,11 @@
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button bt_Modify;
private System.Windows.Forms.Label lb_BuyMarketCount;
private System.Windows.Forms.Label lb_TotalMoney;
private System.Windows.Forms.Label lb_TotalMoneyValue;
private System.Windows.Forms.Label lb_TotalRate;
private System.Windows.Forms.Button bt_Start;
private System.Windows.Forms.Button bt_Stop;
private System.Windows.Forms.Label lb_IndiName;

View File

@@ -238,6 +238,12 @@ namespace Million_Buyer
item.CreateOrderTime.ToString("yyyy-MM-dd HH:mm:ss")
}, null);
}
var tempData = orderList.Select(t => t.Uuid).Distinct().ToList();
var count = tempData.Count + buyList.Count;
buyCycleCount = count;
lb_BuyMarketCount.Text = buyCycleCount.ToString();
}));
//1초에 한번씩 부르게 처리
@@ -342,6 +348,9 @@ namespace Million_Buyer
CommonProperty.subIndicatorStateManagement[item.IndexString] = dic;
}
// TODO 이미 구매되어 있는 종목에 대한 기본 데이터 Setting 필요
firstFlag = 1;
InsertLog("Deafult Data Setting 완료..");
sw.Stop();
@@ -484,7 +493,7 @@ namespace Million_Buyer
var time = DateTime.Now;
var sellItem = recentlyData;
var valDic = ResultLogicManager.GetIndicateValue(sellItem.CalculateFlag, totalIndicatorList, sellItem);
sellItem.SellValue = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(sellRex, valDic, sellItem.CalculateFlag), false);
sellItem.SellValue = OrderbookManager.GetAskPrice(CalculateManager.GetConditionValue(sellRex, valDic, sellItem.CalculateFlag));
sellItem.SellTime = time;
var buyCandleData = buyItem.CandleDataLists_Im[0];
@@ -539,7 +548,7 @@ namespace Million_Buyer
}
}
var moneyVal = (sellVal * (1 - 0.0005) - buyCandleData.BuyValue * (1 - 0.0005)) * result.SellCount;
var moneyVal = (sellVal * (1 - 0.0015) - buyCandleData.BuyValue * (1 - 0.0015)) * result.SellCount;
tl_Result.AppendNode(new object[] {
buyNode.GetValue("BuyMarket"),
@@ -556,22 +565,6 @@ namespace Million_Buyer
tl_BuyList.Nodes.Remove(buyNode);
lb_BuyMarketCount.Text = buyList.Count.ToString();
double totalRate = 0;
double totalMoneyValue = 0;
foreach (var resultData in resultDataList)
{
totalRate += resultData.FirstEarningRate;
if (!RealTimeMode)
{
// 총 돈량 측정
totalMoneyValue += (resultData.SellValue * (1 - 0.0005) - resultData.BuyValueList[0] * (1 - 0.0005)) * resultData.SellCount;
}
}
lb_TotalRate.Text = totalRate + "%";
if (!RealTimeMode)
lb_TotalMoneyValue.Text = totalMoneyValue + "원";
}));
if (sw.Elapsed.TotalSeconds > 1)
InsertLog("Sell 계산 로직 : " + sw.Elapsed.ToString());

View File

@@ -627,8 +627,7 @@ namespace Million.Manager
if (overlapData < subVal) continue;
}
//최초 시점이 아닐 경우
//최초 시점이 아닐 경우
if ((subManagement != null && subManagement[coinFullName]) || !firstFlag)
{
if (!parent.IndicatorDic.ContainsKey(key)) continue;
@@ -799,8 +798,6 @@ namespace Million.Manager
if (value == 0 || overlapData == 0) continue;
if (CompareSettingValueOfTranspierce(setUp.IndicatorOver, overlapData, value))
{
var childList = new List<CandleData>();
@@ -937,7 +934,7 @@ namespace Million.Manager
}
}
}
item.CalculateFlag[setUp.IndexString] = true;
item.CalculateFlag[setUp.IndexString] = true;
}
}
}
@@ -952,14 +949,14 @@ namespace Million.Manager
{
if (type == CommonProperty.Indicator_over.아래)
{
if (overlapData > value)
if (overlapData >= value)
{
return true;
}
}
else if (type == CommonProperty.Indicator_over.위)
{
if (overlapData < value)
if (overlapData <= value)
{
return true;
}
@@ -980,14 +977,14 @@ namespace Million.Manager
{
if (type == CommonProperty.Indicator_over.아래)
{
if (overlapData > value)
if (overlapData >= value)
{
return true;
}
}
else if (type == CommonProperty.Indicator_over.위)
{
if (overlapData < value)
if (overlapData <= value)
{
return true;
}

View File

@@ -31,7 +31,25 @@ namespace Million.Manager
var keyData = CalculateManager.GetKeyData(indicate);
if (item.IndicatorDic.ContainsKey(keyData))
valDic.Add(key.Key, item.IndicatorDic[keyData].overlapValue);
{
if(item.IndicatorDic[keyData].GetType() == typeof(IchimokData))
{
var indiData = ((IchimokData)item.IndicatorDic[keyData]);
var val = indiData.GetOverValue();
var indi = ((IchimokuConditionSetup)indicate);
if (indi.IndicatorIchmokuOverLine == Indicator_IchmokuOverLine.선행스팬1)
val = indiData.value;
else if (indi.IndicatorIchmokuOverLine == Indicator_IchmokuOverLine.선행스팬2)
val = indiData.value2;
valDic.Add(key.Key, val);
}
else
{
valDic.Add(key.Key, item.IndicatorDic[keyData].value);
}
}
else
valDic.Add(key.Key, 0);
}

View File

@@ -43,8 +43,9 @@ namespace Million.WebMangement.Upbit
else if (candleType == MCandleTimeType.W1) url = UpbitURL_WCandleStick;
else if (candleType == MCandleTimeType.MT1) url = UpbitURL_MTCandleStick;
var resResult = process.CallAPI(url, HttpMethod.Get,
new NameValueCollection { { "market", coinFullName }, { "to", (datetime == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(datetime) }, { "count", count.ToString() } });
var resResult = process.CallAPI(url, HttpMethod.Get,
new NameValueCollection { { "market", coinFullName }, { "to", (datetime == default(DateTime)) ?
process.DateTime2String(DateTime.Now) : process.DateTime2String(datetime) }, { "count", count.ToString() } });
List<CandleData> returnData;
@@ -54,11 +55,16 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Get,
new NameValueCollection { { "market", coinFullName }, { "to", (datetime == default(DateTime)) ?
process.DateTime2String(DateTime.Now) : process.DateTime2String(datetime) }, { "count", count.ToString() } });
Thread.Sleep(500);
}
}
return returnData;
}
/// <summary>
/// Get Market List Data
/// </summary>
@@ -76,9 +82,12 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Get);
Thread.Sleep(500);
}
}
return returnData;
return returnData;
}
/// <summary>
@@ -98,7 +107,11 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
process.CallAPI(url, HttpMethod.Get);
Thread.Sleep(500);
}
}
return returnData;
}
@@ -111,7 +124,7 @@ namespace Million.WebMangement.Upbit
public OrderableInformation GetOrderableInformation(string CoinFullName)
{
var url = UpbitURL_OrderChace;
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", CoinFullName } });
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", CoinFullName } });
OrderableInformation returnData;
@@ -121,7 +134,11 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", CoinFullName } });
Thread.Sleep(500);
}
}
return returnData;
}
@@ -134,7 +151,7 @@ namespace Million.WebMangement.Upbit
public Order GetOrderInformation(string uuid)
{
var url = UpbitURL_Order;
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection {{ "uuid", uuid } });
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "uuid", uuid } });
Order returnData;
@@ -144,7 +161,11 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "uuid", uuid } });
Thread.Sleep(500);
}
}
return returnData;
}
@@ -179,7 +200,10 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Get, data);
Thread.Sleep(500);
}
}
return returnData;
}
@@ -198,15 +222,15 @@ namespace Million.WebMangement.Upbit
string url = UpbitURL_Orders;
var namevalCollection = new NameValueCollection {
{ "market", coinFullName },
{ "side", side.ToString() },
{ "side", side.ToString() },
{ "ord_type", ord_type.ToString() }
};
if (volume != 0)
namevalCollection.Add("volume", volume.ToString());
if(price != 0)
if (price != 0)
namevalCollection.Add("price", price.ToString());
var resResult = process.CallAPI(url, HttpMethod.Post, namevalCollection);
var resResult = process.CallAPI(url, HttpMethod.Post, namevalCollection);
Order returnData;
@@ -216,7 +240,11 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
Thread.Sleep(300);
{
resResult = process.CallAPI(url, HttpMethod.Post, namevalCollection);
Thread.Sleep(500);
}
}
return returnData;
}
@@ -239,9 +267,13 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Delete, new NameValueCollection { { "uuid", uuid } });
Thread.Sleep(500);
}
}
return returnData;
return returnData;
}
/// <summary>
@@ -255,8 +287,8 @@ namespace Million.WebMangement.Upbit
{
string url = UpbitURL_Ticks;
var resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", coinFullName },
{ "to", (to == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(to) },
{ "count", count.ToString() }
{ "to", (to == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(to) },
{ "count", count.ToString() }
});
List<Conclusion> returnData;
@@ -267,7 +299,14 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "market", coinFullName },
{ "to", (to == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(to) },
{ "count", count.ToString() }
});
Thread.Sleep(500);
}
}
return returnData;
}
@@ -293,7 +332,11 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "markets", list } });
Thread.Sleep(500);
}
}
return returnData;
}
@@ -319,7 +362,11 @@ namespace Million.WebMangement.Upbit
if (returnData != null)
break;
else
{
resResult = process.CallAPI(url, HttpMethod.Get, new NameValueCollection { { "markets", list } });
Thread.Sleep(500);
}
}
return returnData;
}

View File

@@ -90,7 +90,7 @@ namespace Million.WebServices
}
catch (Exception e)
{
return new List<MarketData>();
return null;
}
}
@@ -136,7 +136,7 @@ namespace Million.WebServices
if (data.ContainsKey("trades"))
{
var tradeList = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(JsonConvert.SerializeObject(data["trades"]?.ToString()));
var tradeList = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(data["trades"]?.ToString());
//(List<Dictionary<string, object>>)data["trades"];
foreach (var item in tradeList)
@@ -163,7 +163,7 @@ namespace Million.WebServices
}
catch (Exception e)
{
return new Order();
return null;
}
}
@@ -206,7 +206,7 @@ namespace Million.WebServices
}
catch (Exception e)
{
return new List<Conclusion>();
return null;
}
}
@@ -262,7 +262,7 @@ namespace Million.WebServices
}
catch (Exception e)
{
return returnData;
return null;
}
@@ -331,7 +331,7 @@ namespace Million.WebServices
}
catch (Exception e)
{
return new List<Ticker>();
return null;
}
}
@@ -428,7 +428,7 @@ namespace Million.WebServices
}
catch (Exception e)
{
return new List<Order>();
return null;
}
}
@@ -509,7 +509,7 @@ namespace Million.WebServices
}
catch (Exception e)
{
return new OrderableInformation();
return null;
}
}