This commit is contained in:
DESKTOP-BQ5FCLL\lee
2024-11-02 19:52:30 +09:00
5 changed files with 58 additions and 28 deletions

File diff suppressed because one or more lines are too long

View File

@@ -128,7 +128,6 @@
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -188,6 +188,10 @@ namespace BitgetAPI
M30 = 30,
[Description("1H")]
H1 = 60,
[Description("2H")]
H2 = 120,
[Description("3H")]
H3 = 180,
[Description("4H")]
H4 = 240,
[Description("6H")]

View File

@@ -4,8 +4,10 @@ using BitgetAPI.IndicatorConditionSetup;
using BitgetAPI.WebService;
using DevExpress.Internal.WinApi.Windows.UI.Notifications;
using DevExpress.Utils.IoC;
using DevExpress.Xpo.Logger;
using DevExpress.XtraPrinting.Native;
using Newtonsoft.Json;
using Serilog;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
@@ -117,6 +119,7 @@ namespace BitgetAPI.IndicatorConditionSetup
public void calProcess()
{
IchimokuConditionSetup ichimokuConditionSetup = new IchimokuConditionSetup();
MovingAverageConditionSetup movingAverageConditionSetup = new MovingAverageConditionSetup();
@@ -262,8 +265,6 @@ namespace BitgetAPI.IndicatorConditionSetup
if (checked구름떼상향돌파 && candleData_전봉.Open < candleData_전봉.IchimokData.상한선 && candleData.Open > candleData.IchimokData.상한선 && candleData.Low > candleData.IchimokData.상한선
&& candleData.Close > candleData.IchimokData.상한선)
{
var indicatorPrice = candleData.Open;
var indicatorRate = (candleData.Close / indicatorPrice) * 100 - 100;
@@ -302,7 +303,7 @@ namespace BitgetAPI.IndicatorConditionSetup
// 없으면 생성
if (signalData == null)
{
{
var price = candleData.Close;
var rate = (candleData.Close / candleData.Open) * 100 - 100;
@@ -372,15 +373,15 @@ namespace BitgetAPI.IndicatorConditionSetup
var Bol12 = candleData.movingAverageDataList[12].BolangerValue;
var Bol24 = candleData.movingAverageDataList[24].BolangerValue;
if ((int)interval != 5)
//5분봉이 default이지만 15분봉으로 변경
if ((int)interval != 15)
{
continue;
}
#region 15분봉 처리
//60분봉 관련 처리
var candleDatas15 = findedMarket.candleDataList[MCandleTimeType.M15];
//15분봉이지만 60분봉으로 변경
var candleDatas15 = findedMarket.candleDataList[MCandleTimeType.H1];
var candleDatas15_정렬 = candleDatas15.ToList().OrderBy(i => i.Argument).ToList();
var candleData15 = candleDatas15.Find(i => i.Argument == candleDatas15_정렬.Last().Argument);
@@ -434,8 +435,8 @@ namespace BitgetAPI.IndicatorConditionSetup
#endregion
#region 1분봉 처리
var candleDatas1 = findedMarket.candleDataList[MCandleTimeType.M1];
//1분봉이지만 3분봉으로 변경
var candleDatas1 = findedMarket.candleDataList[MCandleTimeType.M3];
var candleDatas1_정렬 = candleDatas1.ToList().OrderBy(i => i.Argument).ToList();
var candleData1 = candleDatas1.Find(i => i.Argument == candleDatas1_정렬.Last().Argument);
@@ -483,7 +484,8 @@ namespace BitgetAPI.IndicatorConditionSetup
#endregion
#region 60분봉 처리
var candleDatas60 = findedMarket.candleDataList[MCandleTimeType.H1];
//60분봉이지만 180분 처리
var candleDatas60 = findedMarket.candleDataList[MCandleTimeType.H2];
var candleDatas60_정렬 = candleDatas60.ToList().OrderBy(i => i.Argument).ToList();
var candleData60 = candleDatas60.Find(i => i.Argument == candleDatas60_정렬.Last().Argument);
@@ -816,14 +818,22 @@ namespace BitgetAPI.IndicatorConditionSetup
{
double.TryParse(orderDic["Size"].ToString(), out var size);
var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellLong, OrderType.market, YHKIM_Leverage, orderDic["orderId"].ToString());
var sellOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(sellOrder["data"]));
var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]);
var detailOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(detail["data"]));
double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue);
if (sellOrder != null)
{
var sellOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(sellOrder["data"]));
}
else
{
Log.Error("Sell 안됨 확인 필요");
}
double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue);
var resultRateData = ((sellPriceValue - buyPriceValue) / buyPriceValue) * 100;
//var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]);
//var detailOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(detail["data"]));
//double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue);
var resultRateData = ((price - buyPriceValue) / buyPriceValue) * 100;
var orderResult = new Dictionary<string, object>()
{
@@ -834,7 +844,7 @@ namespace BitgetAPI.IndicatorConditionSetup
{ "MCandleTimeType", (int)interval },
{ "BuyCandle", buyItem["Candle"] },
{ "SellDate", nowTime},
{ "SellPrice", detailOrderDic["price"] },
{ "SellPrice", price},
{ "SellCandle", candleData },
{ "Rate", resultRateData }
};
@@ -1048,7 +1058,7 @@ namespace BitgetAPI.IndicatorConditionSetup
전저점Data["flag"] = false;
전저점Data["clearFlag"] = false;
if(ShortCount < 3)
if(ShortCount < 2)
{
double size = YHKIM_OrderAmount / price;
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyShort, OrderType.limit, YHKIM_Leverage);
@@ -1119,14 +1129,24 @@ namespace BitgetAPI.IndicatorConditionSetup
{
double.TryParse(orderDic["Size"].ToString(), out var size);
var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellShort, OrderType.market, YHKIM_Leverage, orderDic["orderId"].ToString());
var sellOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(sellOrder["data"]));
var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]);
var detailOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(detail["data"]));
if (sellOrder != null)
{
var sellOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(sellOrder["data"]));
}
else
{
Log.Error("Sell 안됨 확인 필요");
}
double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue);
double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue);
var resultRateData = ((sellPriceValue - buyPriceValue) / buyPriceValue) * 100;
//var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]);
//var detailOrderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(detail["data"]));
//double.TryParse(detailOrderDic["price"].ToString(), out var sellPriceValue);
var resultRateData = ((price - buyPriceValue) / buyPriceValue) * 100;
var orderResult = new Dictionary<string, object>()
{
@@ -1137,7 +1157,7 @@ namespace BitgetAPI.IndicatorConditionSetup
{ "MCandleTimeType", (int)interval },
{ "BuyCandle", buyItem["Candle"] },
{ "SellDate", nowTime},
{ "SellPrice", detailOrderDic["price"] },
{ "SellPrice", price },
{ "SellCandle", candleData },
{ "Rate", resultRateData }
};
@@ -1330,7 +1350,7 @@ namespace BitgetAPI.IndicatorConditionSetup
var result = CancelFutureOrder(symbol, id);
if (result == null || result["msg"]?.ToString() != "success")
{
Console.WriteLine("Sell에서 Cancel관련 Error");
Log.Error("Sell에서 Cancel관련 Error");
}
}

View File

@@ -24,6 +24,7 @@ using DevExpress.XtraEditors.Filtering;
using DevExpress.XtraExport.Xls;
using DevExpress.Utils.Filtering.Internal;
using System.Collections.Specialized;
using Serilog;
namespace BitgetAPI.WebService
{
@@ -207,6 +208,12 @@ namespace BitgetAPI.WebService
case CommonProperty.MCandleTimeType.H1:
timespan_add = new System.TimeSpan(1, 0, 0);
break;
case CommonProperty.MCandleTimeType.H2:
timespan_add = new System.TimeSpan(2, 0, 0);
break;
case CommonProperty.MCandleTimeType.H3:
timespan_add = new System.TimeSpan(3, 0, 0);
break;
case CommonProperty.MCandleTimeType.H4:
timespan_add = new System.TimeSpan(4, 0, 0);
break;
@@ -304,7 +311,7 @@ namespace BitgetAPI.WebService
using (var reader = new StreamReader(Response.GetResponseStream()))
{
var sRespBodyData = reader.ReadToEnd();
Console.WriteLine(sRespBodyData);
Log.Error(webEx, sRespBodyData);
//return (JObject.Parse(sRespBodyData));
}
}