API 키 설정 추가

This commit is contained in:
DESKTOP-BQ5FCLL\lee
2024-10-21 15:24:05 +09:00
parent 509e8bf2a5
commit 2eb2bf1ef1
8 changed files with 167 additions and 5 deletions

View File

@@ -66,6 +66,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CommonProperty.cs" /> <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\CandleData.cs" />
<Compile Include="Data\CandleDataList.cs" /> <Compile Include="Data\CandleDataList.cs" />
<Compile Include="Data\MarketInfo.cs" /> <Compile Include="Data\MarketInfo.cs" />
@@ -75,6 +77,7 @@
<Compile Include="Data\TradeData.cs" /> <Compile Include="Data\TradeData.cs" />
<Compile Include="Data\WebSocketCandle.cs" /> <Compile Include="Data\WebSocketCandle.cs" />
<Compile Include="Data\IndicatorData.cs" /> <Compile Include="Data\IndicatorData.cs" />
<Compile Include="Data\GlobalOptions.cs" />
<Compile Include="IndicatorConditionSetup\IchimokuConditionSetup.cs" /> <Compile Include="IndicatorConditionSetup\IchimokuConditionSetup.cs" />
<Compile Include="IndicatorConditionSetup\MovingAverageConditionSetup.cs" /> <Compile Include="IndicatorConditionSetup\MovingAverageConditionSetup.cs" />
<Compile Include="IndicatorData\IchimokData.cs" /> <Compile Include="IndicatorData\IchimokData.cs" />
@@ -94,6 +97,7 @@
<EmbeddedResource Include="MainForm.resx"> <EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
<EmbeddedResource Include="Properties\Resources.resx"> <EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <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
{
[Newtonsoft.Json.JsonIgnore]
public string AccessKey { get; set; }
[Newtonsoft.Json.JsonIgnore]
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 40ad89ac5347b9c3164ddf8b8e1c464038705266b25049a4f21ca12f509603bd
이찬균
bg_db85fec3b0c623f6194a8357c6e385aa
f396690a85196faf71d531782a4ecd45a3c2507943ee9c679e4a59fb7ab86ea3

View File

@@ -0,0 +1,16 @@
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 APIKeyInfo_Bitget SelectAPI { get; set; } = APIKeyInfo_Bitget.김영호;
}
}

View File

@@ -23,12 +23,29 @@ namespace BitgetAPI.IndicatorConditionSetup
{ {
public class IndicatorProcess public class IndicatorProcess
{ {
GlobalOptions options = GlobalOptions.Instance;
CommonProperty commonProperty = CommonProperty.Instance; CommonProperty commonProperty = CommonProperty.Instance;
//영호 Key //영호 Key
private string YHKIM_AccessKey = "bg_f93aa530288b6ec9d62095994c51972a"; private string YHKIM_AccessKey { get
private string YHKIM_SecreteKey = "2fce18bcd12ca23a7920c48295a58da031443ea383af8114ed599c1b14ac678e"; {
private string YHKIM_PassphraseKey = "dudgh0505"; 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";
// 스레드 시작/종료 플래그 // 스레드 시작/종료 플래그
public bool Is_th_SignalInfo; public bool Is_th_SignalInfo;

View File

@@ -31,9 +31,11 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.groupControl_Setting = new DevExpress.XtraEditors.GroupControl(); this.groupControl_Setting = new DevExpress.XtraEditors.GroupControl();
this.progressBarControl_data = new DevExpress.XtraEditors.ProgressBarControl(); this.progressBarControl_data = new DevExpress.XtraEditors.ProgressBarControl();
this.cb_ApiKeys = new DevExpress.XtraEditors.ComboBoxEdit();
this.comboBoxEdit_ConinType = new DevExpress.XtraEditors.ComboBoxEdit(); this.comboBoxEdit_ConinType = new DevExpress.XtraEditors.ComboBoxEdit();
this.comboBoxEdit_ExchangePlace = new DevExpress.XtraEditors.ComboBoxEdit(); this.comboBoxEdit_ExchangePlace = new DevExpress.XtraEditors.ComboBoxEdit();
this.labelControl4 = new DevExpress.XtraEditors.LabelControl(); this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
this.labelControl9 = new DevExpress.XtraEditors.LabelControl();
this.labelControl2 = new DevExpress.XtraEditors.LabelControl(); this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.groupControl_MarketInfo = new DevExpress.XtraEditors.GroupControl(); this.groupControl_MarketInfo = new DevExpress.XtraEditors.GroupControl();
@@ -93,9 +95,11 @@
this.checkedComboBoxEdit_TimeInterval = new DevExpress.XtraEditors.CheckedComboBoxEdit(); this.checkedComboBoxEdit_TimeInterval = new DevExpress.XtraEditors.CheckedComboBoxEdit();
this.checkedComboBoxEdit_MarketInfoList = new DevExpress.XtraEditors.CheckedComboBoxEdit(); this.checkedComboBoxEdit_MarketInfoList = new DevExpress.XtraEditors.CheckedComboBoxEdit();
this.treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn(); this.treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.xtraTabPage_Result = new DevExpress.XtraTab.XtraTabPage();
((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).BeginInit();
this.groupControl_Setting.SuspendLayout(); this.groupControl_Setting.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.progressBarControl_data.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_ConinType.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).BeginInit();
@@ -151,9 +155,11 @@
this.groupControl_Setting.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupControl_Setting.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupControl_Setting.Controls.Add(this.progressBarControl_data); 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_ConinType);
this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ExchangePlace); this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ExchangePlace);
this.groupControl_Setting.Controls.Add(this.labelControl4); this.groupControl_Setting.Controls.Add(this.labelControl4);
this.groupControl_Setting.Controls.Add(this.labelControl9);
this.groupControl_Setting.Controls.Add(this.labelControl2); this.groupControl_Setting.Controls.Add(this.labelControl2);
this.groupControl_Setting.Controls.Add(this.labelControl1); this.groupControl_Setting.Controls.Add(this.labelControl1);
this.groupControl_Setting.Location = new System.Drawing.Point(3, 2); this.groupControl_Setting.Location = new System.Drawing.Point(3, 2);
@@ -171,6 +177,16 @@
this.progressBarControl_data.Size = new System.Drawing.Size(200, 18); this.progressBarControl_data.Size = new System.Drawing.Size(200, 18);
this.progressBarControl_data.TabIndex = 2; this.progressBarControl_data.TabIndex = 2;
// //
// cb_ApiKeys
//
this.cb_ApiKeys.Location = new System.Drawing.Point(442, 44);
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 // comboBoxEdit_ConinType
// //
this.comboBoxEdit_ConinType.Location = new System.Drawing.Point(248, 41); this.comboBoxEdit_ConinType.Location = new System.Drawing.Point(248, 41);
@@ -202,6 +218,14 @@
this.labelControl4.TabIndex = 0; this.labelControl4.TabIndex = 0;
this.labelControl4.Text = "검색기 데이터 구성"; this.labelControl4.Text = "검색기 데이터 구성";
// //
// labelControl9
//
this.labelControl9.Location = new System.Drawing.Point(380, 47);
this.labelControl9.Name = "labelControl9";
this.labelControl9.Size = new System.Drawing.Size(45, 14);
this.labelControl9.TabIndex = 0;
this.labelControl9.Text = "API KEY";
//
// labelControl2 // labelControl2
// //
this.labelControl2.Location = new System.Drawing.Point(186, 44); this.labelControl2.Location = new System.Drawing.Point(186, 44);
@@ -366,7 +390,8 @@
this.xtraTabControl_Main.TabIndex = 2; this.xtraTabControl_Main.TabIndex = 2;
this.xtraTabControl_Main.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { this.xtraTabControl_Main.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
this.xtraTabPage_Status, this.xtraTabPage_Status,
this.xtraTabPage_Searcher}); this.xtraTabPage_Searcher,
this.xtraTabPage_Result});
// //
// xtraTabPage_Status // xtraTabPage_Status
// //
@@ -842,6 +867,12 @@
this.treeListColumn1.Visible = true; this.treeListColumn1.Visible = true;
this.treeListColumn1.VisibleIndex = 0; this.treeListColumn1.VisibleIndex = 0;
// //
// xtraTabPage_Result
//
this.xtraTabPage_Result.Name = "xtraTabPage_Result";
this.xtraTabPage_Result.Size = new System.Drawing.Size(1010, 408);
this.xtraTabPage_Result.Text = "매수/매도";
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
@@ -857,6 +888,7 @@
this.groupControl_Setting.ResumeLayout(false); this.groupControl_Setting.ResumeLayout(false);
this.groupControl_Setting.PerformLayout(); this.groupControl_Setting.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.progressBarControl_data.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_ConinType.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).EndInit();
@@ -977,6 +1009,9 @@
private System.Windows.Forms.GroupBox groupBox2; private System.Windows.Forms.GroupBox groupBox2;
private DevExpress.XtraEditors.CheckEdit checkEdit_yhk_Long; private DevExpress.XtraEditors.CheckEdit checkEdit_yhk_Long;
private DevExpress.XtraEditors.CheckEdit checkEdit_yhk_Short; private DevExpress.XtraEditors.CheckEdit checkEdit_yhk_Short;
private DevExpress.XtraEditors.ComboBoxEdit cb_ApiKeys;
private DevExpress.XtraEditors.LabelControl labelControl9;
private DevExpress.XtraTab.XtraTabPage xtraTabPage_Result;
} }
} }

View File

@@ -1,4 +1,5 @@
using BitgetApi.Data; using BitgetApi.Data;
using BitgetApi.Data.API;
using BitgetAPI.Data; using BitgetAPI.Data;
using BitgetAPI.IndicatorConditionSetup; using BitgetAPI.IndicatorConditionSetup;
using BitgetAPI.WebService; using BitgetAPI.WebService;
@@ -100,7 +101,11 @@ namespace BitgetAPI
treeList_LongUp.DataSource = signals_LU; treeList_LongUp.DataSource = signals_LU;
treeList_ShortDown.DataSource = signals_SD; treeList_ShortDown.DataSource = signals_SD;
// API Key 가져오기 및 등록 foreach(var item in APIKeyInfo_Bitget.GetAPIKeys())
{
cb_ApiKeys.Properties.Items.Add(item.Name);
}
cb_ApiKeys.SelectedIndex = GlobalOptions.Instance.SelectAPI.Id;
} }
@@ -568,5 +573,20 @@ namespace BitgetAPI
th_treeListMarketInfoListUpdateTimer = new Thread(new ThreadStart(TreeListMarketInfoListUpdate)); th_treeListMarketInfoListUpdateTimer = new Thread(new ThreadStart(TreeListMarketInfoListUpdate));
th_treeListMarketInfoListUpdateTimer.Start(); 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("키 못찾음", "확인 필요");
}
} }
} }