기본 설정값 오류 수정

This commit is contained in:
DESKTOP-BQ5FCLL\lee
2024-10-21 19:12:08 +09:00
parent 2eb2bf1ef1
commit 9ca59c0a12
5 changed files with 236 additions and 20 deletions

View File

@@ -8,9 +8,9 @@ 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

@@ -10,7 +10,10 @@ namespace BitgetApi.Data
{
public class GlobalOptions : BaseSettings<GlobalOptions>
{
public APIKeyInfo_Bitget SelectAPI { get; set; } = APIKeyInfo_Bitget.김영호;
public APIKeyInfo_Bitget SelectAPI { get; set; } = null;
public double Leverage { get; set; } = 10;
public double OrderAmount { get; set; } = 50;
}
}

View File

@@ -47,6 +47,23 @@ namespace BitgetAPI.IndicatorConditionSetup
}
}// = "dudgh0505";
private double YHKIM_Leverage
{
get
{
return options.Leverage;
}
}
private double YHKIM_OrderAmount
{
get
{
return options.OrderAmount;
}
}
// 스레드 시작/종료 플래그
public bool Is_th_SignalInfo;
public Dictionary<string, Dictionary<string, object>> 전저점 = new Dictionary<string, Dictionary<string, object>>();
@@ -730,8 +747,8 @@ namespace BitgetAPI.IndicatorConditionSetup
if (LongCount < 3)
{
double size = 50 / price;
var orderData = FutureOrder(market, FutureMarginMode.isolated, size, price, FutureSide.BuyLong, OrderType.limit, 10);
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>
@@ -798,7 +815,7 @@ namespace BitgetAPI.IndicatorConditionSetup
if (orderDic != null)
{
double.TryParse(orderDic["Size"].ToString(), out var size);
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"]));
var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]);
@@ -1033,8 +1050,8 @@ namespace BitgetAPI.IndicatorConditionSetup
if(ShortCount < 3)
{
double size = 50 / 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>
@@ -1101,7 +1118,7 @@ namespace BitgetAPI.IndicatorConditionSetup
if (orderDic != null)
{
double.TryParse(orderDic["Size"].ToString(), out var size);
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"]));
var detail = GetFutureOrderDetail(market, sellOrderDic["orderId"]);

View File

@@ -30,11 +30,15 @@
{
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();
@@ -94,10 +98,18 @@
this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
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();
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();
@@ -148,26 +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)));
@@ -179,7 +230,7 @@
//
// cb_ApiKeys
//
this.cb_ApiKeys.Location = new System.Drawing.Point(442, 44);
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)});
@@ -218,9 +269,25 @@
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(380, 47);
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;
@@ -383,7 +450,7 @@
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);
@@ -860,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";
@@ -867,17 +941,74 @@
this.treeListColumn1.Visible = true;
this.treeListColumn1.VisibleIndex = 0;
//
// xtraTabPage_Result
// btn_OptionSave
//
this.xtraTabPage_Result.Name = "xtraTabPage_Result";
this.xtraTabPage_Result.Size = new System.Drawing.Size(1010, 408);
this.xtraTabPage_Result.Text = "매수/매도";
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);
@@ -887,6 +1018,8 @@
((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();
@@ -939,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);
}
@@ -1012,6 +1157,16 @@
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

@@ -31,6 +31,7 @@ namespace BitgetAPI
public partial class MainForm : Form
{
CommonProperty commonProperty = CommonProperty.Instance;
GlobalOptions globalOptions = GlobalOptions.Instance;
#region 폼 내 사용되는 스레드
// 트리 현황판 업데이트 스레드 (단순 폼 업데이트)
@@ -105,7 +106,15 @@ namespace BitgetAPI
{
cb_ApiKeys.Properties.Items.Add(item.Name);
}
cb_ApiKeys.SelectedIndex = GlobalOptions.Instance.SelectAPI.Id;
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();
}
@@ -588,5 +597,37 @@ namespace BitgetAPI
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();
}
}
}