This commit is contained in:
kyh
2024-10-31 10:28:47 +09:00
103 changed files with 492 additions and 91050 deletions

View File

@@ -1,6 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Serilog" publicKeyToken="24c2f752a8e58a10" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -48,10 +48,41 @@
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="Serilog, Version=4.1.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.4.1.0\lib\net471\Serilog.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.File, Version=6.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.Sinks.File.6.0.0\lib\net471\Serilog.Sinks.File.dll</HintPath>
</Reference>
<Reference Include="Serilog.Sinks.Map, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.Sinks.Map.2.0.0\lib\net471\Serilog.Sinks.Map.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Threading.Channels, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Channels.8.0.0\lib\net462\System.Threading.Channels.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -66,6 +97,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CommonProperty.cs" />
<Compile Include="Data\API\APIKeyInfo.cs" />
<Compile Include="Data\API\APIKeyInfo_Bitget.cs" />
<Compile Include="Data\CandleData.cs" />
<Compile Include="Data\CandleDataList.cs" />
<Compile Include="Data\MarketInfo.cs" />
@@ -75,6 +108,7 @@
<Compile Include="Data\TradeData.cs" />
<Compile Include="Data\WebSocketCandle.cs" />
<Compile Include="Data\IndicatorData.cs" />
<Compile Include="Data\GlobalOptions.cs" />
<Compile Include="IndicatorConditionSetup\IchimokuConditionSetup.cs" />
<Compile Include="IndicatorConditionSetup\MovingAverageConditionSetup.cs" />
<Compile Include="IndicatorData\IchimokData.cs" />
@@ -94,6 +128,7 @@
<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

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetApi.Data.API
{
public class APIKeyInfo
{
public string AccessKey { get; set; }
public string SecretKey { get; set; }
public string Name { get; set; }
public int Id { get; set; }
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetApi.Data.API
{
public class APIKeyInfo_Bitget : APIKeyInfo
{
public string PassphraseKey { get; set; } = string.Empty;
public static List<APIKeyInfo_Bitget> GetAPIKeys()
{
var result = new List<APIKeyInfo_Bitget>();
result.Add(APIKeyInfo_Bitget.김영호);
result.Add(APIKeyInfo_Bitget.이장화);
result.Add(APIKeyInfo_Bitget.이찬균);
return result;
}
public static APIKeyInfo_Bitget 김영호 = new APIKeyInfo_Bitget()
{
Id = 0,
Name = "김영호",
AccessKey = "bg_fbf275132203dcdbdca0db1e4b2351bb",
SecretKey = "40ad89ac5347b9c3164ddf8b8e1c464038705266b25049a4f21ca12f509603bd",
PassphraseKey = "dudgh0505"
};
public static APIKeyInfo_Bitget 이장화 = new APIKeyInfo_Bitget()
{
Id = 1,
Name = "이장화",
AccessKey = "",
SecretKey = "",
PassphraseKey = ""
};
public static APIKeyInfo_Bitget 이찬균 = new APIKeyInfo_Bitget()
{
Id = 2,
Name = "이찬균",
AccessKey = "bg_db85fec3b0c623f6194a8357c6e385aa",
SecretKey = "f396690a85196faf71d531782a4ecd45a3c2507943ee9c679e4a59fb7ab86ea3",
PassphraseKey = "dlatlzxc12"
};
}
}

View File

@@ -5,3 +5,7 @@ SecretKey
40ad89ac5347b9c3164ddf8b8e1c464038705266b25049a4f21ca12f509603bd
이찬균
bg_db85fec3b0c623f6194a8357c6e385aa
f396690a85196faf71d531782a4ecd45a3c2507943ee9c679e4a59fb7ab86ea3

View File

@@ -0,0 +1,21 @@
using BitgetApi.Data.API;
using BitgetAPI.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetApi.Data
{
public class GlobalOptions : BaseSettings<GlobalOptions>
{
public string logDir { get; set; } = @".\log\";
public bool LogDebugWrite { get; set; } = true;
public APIKeyInfo_Bitget SelectAPI { get; set; } = null;
public double Leverage { get; set; } = 10;
public double OrderAmount { get; set; } = 50;
}
}

View File

@@ -23,12 +23,46 @@ namespace BitgetAPI.IndicatorConditionSetup
{
public class IndicatorProcess
{
GlobalOptions options = GlobalOptions.Instance;
CommonProperty commonProperty = CommonProperty.Instance;
//영호 Key
private string YHKIM_AccessKey = "bg_f93aa530288b6ec9d62095994c51972a";
private string YHKIM_SecreteKey = "2fce18bcd12ca23a7920c48295a58da031443ea383af8114ed599c1b14ac678e";
private string YHKIM_PassphraseKey = "dudgh0505";
private string YHKIM_AccessKey { get
{
return options.SelectAPI.AccessKey;
}
}
// = "bg_f93aa530288b6ec9d62095994c51972a";
private string YHKIM_SecreteKey
{
get {
return options.SelectAPI.SecretKey;
}
}// = "2fce18bcd12ca23a7920c48295a58da031443ea383af8114ed599c1b14ac678e";
private string YHKIM_PassphraseKey
{
get
{
return options.SelectAPI.PassphraseKey;
}
}// = "dudgh0505";
private double YHKIM_Leverage
{
get
{
return options.Leverage;
}
}
private double YHKIM_OrderAmount
{
get
{
return options.OrderAmount;
}
}
// 스레드 시작/종료 플래그
public bool Is_th_SignalInfo;
@@ -711,10 +745,10 @@ namespace BitgetAPI.IndicatorConditionSetup
전고점Data["clearFlag"] = false;
if (LongCount < 2)
{
double size = ((double)((double)90) / price);
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyLong, OrderType.limit, 10);
if (LongCount < 3)
{
double size = YHKIM_OrderAmount / price;
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyLong, OrderType.limit, YHKIM_Leverage);
var orderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(orderData["data"]));
var orderDataDic = new Dictionary<string, object>
@@ -781,15 +815,14 @@ namespace BitgetAPI.IndicatorConditionSetup
if (orderDic != null)
{
double.TryParse(orderDic["Size"].ToString(), out var size);
double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue);
var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellLong, OrderType.market, 10, orderDic["orderId"].ToString());
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"]));
double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue);
//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>()
@@ -1017,8 +1050,8 @@ namespace BitgetAPI.IndicatorConditionSetup
if(ShortCount < 2)
{
double size = ((double)((double)90) / price);
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyShort, OrderType.limit, 10);
double size = YHKIM_OrderAmount / price;
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyShort, OrderType.limit, YHKIM_Leverage);
var orderDic = JsonConvert.DeserializeObject<Dictionary<string, string>>(JsonConvert.SerializeObject(orderData["data"]));
var orderDataDic = new Dictionary<string, object>
@@ -1085,15 +1118,14 @@ namespace BitgetAPI.IndicatorConditionSetup
if (orderDic != null)
{
double.TryParse(orderDic["Size"].ToString(), out var size);
double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue);
var sellOrder = FutureOrder(market, FutureMarginMode.isolated, size, 0, FutureSide.SellShort, OrderType.market, 10, orderDic["orderId"].ToString());
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"]));
double.TryParse(orderDic["Price"].ToString(), out var buyPriceValue);
//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>()

View File

@@ -30,10 +30,16 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.groupControl_Setting = new DevExpress.XtraEditors.GroupControl();
this.tb_OrderAmount = new DevExpress.XtraEditors.TextEdit();
this.tb_Leverage = new DevExpress.XtraEditors.TextEdit();
this.progressBarControl_data = new DevExpress.XtraEditors.ProgressBarControl();
this.cb_ApiKeys = new DevExpress.XtraEditors.ComboBoxEdit();
this.comboBoxEdit_ConinType = new DevExpress.XtraEditors.ComboBoxEdit();
this.comboBoxEdit_ExchangePlace = new DevExpress.XtraEditors.ComboBoxEdit();
this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
this.labelControl11 = new DevExpress.XtraEditors.LabelControl();
this.labelControl10 = new DevExpress.XtraEditors.LabelControl();
this.labelControl9 = new DevExpress.XtraEditors.LabelControl();
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.groupControl_MarketInfo = new DevExpress.XtraEditors.GroupControl();
@@ -92,10 +98,20 @@
this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
this.checkedComboBoxEdit_TimeInterval = new DevExpress.XtraEditors.CheckedComboBoxEdit();
this.checkedComboBoxEdit_MarketInfoList = new DevExpress.XtraEditors.CheckedComboBoxEdit();
this.xtraTabPage_Result = new DevExpress.XtraTab.XtraTabPage();
this.treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.btn_OptionSave = new DevExpress.XtraEditors.SimpleButton();
this.groupControl1 = new DevExpress.XtraEditors.GroupControl();
this.splitContainerControl1 = new DevExpress.XtraEditors.SplitContainerControl();
this.groupControl2 = new DevExpress.XtraEditors.GroupControl();
this.gridControl1 = new DevExpress.XtraGrid.GridControl();
this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).BeginInit();
this.groupControl_Setting.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tb_OrderAmount.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.tb_Leverage.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.progressBarControl_data.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cb_ApiKeys.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ConinType.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).BeginInit();
@@ -144,24 +160,65 @@
((System.ComponentModel.ISupportInitialize)(this.timeSpanEdit_SesstionTime.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_TimeInterval.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).BeginInit();
this.xtraTabPage_Result.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
this.groupControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1.Panel1)).BeginInit();
this.splitContainerControl1.Panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1.Panel2)).BeginInit();
this.splitContainerControl1.Panel2.SuspendLayout();
this.splitContainerControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.groupControl2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
this.SuspendLayout();
//
// groupControl_Setting
//
this.groupControl_Setting.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupControl_Setting.Controls.Add(this.btn_OptionSave);
this.groupControl_Setting.Controls.Add(this.tb_OrderAmount);
this.groupControl_Setting.Controls.Add(this.tb_Leverage);
this.groupControl_Setting.Controls.Add(this.progressBarControl_data);
this.groupControl_Setting.Controls.Add(this.cb_ApiKeys);
this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ConinType);
this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ExchangePlace);
this.groupControl_Setting.Controls.Add(this.labelControl4);
this.groupControl_Setting.Controls.Add(this.labelControl11);
this.groupControl_Setting.Controls.Add(this.labelControl10);
this.groupControl_Setting.Controls.Add(this.labelControl9);
this.groupControl_Setting.Controls.Add(this.labelControl2);
this.groupControl_Setting.Controls.Add(this.labelControl1);
this.groupControl_Setting.Location = new System.Drawing.Point(3, 2);
this.groupControl_Setting.Name = "groupControl_Setting";
this.groupControl_Setting.Size = new System.Drawing.Size(1012, 75);
this.groupControl_Setting.Size = new System.Drawing.Size(1012, 175);
this.groupControl_Setting.TabIndex = 0;
this.groupControl_Setting.Text = "초기 설정";
//
// tb_OrderAmount
//
this.tb_OrderAmount.EditValue = "50";
this.tb_OrderAmount.Location = new System.Drawing.Point(248, 83);
this.tb_OrderAmount.Name = "tb_OrderAmount";
this.tb_OrderAmount.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager));
this.tb_OrderAmount.Properties.MaskSettings.Set("MaskManagerSignature", "allowNull=False");
this.tb_OrderAmount.Size = new System.Drawing.Size(100, 20);
this.tb_OrderAmount.TabIndex = 3;
this.tb_OrderAmount.EditValueChanged += new System.EventHandler(this.tb_OrderAmount_EditValueChanged);
//
// tb_Leverage
//
this.tb_Leverage.EditValue = "10";
this.tb_Leverage.Location = new System.Drawing.Point(66, 84);
this.tb_Leverage.Name = "tb_Leverage";
this.tb_Leverage.Properties.MaskSettings.Set("MaskManagerType", typeof(DevExpress.Data.Mask.NumericMaskManager));
this.tb_Leverage.Properties.MaskSettings.Set("MaskManagerSignature", "allowNull=False");
this.tb_Leverage.Size = new System.Drawing.Size(100, 20);
this.tb_Leverage.TabIndex = 3;
this.tb_Leverage.EditValueChanged += new System.EventHandler(this.tb_Leverage_EditValueChanged);
//
// progressBarControl_data
//
this.progressBarControl_data.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -171,6 +228,16 @@
this.progressBarControl_data.Size = new System.Drawing.Size(200, 18);
this.progressBarControl_data.TabIndex = 2;
//
// cb_ApiKeys
//
this.cb_ApiKeys.Location = new System.Drawing.Point(446, 40);
this.cb_ApiKeys.Name = "cb_ApiKeys";
this.cb_ApiKeys.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.cb_ApiKeys.Size = new System.Drawing.Size(100, 20);
this.cb_ApiKeys.TabIndex = 1;
this.cb_ApiKeys.SelectedIndexChanged += new System.EventHandler(this.cb_ApiKeys_SelectedIndexChanged);
//
// comboBoxEdit_ConinType
//
this.comboBoxEdit_ConinType.Location = new System.Drawing.Point(248, 41);
@@ -202,6 +269,30 @@
this.labelControl4.TabIndex = 0;
this.labelControl4.Text = "검색기 데이터 구성";
//
// labelControl11
//
this.labelControl11.Location = new System.Drawing.Point(186, 86);
this.labelControl11.Name = "labelControl11";
this.labelControl11.Size = new System.Drawing.Size(28, 14);
this.labelControl11.TabIndex = 0;
this.labelControl11.Text = "단가 :";
//
// labelControl10
//
this.labelControl10.Location = new System.Drawing.Point(15, 86);
this.labelControl10.Name = "labelControl10";
this.labelControl10.Size = new System.Drawing.Size(48, 14);
this.labelControl10.TabIndex = 0;
this.labelControl10.Text = "레버리지 :";
//
// labelControl9
//
this.labelControl9.Location = new System.Drawing.Point(384, 43);
this.labelControl9.Name = "labelControl9";
this.labelControl9.Size = new System.Drawing.Size(45, 14);
this.labelControl9.TabIndex = 0;
this.labelControl9.Text = "API KEY";
//
// labelControl2
//
this.labelControl2.Location = new System.Drawing.Point(186, 44);
@@ -359,14 +450,15 @@
this.xtraTabControl_Main.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.xtraTabControl_Main.Location = new System.Drawing.Point(3, 83);
this.xtraTabControl_Main.Location = new System.Drawing.Point(3, 183);
this.xtraTabControl_Main.Name = "xtraTabControl_Main";
this.xtraTabControl_Main.SelectedTabPage = this.xtraTabPage_Status;
this.xtraTabControl_Main.Size = new System.Drawing.Size(1012, 434);
this.xtraTabControl_Main.TabIndex = 2;
this.xtraTabControl_Main.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
this.xtraTabPage_Status,
this.xtraTabPage_Searcher});
this.xtraTabPage_Searcher,
this.xtraTabPage_Result});
//
// xtraTabPage_Status
//
@@ -835,6 +927,13 @@
this.checkedComboBoxEdit_MarketInfoList.Size = new System.Drawing.Size(463, 20);
this.checkedComboBoxEdit_MarketInfoList.TabIndex = 0;
//
// xtraTabPage_Result
//
this.xtraTabPage_Result.Controls.Add(this.splitContainerControl1);
this.xtraTabPage_Result.Name = "xtraTabPage_Result";
this.xtraTabPage_Result.Size = new System.Drawing.Size(1010, 408);
this.xtraTabPage_Result.Text = "매수/매도";
//
// treeListColumn1
//
this.treeListColumn1.Caption = "treeListColumn1";
@@ -842,11 +941,74 @@
this.treeListColumn1.Visible = true;
this.treeListColumn1.VisibleIndex = 0;
//
// btn_OptionSave
//
this.btn_OptionSave.Location = new System.Drawing.Point(932, 83);
this.btn_OptionSave.Name = "btn_OptionSave";
this.btn_OptionSave.Size = new System.Drawing.Size(75, 23);
this.btn_OptionSave.TabIndex = 4;
this.btn_OptionSave.Text = "설정 저장";
this.btn_OptionSave.Click += new System.EventHandler(this.btn_OptionSave_Click);
//
// groupControl1
//
this.groupControl1.Controls.Add(this.gridControl1);
this.groupControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupControl1.Location = new System.Drawing.Point(0, 0);
this.groupControl1.Name = "groupControl1";
this.groupControl1.Size = new System.Drawing.Size(507, 408);
this.groupControl1.TabIndex = 0;
this.groupControl1.Text = "매수";
//
// splitContainerControl1
//
this.splitContainerControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainerControl1.Location = new System.Drawing.Point(0, 0);
this.splitContainerControl1.Name = "splitContainerControl1";
//
// splitContainerControl1.Panel1
//
this.splitContainerControl1.Panel1.Controls.Add(this.groupControl1);
this.splitContainerControl1.Panel1.Text = "Panel1";
//
// splitContainerControl1.Panel2
//
this.splitContainerControl1.Panel2.Controls.Add(this.groupControl2);
this.splitContainerControl1.Panel2.Text = "Panel2";
this.splitContainerControl1.Size = new System.Drawing.Size(1010, 408);
this.splitContainerControl1.SplitterPosition = 507;
this.splitContainerControl1.TabIndex = 1;
//
// groupControl2
//
this.groupControl2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupControl2.Location = new System.Drawing.Point(0, 0);
this.groupControl2.Name = "groupControl2";
this.groupControl2.Size = new System.Drawing.Size(493, 408);
this.groupControl2.TabIndex = 0;
this.groupControl2.Text = "매도";
//
// gridControl1
//
this.gridControl1.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridControl1.Location = new System.Drawing.Point(2, 23);
this.gridControl1.MainView = this.gridView1;
this.gridControl1.Name = "gridControl1";
this.gridControl1.Size = new System.Drawing.Size(503, 383);
this.gridControl1.TabIndex = 0;
this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
this.gridView1});
//
// gridView1
//
this.gridView1.GridControl = this.gridControl1;
this.gridView1.Name = "gridView1";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1016, 522);
this.ClientSize = new System.Drawing.Size(1016, 622);
this.Controls.Add(this.xtraTabControl_Main);
this.Controls.Add(this.groupControl_Setting);
this.MinimumSize = new System.Drawing.Size(719, 303);
@@ -856,7 +1018,10 @@
((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).EndInit();
this.groupControl_Setting.ResumeLayout(false);
this.groupControl_Setting.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.tb_OrderAmount.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.tb_Leverage.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.progressBarControl_data.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cb_ApiKeys.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ConinType.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).EndInit();
@@ -907,6 +1072,18 @@
((System.ComponentModel.ISupportInitialize)(this.timeSpanEdit_SesstionTime.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_TimeInterval.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).EndInit();
this.xtraTabPage_Result.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.groupControl1)).EndInit();
this.groupControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1.Panel1)).EndInit();
this.splitContainerControl1.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1.Panel2)).EndInit();
this.splitContainerControl1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainerControl1)).EndInit();
this.splitContainerControl1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.groupControl2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
this.ResumeLayout(false);
}
@@ -977,6 +1154,19 @@
private System.Windows.Forms.GroupBox groupBox2;
private DevExpress.XtraEditors.CheckEdit checkEdit_yhk_Long;
private DevExpress.XtraEditors.CheckEdit checkEdit_yhk_Short;
private DevExpress.XtraEditors.ComboBoxEdit cb_ApiKeys;
private DevExpress.XtraEditors.LabelControl labelControl9;
private DevExpress.XtraTab.XtraTabPage xtraTabPage_Result;
private DevExpress.XtraEditors.TextEdit tb_OrderAmount;
private DevExpress.XtraEditors.TextEdit tb_Leverage;
private DevExpress.XtraEditors.LabelControl labelControl11;
private DevExpress.XtraEditors.LabelControl labelControl10;
private DevExpress.XtraEditors.SimpleButton btn_OptionSave;
private DevExpress.XtraEditors.SplitContainerControl splitContainerControl1;
private DevExpress.XtraEditors.GroupControl groupControl1;
private DevExpress.XtraEditors.GroupControl groupControl2;
private DevExpress.XtraGrid.GridControl gridControl1;
private DevExpress.XtraGrid.Views.Grid.GridView gridView1;
}
}

View File

@@ -1,4 +1,5 @@
using BitgetApi.Data;
using BitgetApi.Data.API;
using BitgetAPI.Data;
using BitgetAPI.IndicatorConditionSetup;
using BitgetAPI.WebService;
@@ -30,6 +31,7 @@ namespace BitgetAPI
public partial class MainForm : Form
{
CommonProperty commonProperty = CommonProperty.Instance;
GlobalOptions globalOptions = GlobalOptions.Instance;
#region 폼 내 사용되는 스레드
// 트리 현황판 업데이트 스레드 (단순 폼 업데이트)
@@ -100,7 +102,19 @@ namespace BitgetAPI
treeList_LongUp.DataSource = signals_LU;
treeList_ShortDown.DataSource = signals_SD;
// API Key 가져오기 및 등록
foreach(var item in APIKeyInfo_Bitget.GetAPIKeys())
{
cb_ApiKeys.Properties.Items.Add(item.Name);
}
if (globalOptions.SelectAPI == null)
globalOptions.SelectAPI = APIKeyInfo_Bitget.김영호;
cb_ApiKeys.SelectedIndex = globalOptions.SelectAPI.Id;
tb_OrderAmount.Text = globalOptions.OrderAmount.ToString();
tb_Leverage.Text = globalOptions.Leverage.ToString();
}
@@ -568,5 +582,52 @@ namespace BitgetAPI
th_treeListMarketInfoListUpdateTimer = new Thread(new ThreadStart(TreeListMarketInfoListUpdate));
th_treeListMarketInfoListUpdateTimer.Start();
}
private void cb_ApiKeys_SelectedIndexChanged(object sender, EventArgs e)
{
var index = cb_ApiKeys.SelectedIndex;
var api =APIKeyInfo_Bitget.GetAPIKeys().Find(x=>x.Id == index);
if(api != null)
{
GlobalOptions.Instance.SelectAPI = api;
return;
}
MessageBox.Show("키 못찾음", "확인 필요");
}
private void tb_OrderAmount_EditValueChanged(object sender, EventArgs e)
{
try
{
var result = double.Parse(tb_OrderAmount.Text);
globalOptions.OrderAmount = result;
}
catch
{
}
}
private void tb_Leverage_EditValueChanged(object sender, EventArgs e)
{
try
{
var result = double.Parse(tb_Leverage.Text);
globalOptions.Leverage = result;
}
catch
{
}
}
private void btn_OptionSave_Click(object sender, EventArgs e)
{
GlobalOptions.Instance.SaveConfig();
}
}
}

View File

@@ -1,19 +1,53 @@
using System;
using BitgetApi.Data;
using DevExpress.Data.Localization;
using Serilog.Events;
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace BitgetAPI
{
internal static class Program
{
static GlobalOptions globalOptions = GlobalOptions.Instance;
/// <summary>
/// 해당 애플리케이션의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
var outputTemp = "{Timestamp:u} {Level:u4} {Message:lj}{NewLine}{Exception}";
//globalOptions.logDir
var temp = new LoggerConfiguration()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning);
temp = globalOptions.LogDebugWrite ? temp.MinimumLevel.Debug() : temp.MinimumLevel.Information();
Log.Logger = temp
.WriteTo.Map(
e => DateTime.Now.ToString("yyyy-MM-dd"),
(v, wt) => wt
.File(Path.Combine(globalOptions.logDir, $"BitgetApi_{v}.log"),
outputTemplate: outputTemp)
)
.CreateLogger();
Log.Information("테스트");
try
{
throw new Exception("에러테스트 확인용");
}
catch (Exception ex)
{
Log.Error(ex,"에러 테스트");
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());

View File

@@ -2,5 +2,15 @@
<packages>
<package id="Microsoft.CSharp" version="4.7.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="Serilog" version="4.1.0" targetFramework="net472" />
<package id="Serilog.Sinks.File" version="6.0.0" targetFramework="net472" />
<package id="Serilog.Sinks.Map" version="2.0.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Data.DataSetExtensions" version="4.5.0" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Threading.Channels" version="8.0.0" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
</packages>