diff --git a/BitgetApi/BitgetApi.csproj b/BitgetApi/BitgetApi.csproj index 3f69e2e..e2e30e1 100644 --- a/BitgetApi/BitgetApi.csproj +++ b/BitgetApi/BitgetApi.csproj @@ -66,6 +66,8 @@ + + @@ -75,6 +77,7 @@ + @@ -94,6 +97,7 @@ MainForm.cs + ResXFileCodeGenerator Resources.Designer.cs diff --git a/BitgetApi/Data/API/APIKeyInfo.cs b/BitgetApi/Data/API/APIKeyInfo.cs new file mode 100644 index 0000000..2cb98c6 --- /dev/null +++ b/BitgetApi/Data/API/APIKeyInfo.cs @@ -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; } + + } +} diff --git a/BitgetApi/Data/API/APIKeyInfo_Bitget.cs b/BitgetApi/Data/API/APIKeyInfo_Bitget.cs new file mode 100644 index 0000000..2776f18 --- /dev/null +++ b/BitgetApi/Data/API/APIKeyInfo_Bitget.cs @@ -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 GetAPIKeys() + { + var result = new List(); + 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" + }; + } +} diff --git a/BitgetApi/Data/API/BitGet Access APIKey.txt b/BitgetApi/Data/API/BitGet Access APIKey.txt index e84f0cf..58edfbc 100644 --- a/BitgetApi/Data/API/BitGet Access APIKey.txt +++ b/BitgetApi/Data/API/BitGet Access APIKey.txt @@ -5,3 +5,7 @@ SecretKey 40ad89ac5347b9c3164ddf8b8e1c464038705266b25049a4f21ca12f509603bd + +ÀÌÂù±Õ +bg_db85fec3b0c623f6194a8357c6e385aa +f396690a85196faf71d531782a4ecd45a3c2507943ee9c679e4a59fb7ab86ea3 \ No newline at end of file diff --git a/BitgetApi/Data/GlobalOptions.cs b/BitgetApi/Data/GlobalOptions.cs new file mode 100644 index 0000000..79c790f --- /dev/null +++ b/BitgetApi/Data/GlobalOptions.cs @@ -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 + { + public APIKeyInfo_Bitget SelectAPI { get; set; } = APIKeyInfo_Bitget.김영호; + + } +} diff --git a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs index 7cf4976..fefeeb7 100644 --- a/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs +++ b/BitgetApi/IndicatorConditionSetup/IndicatorProcess.cs @@ -23,12 +23,29 @@ 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"; // 스레드 시작/종료 플래그 public bool Is_th_SignalInfo; diff --git a/BitgetApi/MainForm.Designer.cs b/BitgetApi/MainForm.Designer.cs index e789a34..c678fdf 100644 --- a/BitgetApi/MainForm.Designer.cs +++ b/BitgetApi/MainForm.Designer.cs @@ -31,9 +31,11 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.groupControl_Setting = new DevExpress.XtraEditors.GroupControl(); 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.labelControl9 = new DevExpress.XtraEditors.LabelControl(); this.labelControl2 = new DevExpress.XtraEditors.LabelControl(); this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); this.groupControl_MarketInfo = new DevExpress.XtraEditors.GroupControl(); @@ -93,9 +95,11 @@ this.checkedComboBoxEdit_TimeInterval = new DevExpress.XtraEditors.CheckedComboBoxEdit(); this.checkedComboBoxEdit_MarketInfoList = new DevExpress.XtraEditors.CheckedComboBoxEdit(); this.treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn(); + this.xtraTabPage_Result = new DevExpress.XtraTab.XtraTabPage(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).BeginInit(); this.groupControl_Setting.SuspendLayout(); ((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(); @@ -151,9 +155,11 @@ 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.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.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); @@ -171,6 +177,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(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 // this.comboBoxEdit_ConinType.Location = new System.Drawing.Point(248, 41); @@ -202,6 +218,14 @@ this.labelControl4.TabIndex = 0; 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 // this.labelControl2.Location = new System.Drawing.Point(186, 44); @@ -366,7 +390,8 @@ 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 // @@ -842,6 +867,12 @@ this.treeListColumn1.Visible = true; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -857,6 +888,7 @@ this.groupControl_Setting.ResumeLayout(false); this.groupControl_Setting.PerformLayout(); ((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(); @@ -977,6 +1009,9 @@ 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; } } diff --git a/BitgetApi/MainForm.cs b/BitgetApi/MainForm.cs index 3bc3eda..368486a 100644 --- a/BitgetApi/MainForm.cs +++ b/BitgetApi/MainForm.cs @@ -1,4 +1,5 @@ using BitgetApi.Data; +using BitgetApi.Data.API; using BitgetAPI.Data; using BitgetAPI.IndicatorConditionSetup; using BitgetAPI.WebService; @@ -100,7 +101,11 @@ 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); + } + cb_ApiKeys.SelectedIndex = GlobalOptions.Instance.SelectAPI.Id; } @@ -568,5 +573,20 @@ 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("키 못찾음", "확인 필요"); + } } }