Source 정리

This commit is contained in:
jhlee
2021-07-25 14:53:21 +09:00
parent 67cb7231b1
commit e2995ad721
14 changed files with 225 additions and 1666 deletions

View File

@@ -38,12 +38,17 @@
<Reference Include="DevExpress.Sparkline.v18.2.Core, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Runtime.Remoting" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -78,6 +83,7 @@
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@@ -31,40 +31,39 @@
this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
this.listBoxControl_logViewer = new DevExpress.XtraEditors.ListBoxControl();
this.panelControl2 = new DevExpress.XtraEditors.PanelControl();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox_DB접속 = new System.Windows.Forms.GroupBox();
this.label_ExchangePlace = new System.Windows.Forms.Label();
this.comboBoxEdit_ExchangePlace = new DevExpress.XtraEditors.ComboBoxEdit();
this.label_QueryStr = new System.Windows.Forms.Label();
this.textEdit_SqLQuery = new DevExpress.XtraEditors.TextEdit();
this.button_QueryTest = new System.Windows.Forms.Button();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button2 = new System.Windows.Forms.Button();
this.button_TotalDataSave = new System.Windows.Forms.Button();
this.comboBoxEdit_OneGoodsSave = new DevExpress.XtraEditors.ComboBoxEdit();
this.button_OneGoodsDataSave = new System.Windows.Forms.Button();
this.groupBox_ButtonMenu = new System.Windows.Forms.GroupBox();
this.button_AllPlaceGoodsUpdate = new System.Windows.Forms.Button();
this.button_SelectedPlaceGoodsUpdate = new System.Windows.Forms.Button();
this.groupBox_데이터누적 = new System.Windows.Forms.GroupBox();
this.label_종목코드 = new System.Windows.Forms.Label();
this.comboBoxEdit_MarketInfo = new DevExpress.XtraEditors.ComboBoxEdit();
this.button_AllMarketDataAcc = new System.Windows.Forms.Button();
this.button_SelectedMarketDataAcc = new System.Windows.Forms.Button();
this.groupBox_종목업데이트 = new System.Windows.Forms.GroupBox();
this.button_SelectedPlaceMarketUpdate = new System.Windows.Forms.Button();
this.comboBoxEdit_PaymentType = new DevExpress.XtraEditors.ComboBoxEdit();
this.label_종목타입 = new System.Windows.Forms.Label();
this.label_종목이름 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
this.panelControl1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.listBoxControl_logViewer)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.panelControl2)).BeginInit();
this.panelControl2.SuspendLayout();
this.groupBox1.SuspendLayout();
this.groupBox_DB접속.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.textEdit_SqLQuery.Properties)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_OneGoodsSave.Properties)).BeginInit();
this.groupBox_ButtonMenu.SuspendLayout();
this.groupBox_데이터누적.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_MarketInfo.Properties)).BeginInit();
this.groupBox_종목업데이트.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_PaymentType.Properties)).BeginInit();
this.SuspendLayout();
//
// panelControl1
//
this.panelControl1.Controls.Add(this.listBoxControl_logViewer);
this.panelControl1.Dock = System.Windows.Forms.DockStyle.Right;
this.panelControl1.Location = new System.Drawing.Point(698, 0);
this.panelControl1.Location = new System.Drawing.Point(246, 0);
this.panelControl1.Name = "panelControl1";
this.panelControl1.Size = new System.Drawing.Size(227, 555);
this.panelControl1.Size = new System.Drawing.Size(227, 322);
this.panelControl1.TabIndex = 0;
//
// listBoxControl_logViewer
@@ -72,40 +71,35 @@
this.listBoxControl_logViewer.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBoxControl_logViewer.Location = new System.Drawing.Point(2, 2);
this.listBoxControl_logViewer.Name = "listBoxControl_logViewer";
this.listBoxControl_logViewer.Size = new System.Drawing.Size(223, 551);
this.listBoxControl_logViewer.Size = new System.Drawing.Size(223, 318);
this.listBoxControl_logViewer.TabIndex = 0;
//
// panelControl2
//
this.panelControl2.Controls.Add(this.groupBox1);
this.panelControl2.Controls.Add(this.groupBox2);
this.panelControl2.Controls.Add(this.groupBox_ButtonMenu);
this.panelControl2.Controls.Add(this.groupBox_DB접속);
this.panelControl2.Controls.Add(this.groupBox_데이터누적);
this.panelControl2.Controls.Add(this.groupBox_종목업데이트);
this.panelControl2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelControl2.Location = new System.Drawing.Point(0, 0);
this.panelControl2.Name = "panelControl2";
this.panelControl2.Size = new System.Drawing.Size(698, 555);
this.panelControl2.Size = new System.Drawing.Size(246, 322);
this.panelControl2.TabIndex = 1;
//
// groupBox1
// groupBox_DB접속
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.label_ExchangePlace);
this.groupBox1.Controls.Add(this.comboBoxEdit_ExchangePlace);
this.groupBox1.Controls.Add(this.label_QueryStr);
this.groupBox1.Controls.Add(this.textEdit_SqLQuery);
this.groupBox1.Controls.Add(this.button_QueryTest);
this.groupBox1.Location = new System.Drawing.Point(5, 5);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(679, 73);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "DB 접속";
this.groupBox_DB접속.Controls.Add(this.label_ExchangePlace);
this.groupBox_DB접속.Controls.Add(this.comboBoxEdit_ExchangePlace);
this.groupBox_DB접속.Location = new System.Drawing.Point(13, 5);
this.groupBox_DB접속.Name = "groupBox_DB접속";
this.groupBox_DB접속.Size = new System.Drawing.Size(215, 57);
this.groupBox_DB접속.TabIndex = 0;
this.groupBox_DB접속.TabStop = false;
this.groupBox_DB접속.Text = "DB 접속";
//
// label_ExchangePlace
//
this.label_ExchangePlace.AutoSize = true;
this.label_ExchangePlace.Location = new System.Drawing.Point(7, 24);
this.label_ExchangePlace.Location = new System.Drawing.Point(14, 24);
this.label_ExchangePlace.Name = "label_ExchangePlace";
this.label_ExchangePlace.Size = new System.Drawing.Size(49, 14);
this.label_ExchangePlace.TabIndex = 4;
@@ -113,132 +107,123 @@
//
// comboBoxEdit_ExchangePlace
//
this.comboBoxEdit_ExchangePlace.Location = new System.Drawing.Point(62, 21);
this.comboBoxEdit_ExchangePlace.Location = new System.Drawing.Point(69, 21);
this.comboBoxEdit_ExchangePlace.Name = "comboBoxEdit_ExchangePlace";
this.comboBoxEdit_ExchangePlace.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.comboBoxEdit_ExchangePlace.Size = new System.Drawing.Size(100, 20);
this.comboBoxEdit_ExchangePlace.Size = new System.Drawing.Size(127, 20);
this.comboBoxEdit_ExchangePlace.TabIndex = 3;
this.comboBoxEdit_ExchangePlace.SelectedIndexChanged += new System.EventHandler(this.comboBoxEdit_ExchangePlace_SelectedIndexChanged);
//
// label_QueryStr
// groupBox_데이터누적
//
this.label_QueryStr.AutoSize = true;
this.label_QueryStr.Location = new System.Drawing.Point(17, 50);
this.label_QueryStr.Name = "label_QueryStr";
this.label_QueryStr.Size = new System.Drawing.Size(39, 14);
this.label_QueryStr.TabIndex = 4;
this.label_QueryStr.Text = "쿼리 : ";
this.groupBox_데이터누적.Controls.Add(this.label_종목타입);
this.groupBox_데이터누적.Controls.Add(this.label_종목이름);
this.groupBox_데이터누적.Controls.Add(this.label_종목코드);
this.groupBox_데이터누적.Controls.Add(this.comboBoxEdit_PaymentType);
this.groupBox_데이터누적.Controls.Add(this.comboBoxEdit_MarketInfo);
this.groupBox_데이터누적.Controls.Add(this.button_AllMarketDataAcc);
this.groupBox_데이터누적.Controls.Add(this.button_SelectedMarketDataAcc);
this.groupBox_데이터누적.Location = new System.Drawing.Point(13, 132);
this.groupBox_데이터누적.Name = "groupBox_데이터누적";
this.groupBox_데이터누적.Size = new System.Drawing.Size(215, 181);
this.groupBox_데이터누적.TabIndex = 0;
this.groupBox_데이터누적.TabStop = false;
this.groupBox_데이터누적.Text = "데이터 누적";
//
// textEdit_SqLQuery
// label_종목코드
//
this.textEdit_SqLQuery.Location = new System.Drawing.Point(62, 47);
this.textEdit_SqLQuery.Name = "textEdit_SqLQuery";
this.textEdit_SqLQuery.Size = new System.Drawing.Size(537, 20);
this.textEdit_SqLQuery.TabIndex = 1;
this.label_종목코드.AutoSize = true;
this.label_종목코드.Location = new System.Drawing.Point(130, 120);
this.label_종목코드.Name = "label_종목코드";
this.label_종목코드.Size = new System.Drawing.Size(51, 14);
this.label_종목코드.TabIndex = 4;
this.label_종목코드.Text = "종목 코드";
//
// button_QueryTest
// comboBoxEdit_MarketInfo
//
this.button_QueryTest.Location = new System.Drawing.Point(605, 46);
this.button_QueryTest.Name = "button_QueryTest";
this.button_QueryTest.Size = new System.Drawing.Size(68, 23);
this.button_QueryTest.TabIndex = 0;
this.button_QueryTest.Text = "보내기";
this.button_QueryTest.UseVisualStyleBackColor = true;
this.button_QueryTest.Click += new System.EventHandler(this.button_QueryTest_Click);
//
// groupBox2
//
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button_TotalDataSave);
this.groupBox2.Controls.Add(this.comboBoxEdit_OneGoodsSave);
this.groupBox2.Controls.Add(this.button_OneGoodsDataSave);
this.groupBox2.Location = new System.Drawing.Point(231, 84);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(197, 118);
this.groupBox2.TabIndex = 0;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "메뉴";
//
// button2
//
this.button2.Location = new System.Drawing.Point(6, 50);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(183, 23);
this.button2.TabIndex = 0;
this.button2.Text = "선택 거래소 데이터 누적";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button_TotalDataSave_Click);
//
// button_TotalDataSave
//
this.button_TotalDataSave.Location = new System.Drawing.Point(6, 21);
this.button_TotalDataSave.Name = "button_TotalDataSave";
this.button_TotalDataSave.Size = new System.Drawing.Size(183, 23);
this.button_TotalDataSave.TabIndex = 0;
this.button_TotalDataSave.Text = "전 거래소 데이터 누적";
this.button_TotalDataSave.UseVisualStyleBackColor = true;
this.button_TotalDataSave.Click += new System.EventHandler(this.button_TotalDataSave_Click);
//
// comboBoxEdit_OneGoodsSave
//
this.comboBoxEdit_OneGoodsSave.Location = new System.Drawing.Point(6, 79);
this.comboBoxEdit_OneGoodsSave.Name = "comboBoxEdit_OneGoodsSave";
this.comboBoxEdit_OneGoodsSave.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
this.comboBoxEdit_MarketInfo.Location = new System.Drawing.Point(83, 97);
this.comboBoxEdit_MarketInfo.Name = "comboBoxEdit_MarketInfo";
this.comboBoxEdit_MarketInfo.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.comboBoxEdit_OneGoodsSave.Size = new System.Drawing.Size(100, 20);
this.comboBoxEdit_OneGoodsSave.TabIndex = 3;
this.comboBoxEdit_OneGoodsSave.SelectedIndexChanged += new System.EventHandler(this.comboBoxEdit_ExchangePlace_SelectedIndexChanged);
this.comboBoxEdit_MarketInfo.Size = new System.Drawing.Size(113, 20);
this.comboBoxEdit_MarketInfo.TabIndex = 3;
this.comboBoxEdit_MarketInfo.SelectedIndexChanged += new System.EventHandler(this.comboBoxEdit_ExchangePlace_SelectedIndexChanged);
//
// button_OneGoodsDataSave
// button_AllMarketDataAcc
//
this.button_OneGoodsDataSave.Location = new System.Drawing.Point(111, 78);
this.button_OneGoodsDataSave.Name = "button_OneGoodsDataSave";
this.button_OneGoodsDataSave.Size = new System.Drawing.Size(78, 23);
this.button_OneGoodsDataSave.TabIndex = 0;
this.button_OneGoodsDataSave.Text = "한 종목 누적";
this.button_OneGoodsDataSave.UseVisualStyleBackColor = true;
this.button_AllMarketDataAcc.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
this.button_AllMarketDataAcc.Location = new System.Drawing.Point(14, 19);
this.button_AllMarketDataAcc.Name = "button_AllMarketDataAcc";
this.button_AllMarketDataAcc.Size = new System.Drawing.Size(183, 23);
this.button_AllMarketDataAcc.TabIndex = 0;
this.button_AllMarketDataAcc.Text = "전체 종목 데이터 누적";
this.button_AllMarketDataAcc.UseVisualStyleBackColor = false;
this.button_AllMarketDataAcc.Click += new System.EventHandler(this.button_AllMarketDataAcc_Click);
//
// groupBox_ButtonMenu
// button_SelectedMarketDataAcc
//
this.groupBox_ButtonMenu.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox_ButtonMenu.Controls.Add(this.button_AllPlaceGoodsUpdate);
this.groupBox_ButtonMenu.Controls.Add(this.button_SelectedPlaceGoodsUpdate);
this.groupBox_ButtonMenu.Location = new System.Drawing.Point(5, 84);
this.groupBox_ButtonMenu.Name = "groupBox_ButtonMenu";
this.groupBox_ButtonMenu.Size = new System.Drawing.Size(210, 99);
this.groupBox_ButtonMenu.TabIndex = 0;
this.groupBox_ButtonMenu.TabStop = false;
this.groupBox_ButtonMenu.Text = "메뉴";
this.button_SelectedMarketDataAcc.Location = new System.Drawing.Point(13, 141);
this.button_SelectedMarketDataAcc.Name = "button_SelectedMarketDataAcc";
this.button_SelectedMarketDataAcc.Size = new System.Drawing.Size(183, 23);
this.button_SelectedMarketDataAcc.TabIndex = 0;
this.button_SelectedMarketDataAcc.Text = "선택 거래소 데이터 누적";
this.button_SelectedMarketDataAcc.UseVisualStyleBackColor = true;
this.button_SelectedMarketDataAcc.Click += new System.EventHandler(this.button_SelectedMarketDataAcc_Click);
//
// button_AllPlaceGoodsUpdate
// groupBox_종목업데이트
//
this.button_AllPlaceGoodsUpdate.Location = new System.Drawing.Point(6, 21);
this.button_AllPlaceGoodsUpdate.Name = "button_AllPlaceGoodsUpdate";
this.button_AllPlaceGoodsUpdate.Size = new System.Drawing.Size(183, 23);
this.button_AllPlaceGoodsUpdate.TabIndex = 0;
this.button_AllPlaceGoodsUpdate.Text = "모든 거래소 종목 업데이트 (미구현)";
this.button_AllPlaceGoodsUpdate.UseVisualStyleBackColor = true;
this.button_AllPlaceGoodsUpdate.Click += new System.EventHandler(this.button_AllPlaceGoodsUpdate_Click);
this.groupBox_종목업데이트.Controls.Add(this.button_SelectedPlaceMarketUpdate);
this.groupBox_종목업데이트.Location = new System.Drawing.Point(13, 69);
this.groupBox_종목업데이트.Name = "groupBox_종목업데이트";
this.groupBox_종목업데이트.Size = new System.Drawing.Size(215, 57);
this.groupBox_종목업데이트.TabIndex = 0;
this.groupBox_종목업데이트.TabStop = false;
this.groupBox_종목업데이트.Text = "종목 업데이트";
//
// button_SelectedPlaceGoodsUpdate
// button_SelectedPlaceMarketUpdate
//
this.button_SelectedPlaceGoodsUpdate.Location = new System.Drawing.Point(6, 50);
this.button_SelectedPlaceGoodsUpdate.Name = "button_SelectedPlaceGoodsUpdate";
this.button_SelectedPlaceGoodsUpdate.Size = new System.Drawing.Size(183, 23);
this.button_SelectedPlaceGoodsUpdate.TabIndex = 0;
this.button_SelectedPlaceGoodsUpdate.Text = "선택 거래소 종목 업데이트";
this.button_SelectedPlaceGoodsUpdate.UseVisualStyleBackColor = true;
this.button_SelectedPlaceGoodsUpdate.Click += new System.EventHandler(this.button_SelectedPlaceGoodsUpdate_Click);
this.button_SelectedPlaceMarketUpdate.Location = new System.Drawing.Point(14, 21);
this.button_SelectedPlaceMarketUpdate.Name = "button_SelectedPlaceMarketUpdate";
this.button_SelectedPlaceMarketUpdate.Size = new System.Drawing.Size(182, 23);
this.button_SelectedPlaceMarketUpdate.TabIndex = 0;
this.button_SelectedPlaceMarketUpdate.Text = "선택 거래소 종목 업데이트";
this.button_SelectedPlaceMarketUpdate.UseVisualStyleBackColor = true;
this.button_SelectedPlaceMarketUpdate.Click += new System.EventHandler(this.button_SelectedPlaceMarketUpdate_Click);
//
// comboBoxEdit_PaymentType
//
this.comboBoxEdit_PaymentType.Location = new System.Drawing.Point(83, 71);
this.comboBoxEdit_PaymentType.Name = "comboBoxEdit_PaymentType";
this.comboBoxEdit_PaymentType.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.comboBoxEdit_PaymentType.Size = new System.Drawing.Size(113, 20);
this.comboBoxEdit_PaymentType.TabIndex = 3;
this.comboBoxEdit_PaymentType.SelectedIndexChanged += new System.EventHandler(this.comboBoxEdit_ExchangePlace_SelectedIndexChanged);
//
// label_종목타입
//
this.label_종목타입.AutoSize = true;
this.label_종목타입.Location = new System.Drawing.Point(14, 74);
this.label_종목타입.Name = "label_종목타입";
this.label_종목타입.Size = new System.Drawing.Size(63, 14);
this.label_종목타입.TabIndex = 4;
this.label_종목타입.Text = "종목 타입 : ";
//
// label_종목이름
//
this.label_종목이름.AutoSize = true;
this.label_종목이름.Location = new System.Drawing.Point(14, 103);
this.label_종목이름.Name = "label_종목이름";
this.label_종목이름.Size = new System.Drawing.Size(63, 14);
this.label_종목이름.TabIndex = 4;
this.label_종목이름.Text = "종목 이름 : ";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(925, 555);
this.ClientSize = new System.Drawing.Size(473, 322);
this.Controls.Add(this.panelControl2);
this.Controls.Add(this.panelControl1);
this.Name = "MainForm";
@@ -248,13 +233,14 @@
((System.ComponentModel.ISupportInitialize)(this.listBoxControl_logViewer)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.panelControl2)).EndInit();
this.panelControl2.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox_DB접속.ResumeLayout(false);
this.groupBox_DB접속.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.textEdit_SqLQuery.Properties)).EndInit();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_OneGoodsSave.Properties)).EndInit();
this.groupBox_ButtonMenu.ResumeLayout(false);
this.groupBox_데이터누적.ResumeLayout(false);
this.groupBox_데이터누적.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_MarketInfo.Properties)).EndInit();
this.groupBox_종목업데이트.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_PaymentType.Properties)).EndInit();
this.ResumeLayout(false);
}
@@ -264,20 +250,19 @@
private DevExpress.XtraEditors.PanelControl panelControl1;
private DevExpress.XtraEditors.ListBoxControl listBoxControl_logViewer;
private DevExpress.XtraEditors.PanelControl panelControl2;
private System.Windows.Forms.GroupBox groupBox_ButtonMenu;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox_종목업데이트;
private System.Windows.Forms.GroupBox groupBox_DB접속;
private System.Windows.Forms.Label label_ExchangePlace;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit_ExchangePlace;
private System.Windows.Forms.Label label_QueryStr;
private DevExpress.XtraEditors.TextEdit textEdit_SqLQuery;
private System.Windows.Forms.Button button_QueryTest;
private System.Windows.Forms.Button button_TotalDataSave;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit_OneGoodsSave;
private System.Windows.Forms.Button button_OneGoodsDataSave;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button_AllPlaceGoodsUpdate;
private System.Windows.Forms.Button button_SelectedPlaceGoodsUpdate;
private System.Windows.Forms.GroupBox groupBox_데이터누적;
private System.Windows.Forms.Button button_SelectedMarketDataAcc;
private System.Windows.Forms.Button button_SelectedPlaceMarketUpdate;
private System.Windows.Forms.Button button_AllMarketDataAcc;
private System.Windows.Forms.Label label_종목코드;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit_MarketInfo;
private System.Windows.Forms.Label label_종목타입;
private DevExpress.XtraEditors.ComboBoxEdit comboBoxEdit_PaymentType;
private System.Windows.Forms.Label label_종목이름;
}
}

View File

@@ -1,13 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.ClipboardSource.SpreadsheetML;
using Million;
namespace DataSaver
@@ -18,33 +10,31 @@ namespace DataSaver
{
InitializeComponent();
initForm();
InitForm();
}
/// <summary>
/// 초기 동작
/// </summary>
private void initForm()
private void InitForm()
{
// 거래소 정보 콤보박스 초기화
comboBoxEdit_ExchangePlace.Properties.Items.Clear();
// Million으로부터 거래소 정보 가져오기
comboBoxEdit_ExchangePlace.Properties.Items.AddRange(Enum.GetNames(typeof(Million.CommonProperty.ExchangePlace)));
comboBoxEdit_ExchangePlace.SelectedIndex = 0;
comboBoxEdit_ExchangePlace.Properties.Items.AddRange(Enum.GetNames(enumType: typeof(Million.CommonProperty.ExchangePlace)));
///TODO 임시로 Upbit 우선순위 설정
comboBoxEdit_ExchangePlace.SelectedIndex = 1;
// 종목 타입 설정
comboBoxEdit_PaymentType.Properties.Items.AddRange(Enum.GetNames(enumType: typeof(Million.CommonProperty.PaymentType)));
comboBoxEdit_PaymentType.SelectedIndex = 0;
// DB 서버 정보 생성
var strConn = Million.CommonProperty.DbConnectionStr + comboBoxEdit_ExchangePlace.EditValue;
Million.CommonProperty.curDBConStrDataSaver = strConn;
}
Million.CommonProperty.ConDbConnectionStr = strConn;
// DB 종목(Market) 정보 가져오기
/// <summary>
/// 쿼리 테스트 버튼 클릭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button_QueryTest_Click(object sender, EventArgs e)
{
Million.FileDBManagement.DBConnection.SendDbExeQuery(Million.CommonProperty.curDBConStrDataSaver, textEdit_SqLQuery.Text);
}
/// <summary>
@@ -56,82 +46,45 @@ namespace DataSaver
{
// DB 서버 정보 수정
var strConn = Million.CommonProperty.DbConnectionStr + comboBoxEdit_ExchangePlace.EditValue;
Million.CommonProperty.curDBConStrDataSaver = strConn;
Million.CommonProperty.ConDbConnectionStr = strConn;
}
/// <summary>
/// 종목 데이터 누적 버튼 클릭
/// 전체 종목(마킷)에 대한 데이터 누적
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button_TotalDataSave_Click(object sender, EventArgs e)
private void button_AllMarketDataAcc_Click(object sender, EventArgs e)
{
// #0. DB 데이터로부터 최신 시간 가져오기
// #1. 시간으로 데이터 가져오기
// #2. DB에 데이터 누적하기
}
/// <summary>
/// 종목 업데이트 버튼 클릭
/// 선택한 종목에 대한 데이터 누적
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button_SelectedPlaceGoodsUpdate_Click(object sender, EventArgs e)
private void button_SelectedMarketDataAcc_Click(object sender, EventArgs e)
{
List<Million.Data.CoinGoodsData> coinGoodsDataList = null;
// 1. 거래 종목 리스트 가져오기
switch (comboBoxEdit_ExchangePlace.SelectedIndex)
{
// 빗썸 이면
case (int)CommonProperty.ExchangePlace.Bithumb:
coinGoodsDataList = (List<Million.Data.CoinGoodsData>)
Million.WebServices.WebConnection.SendWebServer(
CommonProperty.ExchangeWebReqType.BithumbCoinGoods, DateTime.Now);
break;
// 업비트 이면
case (int)CommonProperty.ExchangePlace.Upbit:
coinGoodsDataList = (List<Million.Data.CoinGoodsData>)
Million.WebServices.WebConnection.SendWebServer(
CommonProperty.ExchangeWebReqType.UpbitCoinGoods, DateTime.Now);
break;
case (int)CommonProperty.ExchangePlace.AllExchangePlace:
break;
}
// coinGoodsDataList 유효성 검사
if (coinGoodsDataList == null || coinGoodsDataList.Count < 1) return;
var sendStrSql = "";
// 2. DB 테이블 생성 쿼리 만들기
foreach (var goodsData in coinGoodsDataList)
{
var tableName = goodsData.Payment + "-" + goodsData.CodeName;
var strSql = @"if not exists (select * from sysobjects where name='" + tableName + @"' and xtype='U')
create table " + "\"" + tableName + "\"" + @"(
DateTime datetime not null,
StartValue float not null,
EndValue float not null,
HighValue float not null,
LowValue float not null,
MoneyValue float not null,
CandleTimeType int not null
) ";
// 테이블 쿼리문 생성 (중복 테이블은 Pass)
sendStrSql += strSql;
}
// 3. 쿼리 보내기
Million.FileDBManagement.DBConnection.SendDbExeQueryNotReq(Million.CommonProperty.curDBConStrDataSaver, sendStrSql);
}
private void button_AllPlaceGoodsUpdate_Click(object sender, EventArgs e)
/// <summary>
/// 선택한 거래소의 종목(Market) 업데이트
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button_SelectedPlaceMarketUpdate_Click(object sender, EventArgs e)
{
// DB에서 종목(Market) 정보 조회 후 없으면 추가 생성하기
// #1. Web에서 Market 정보 가져오기
// TODO 추후 공통화
var marketDataList_FromWeb = Million.WebServices.WebConnection.SendWebServer(CommonProperty.ExchangeWebReqType.UpbitMarket, DateTime.Now);
// #1-1. DB에서 Market 정보 조
var marketDataListFromDb = Million.DbManagement.DbServiceFunctions.GetMarketTable_FromDB(
comboBoxEdit_ExchangePlace.SelectedItem.ToString());
// #2. 비교후 Market 테이블 생성
}
}
}

View File

@@ -29,6 +29,14 @@ namespace Million
AllExchangePlace = 10
}
// 코인 Payument 타입
public enum PaymentType
{
KRW = 0,
BTC = 1,
USDT = 2,
}
/// <summary>
/// TODO 업비트 기능 추가
/// </summary>
@@ -41,19 +49,16 @@ namespace Million
[Description("/public/ticker")]
BithumbCandleTicker = 1,
[Description("/public/Orderbook")]
BithumbCoinGoods = 2,
BithumbMarket = 2,
#endregion
#region 업비트 웹 요청 타입
UpbitCoinGoods = 11
[Description("")]
UpbitMarket = 11
#endregion
}
public enum QueryReqType
{
}
// 캔들 데이터 (1분) (3분) (5분) (10분) (30분) (1시간) (6시간) (12시간) (24시간)
public enum CanldeTimeType
{
@@ -63,20 +68,22 @@ namespace Million
#endregion
#region 빗썸 URL
public static string BithumbURL= "https://api.bithumb.com/public/candlestick/";
public static string BithumbURL= "https://api.bithumb.com/";
public static string BithumbURL_CandleStick = "https://api.bithumb.com/public/candlestick/";
public static string BithumbURL_CoinGoods = "https://api.bithumb.com/public/orderbook/ALL_KRW";
#endregion
#region 업비트 URL
public static string UpbitURL = "https://api.upbit.com/";
public static string upbitURL_CandleStick = "https://api.bithumb.com/public/candlestick/";
public static string UpbitURL_CoinGoods = "https://api.upbit.com/v1/market/all?isDetails=false";
public static string UpbitURL_MarketInfo = "https://api.upbit.com/v1/market/all?isDetails=false";
public static string upbitURL_CandleStick = "https://api.upbit.com/v1/candles/minutes";
//"https://api.upbit.com/v1/candles/minutes/1?market=KRW-BTC&count=3&to=2019-12-22 01:00:00";
#endregion
#region 공용 리스트
// 거래소 코인 종목 리스트
public List<Data.CoinGoodsData> ConiCoinGoodsDataList;
public List<Data.MarketData> ConiCoinGoodsDataList;
public Dictionary<string, string> BithumbEndPointTypeLIst = new Dictionary<string, string>
{
@@ -84,22 +91,24 @@ namespace Million
};
#endregion
#region 저장 데이터 관련
// 저장 데이터 폴더 경로
public static string SaveProgramDirecotryPath = $"{System.Windows.Forms.Application.StartupPath}\\SaveData";
// ini 파일 경로
public static string IniFileName = $"{SaveProgramDirecotryPath}\\" + "setting.ini";
// 거래소 코인 종목 저장 파일 경로
public static string BitThumJasonFilePath = $"{SaveProgramDirecotryPath}\\CoinGoods.txt";
// 거래소 코인 종목 저장 파일 경로 (DB 조회로 대체 예정)
//public static string BitThumJasonFilePath = $"{SaveProgramDirecotryPath}\\CoinGoods.txt";
#endregion
//TODO 추후 관리 방안 고려
#region # 데이터 베이스 정보 #
public static string DbConnectionStr = "Data Source=192.168.0.21;uid=sqlm;pwd=12345678;Database=";
public static string curDBConStrMillion = "Data Source=192.168.0.21;uid=sqlm;pwd=12345678;Database=";
public static string curDBConStrDataSaver = "Data Source=192.168.0.21;uid=sqlm;pwd=12345678;Database=";
private const string DbServerIp = "localhost";
private const string DbServerUserId = "million";
private const string DbServerUserPassword = "million!";
public static string DbConnectionStr = $"Data Source={DbServerIp};uid={DbServerUserId};pwd={DbServerUserPassword};Database=";
//현재 시점에서 사용되고 있는 DB Connection String
public static string ConDbConnectionStr = DbConnectionStr;
#endregion
}
}

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Million.Data
{

View File

@@ -1,26 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace Million.Data
{
public class CandleDataList
{
// 코인 종목
public CoinGoodsData ConGoodsData { get; set; }
public MarketData ConGoodsData { get; set; }
// 캔들 데이터 (1분)
public List<CandleData> CandleDataLists_Im { get; set; }
// 캔들 데이터 (3분)
// 캔들 데이터 (5분)
// 캔들 데이터 (10분)
// 캔들 데이터 (30분)
// 캔들 데이터 (1시간)
public List<CandleData> CandleDataLists_IH { get; set; }
// 캔들 데이터 (6시간)
// 캔들 데이터 (12시간)
// 캔들 데이터 (24시간)
public List<CandleData> CandleDataLists_Id { get; set; }
}
}

View File

@@ -1,24 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.XtraMap.Drawing;
namespace Million.Data
{
public class CoinGoodsData
{
// 거래소
public CommonProperty.ExchangePlace ExchangePlace { get; set; }
// 코인 이름
public string KorName { get; set; }
// 코인 코드
public string CodeName { get; set; }
// BTC, KRW 구분
public string Payment { get; set; }
}
}

View File

@@ -1,115 +0,0 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DevExpress.DashboardWin.Design;
using DevExpress.Data.Helpers;
namespace Million.FileDBManagement
{
public class DBConnection
{
public static string sqlAddress = "192.168.0.21";
public static string uId = "sqlm";
public static string pwd = "12345678";
public static string GetConnectionString(string databaseName)
{
return "Data Source=" + sqlAddress + ";uid=" + uId + ";pwd=" + pwd + ";Database=" + databaseName;
}
/// <summary>
/// DB 테이블 생성
/// </summary>
/// <param name="market"></param>
/// <returns></returns>
public static string QueryCreateTable(string tableName)
{
var resultstring = "";
if (!string.IsNullOrWhiteSpace(tableName))
{
resultstring = @"if not exists (select * from sysobjects where name='" + tableName + @"' and xtype='U')
create table " + "\"" + tableName + "\"" + @"(
DateTime datetime not null,
StartValue float not null,
EndValue float not null,
HighValue float not null,
LowValue float not null,
MoneyValue float not null,
CandleTimeType int not null
) ";
}
return resultstring;
}
public static bool SendDbExeQueryNotReq(string dbConStr, string sqlQuery)
{
using (var conn = new SqlConnection(dbConStr))
using (var cmd = new SqlCommand(sqlQuery, conn))
{
try
{
conn.Open();
using (var rdr = cmd.ExecuteReader())
{
rdr.Close();
}
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(" ============= exception ===============");
Console.WriteLine(ex.Message);
conn.Close();
return false;
}
}
return true;
}
public static bool SendDbExeQuery(string dbConStr, string sqlQuery)
{
using (var conn = new SqlConnection(dbConStr))
using (var cmd = new SqlCommand(sqlQuery, conn))
{
try
{
conn.Open();
using (var rdr = cmd.ExecuteReader())
{
List<Dictionary<string,object>> queryResultData = new List<Dictionary<string, object>>();
while (rdr.Read())
{
queryResultData.Add( new Dictionary<string, object>{
{ "DateTime", rdr["DateTime"] },
{ "StartValue", rdr["StartValue"] },
{ "EndValue", rdr["EndValue"] },
{ "HighValue", rdr["HighValue"] },
{ "LowValue", rdr["LowValue"] },
{ "MoneyValue", rdr["MoneyValue"] },
{ "CandleTimeType", rdr["CandleTimeType"] },
});
}
rdr.Close();
}
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(" ============= exception ===============");
Console.WriteLine(ex.Message);
conn.Close();
return false;
}
}
return true;
}
}
}

View File

@@ -1,66 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Million.FileDBManagement
{
public class FileManager
{
// Save File 경로
public static bool FileSave(string filePath, string data)
{
FileStream fileStream = null;
try
{
// 파일 저장
fileStream = new FileStream(filePath, FileMode.OpenOrCreate);
using (var writer = new StreamWriter(fileStream, Encoding.UTF8))
{
writer.Write(data);
}
}
catch
{
// ignored
return false;
}
finally
{
fileStream?.Dispose();
}
return true;
}
public static bool FileLoad(string filePath, string data)
{
FileStream fileStream = null;
try
{
// 파일 저장
fileStream = new FileStream(filePath, FileMode.Open);
using (var reader = new StreamReader(fileStream, Encoding.UTF8))
{
var loadData = reader.ReadToEnd();
}
}
catch
{
// ignored
return false;
}
finally
{
fileStream?.Dispose();
}
return true;
}
}
}

View File

@@ -1,790 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public struct IniValue {
private static bool TryParseInt(string text, out int value) {
int res;
if (Int32.TryParse(text,
System.Globalization.NumberStyles.Integer,
System.Globalization.CultureInfo.InvariantCulture,
out res)) {
value = res;
return true;
}
value = 0;
return false;
}
private static bool TryParseDouble(string text, out double value) {
double res;
if (Double.TryParse(text,
System.Globalization.NumberStyles.Float,
System.Globalization.CultureInfo.InvariantCulture,
out res)) {
value = res;
return true;
}
value = Double.NaN;
return false;
}
public string Value;
public IniValue(object value) {
var formattable = value as IFormattable;
if (formattable != null) {
Value = formattable.ToString(null, System.Globalization.CultureInfo.InvariantCulture);
}
else {
Value = value != null ? value.ToString() : null;
}
}
public IniValue(string value) {
Value = value;
}
public bool ToBool(bool valueIfInvalid = false) {
bool res;
if (TryConvertBool(out res)) {
return res;
}
return valueIfInvalid;
}
public bool TryConvertBool(out bool result) {
if (Value == null) {
result = default(bool);
return false;
}
var boolStr = Value.Trim().ToLowerInvariant();
if (boolStr == "true") {
result = true;
return true;
}
else if (boolStr == "false") {
result = false;
return true;
}
result = default(bool);
return false;
}
public int ToInt(int valueIfInvalid = 0) {
int res;
if (TryConvertInt(out res)) {
return res;
}
return valueIfInvalid;
}
public bool TryConvertInt(out int result) {
if (Value == null) {
result = default(int);
return false;
}
if (TryParseInt(Value.Trim(), out result)) {
return true;
}
return false;
}
public double ToDouble(double valueIfInvalid = 0) {
double res;
if (TryConvertDouble(out res)) {
return res;
}
return valueIfInvalid;
}
public bool TryConvertDouble(out double result) {
if (Value == null) {
result = default(double);
return false; ;
}
if (TryParseDouble(Value.Trim(), out result)) {
return true;
}
return false;
}
public string GetString() {
return GetString(true, false);
}
public string GetString(bool preserveWhitespace) {
return GetString(true, preserveWhitespace);
}
public string GetString(bool allowOuterQuotes, bool preserveWhitespace) {
if (Value == null) {
return "";
}
var trimmed = Value.Trim();
if (allowOuterQuotes && trimmed.Length >= 2 && trimmed[0] == '"' && trimmed[trimmed.Length - 1] == '"') {
var inner = trimmed.Substring(1, trimmed.Length - 2);
return preserveWhitespace ? inner : inner.Trim();
}
else {
return preserveWhitespace ? Value : Value.Trim();
}
}
public override string ToString() {
return Value;
}
public static implicit operator IniValue(byte o) {
return new IniValue(o);
}
public static implicit operator IniValue(short o) {
return new IniValue(o);
}
public static implicit operator IniValue(int o) {
return new IniValue(o);
}
public static implicit operator IniValue(sbyte o) {
return new IniValue(o);
}
public static implicit operator IniValue(ushort o) {
return new IniValue(o);
}
public static implicit operator IniValue(uint o) {
return new IniValue(o);
}
public static implicit operator IniValue(float o) {
return new IniValue(o);
}
public static implicit operator IniValue(double o) {
return new IniValue(o);
}
public static implicit operator IniValue(bool o) {
return new IniValue(o);
}
public static implicit operator IniValue(string o) {
return new IniValue(o);
}
private static readonly IniValue _default = new IniValue();
public static IniValue Default { get { return _default; } }
}
public class IniFile : IEnumerable<KeyValuePair<string, IniSection>>, IDictionary<string, IniSection> {
private Dictionary<string, IniSection> sections;
public IEqualityComparer<string> StringComparer;
public bool SaveEmptySections;
public IniFile()
: this(DefaultComparer) {
}
public IniFile(IEqualityComparer<string> stringComparer) {
StringComparer = stringComparer;
sections = new Dictionary<string, IniSection>(StringComparer);
}
public void Save(string path, FileMode mode = FileMode.Create) {
using (var stream = new FileStream(path, mode, FileAccess.Write)) {
Save(stream);
}
}
public void Save(Stream stream) {
using (var writer = new StreamWriter(stream)) {
Save(writer);
}
}
public void Save(StreamWriter writer) {
foreach (var section in sections) {
if (section.Value.Count > 0 || SaveEmptySections) {
writer.WriteLine(string.Format("[{0}]", section.Key.Trim()));
foreach (var kvp in section.Value) {
writer.WriteLine(string.Format("{0}={1}", kvp.Key, kvp.Value));
}
writer.WriteLine("");
}
}
}
public bool Load(string path, bool ordered = false)
{
if (!File.Exists(path)) return false;
using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
Load(stream, ordered);
}
return true;
}
public void Load(Stream stream, bool ordered = false) {
using (var reader = new StreamReader(stream)) {
Load(reader, ordered);
}
}
public void Load(StreamReader reader, bool ordered = false) {
IniSection section = null;
while (!reader.EndOfStream) {
var line = reader.ReadLine();
if (line != null) {
var trimStart = line.TrimStart();
if (trimStart.Length > 0) {
if (trimStart[0] == '[') {
var sectionEnd = trimStart.IndexOf(']');
if (sectionEnd > 0) {
var sectionName = trimStart.Substring(1, sectionEnd - 1).Trim();
section = new IniSection(StringComparer) { Ordered = ordered };
sections[sectionName] = section;
}
}
else if (section != null && trimStart[0] != ';') {
string key;
IniValue val;
if (LoadValue(line, out key, out val)) {
section[key] = val;
}
}
}
}
}
}
private bool LoadValue(string line, out string key, out IniValue val) {
var assignIndex = line.IndexOf('=');
if (assignIndex <= 0) {
key = null;
val = null;
return false;
}
key = line.Substring(0, assignIndex).Trim();
var value = line.Substring(assignIndex + 1);
val = new IniValue(value);
return true;
}
public bool ContainsSection(string section) {
return sections.ContainsKey(section);
}
public bool TryGetSection(string section, out IniSection result) {
return sections.TryGetValue(section, out result);
}
bool IDictionary<string, IniSection>.TryGetValue(string key, out IniSection value) {
return TryGetSection(key, out value);
}
public bool Remove(string section) {
return sections.Remove(section);
}
public IniSection Add(string section, Dictionary<string, IniValue> values, bool ordered = false) {
return Add(section, new IniSection(values, StringComparer) { Ordered = ordered });
}
public IniSection Add(string section, IniSection value) {
if (value.Comparer != StringComparer) {
value = new IniSection(value, StringComparer);
}
sections.Add(section, value);
return value;
}
public IniSection Add(string section, bool ordered = false) {
var value = new IniSection(StringComparer) { Ordered = ordered };
sections.Add(section, value);
return value;
}
void IDictionary<string, IniSection>.Add(string key, IniSection value) {
Add(key, value);
}
bool IDictionary<string, IniSection>.ContainsKey(string key) {
return ContainsSection(key);
}
public ICollection<string> Keys {
get { return sections.Keys; }
}
public ICollection<IniSection> Values {
get { return sections.Values; }
}
void ICollection<KeyValuePair<string, IniSection>>.Add(KeyValuePair<string, IniSection> item) {
((IDictionary<string, IniSection>)sections).Add(item);
}
public void Clear() {
sections.Clear();
}
bool ICollection<KeyValuePair<string, IniSection>>.Contains(KeyValuePair<string, IniSection> item) {
return ((IDictionary<string, IniSection>)sections).Contains(item);
}
void ICollection<KeyValuePair<string, IniSection>>.CopyTo(KeyValuePair<string, IniSection>[] array, int arrayIndex) {
((IDictionary<string, IniSection>)sections).CopyTo(array, arrayIndex);
}
public int Count {
get { return sections.Count; }
}
bool ICollection<KeyValuePair<string, IniSection>>.IsReadOnly {
get { return ((IDictionary<string, IniSection>)sections).IsReadOnly; }
}
bool ICollection<KeyValuePair<string, IniSection>>.Remove(KeyValuePair<string, IniSection> item) {
return ((IDictionary<string, IniSection>)sections).Remove(item);
}
public IEnumerator<KeyValuePair<string, IniSection>> GetEnumerator() {
return sections.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
return GetEnumerator();
}
public IniSection this[string section] {
get {
IniSection s;
if (sections.TryGetValue(section, out s)) {
return s;
}
s = new IniSection(StringComparer);
sections[section] = s;
return s;
}
set {
var v = value;
if (v.Comparer != StringComparer) {
v = new IniSection(v, StringComparer);
}
sections[section] = v;
}
}
public string GetContents() {
using (var stream = new MemoryStream()) {
Save(stream);
stream.Flush();
var builder = new StringBuilder(Encoding.UTF8.GetString(stream.ToArray()));
return builder.ToString();
}
}
public static IEqualityComparer<string> DefaultComparer = new CaseInsensitiveStringComparer();
class CaseInsensitiveStringComparer : IEqualityComparer<string> {
public bool Equals(string x, string y) {
return String.Compare(x, y, true) == 0;
}
public int GetHashCode(string obj) {
return obj.ToLowerInvariant().GetHashCode();
}
#if JS
public new bool Equals(object x, object y) {
var xs = x as string;
var ys = y as string;
if (xs == null || ys == null) {
return xs == null && ys == null;
}
return Equals(xs, ys);
}
public int GetHashCode(object obj) {
if (obj is string) {
return GetHashCode((string)obj);
}
return obj.ToStringInvariant().ToLowerInvariant().GetHashCode();
}
#endif
}
}
public class IniSection : IEnumerable<KeyValuePair<string, IniValue>>, IDictionary<string, IniValue> {
private Dictionary<string, IniValue> values;
#region Ordered
private List<string> orderedKeys;
public int IndexOf(string key) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call IndexOf(string) on IniSection: section was not ordered.");
}
return IndexOf(key, 0, orderedKeys.Count);
}
public int IndexOf(string key, int index) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call IndexOf(string, int) on IniSection: section was not ordered.");
}
return IndexOf(key, index, orderedKeys.Count - index);
}
public int IndexOf(string key, int index, int count) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call IndexOf(string, int, int) on IniSection: section was not ordered.");
}
if (index < 0 || index > orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
if (count < 0) {
throw new IndexOutOfRangeException("Count cannot be less than zero." + Environment.NewLine + "Parameter name: count");
}
if (index + count > orderedKeys.Count) {
throw new ArgumentException("Index and count were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.");
}
var end = index + count;
for (int i = index; i < end; i++) {
if (Comparer.Equals(orderedKeys[i], key)) {
return i;
}
}
return -1;
}
public int LastIndexOf(string key) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call LastIndexOf(string) on IniSection: section was not ordered.");
}
return LastIndexOf(key, 0, orderedKeys.Count);
}
public int LastIndexOf(string key, int index) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call LastIndexOf(string, int) on IniSection: section was not ordered.");
}
return LastIndexOf(key, index, orderedKeys.Count - index);
}
public int LastIndexOf(string key, int index, int count) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call LastIndexOf(string, int, int) on IniSection: section was not ordered.");
}
if (index < 0 || index > orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
if (count < 0) {
throw new IndexOutOfRangeException("Count cannot be less than zero." + Environment.NewLine + "Parameter name: count");
}
if (index + count > orderedKeys.Count) {
throw new ArgumentException("Index and count were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.");
}
var end = index + count;
for (int i = end - 1; i >= index; i--) {
if (Comparer.Equals(orderedKeys[i], key)) {
return i;
}
}
return -1;
}
public void Insert(int index, string key, IniValue value) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call Insert(int, string, IniValue) on IniSection: section was not ordered.");
}
if (index < 0 || index > orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
values.Add(key, value);
orderedKeys.Insert(index, key);
}
public void InsertRange(int index, IEnumerable<KeyValuePair<string, IniValue>> collection) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call InsertRange(int, IEnumerable<KeyValuePair<string, IniValue>>) on IniSection: section was not ordered.");
}
if (collection == null) {
throw new ArgumentNullException("Value cannot be null." + Environment.NewLine + "Parameter name: collection");
}
if (index < 0 || index > orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
foreach (var kvp in collection) {
Insert(index, kvp.Key, kvp.Value);
index++;
}
}
public void RemoveAt(int index) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call RemoveAt(int) on IniSection: section was not ordered.");
}
if (index < 0 || index > orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
var key = orderedKeys[index];
orderedKeys.RemoveAt(index);
values.Remove(key);
}
public void RemoveRange(int index, int count) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call RemoveRange(int, int) on IniSection: section was not ordered.");
}
if (index < 0 || index > orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
if (count < 0) {
throw new IndexOutOfRangeException("Count cannot be less than zero." + Environment.NewLine + "Parameter name: count");
}
if (index + count > orderedKeys.Count) {
throw new ArgumentException("Index and count were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.");
}
for (int i = 0; i < count; i++) {
RemoveAt(index);
}
}
public void Reverse() {
if (!Ordered) {
throw new InvalidOperationException("Cannot call Reverse() on IniSection: section was not ordered.");
}
orderedKeys.Reverse();
}
public void Reverse(int index, int count) {
if (!Ordered) {
throw new InvalidOperationException("Cannot call Reverse(int, int) on IniSection: section was not ordered.");
}
if (index < 0 || index > orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
if (count < 0) {
throw new IndexOutOfRangeException("Count cannot be less than zero." + Environment.NewLine + "Parameter name: count");
}
if (index + count > orderedKeys.Count) {
throw new ArgumentException("Index and count were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.");
}
orderedKeys.Reverse(index, count);
}
public ICollection<IniValue> GetOrderedValues() {
if (!Ordered) {
throw new InvalidOperationException("Cannot call GetOrderedValues() on IniSection: section was not ordered.");
}
var list = new List<IniValue>();
for (int i = 0; i < orderedKeys.Count; i++) {
list.Add(values[orderedKeys[i]]);
}
return list;
}
public IniValue this[int index] {
get {
if (!Ordered) {
throw new InvalidOperationException("Cannot index IniSection using integer key: section was not ordered.");
}
if (index < 0 || index >= orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
return values[orderedKeys[index]];
}
set {
if (!Ordered) {
throw new InvalidOperationException("Cannot index IniSection using integer key: section was not ordered.");
}
if (index < 0 || index >= orderedKeys.Count) {
throw new IndexOutOfRangeException("Index must be within the bounds." + Environment.NewLine + "Parameter name: index");
}
var key = orderedKeys[index];
values[key] = value;
}
}
public bool Ordered {
get {
return orderedKeys != null;
}
set {
if (Ordered != value) {
orderedKeys = value ? new List<string>(values.Keys) : null;
}
}
}
#endregion
public IniSection()
: this(IniFile.DefaultComparer) {
}
public IniSection(IEqualityComparer<string> stringComparer) {
this.values = new Dictionary<string, IniValue>(stringComparer);
}
public IniSection(Dictionary<string, IniValue> values)
: this(values, IniFile.DefaultComparer) {
}
public IniSection(Dictionary<string, IniValue> values, IEqualityComparer<string> stringComparer) {
this.values = new Dictionary<string, IniValue>(values, stringComparer);
}
public IniSection(IniSection values)
: this(values, IniFile.DefaultComparer) {
}
public IniSection(IniSection values, IEqualityComparer<string> stringComparer) {
this.values = new Dictionary<string, IniValue>(values.values, stringComparer);
}
public void Add(string key, IniValue value) {
values.Add(key, value);
if (Ordered) {
orderedKeys.Add(key);
}
}
public bool ContainsKey(string key) {
return values.ContainsKey(key);
}
/// <summary>
/// Returns this IniSection's collection of keys. If the IniSection is ordered, the keys will be returned in order.
/// </summary>
public ICollection<string> Keys {
get { return Ordered ? (ICollection<string>)orderedKeys : values.Keys; }
}
public bool Remove(string key) {
var ret = values.Remove(key);
if (Ordered && ret) {
for (int i = 0; i < orderedKeys.Count; i++) {
if (Comparer.Equals(orderedKeys[i], key)) {
orderedKeys.RemoveAt(i);
break;
}
}
}
return ret;
}
public bool TryGetValue(string key, out IniValue value) {
return values.TryGetValue(key, out value);
}
/// <summary>
/// Returns the values in this IniSection. These values are always out of order. To get ordered values from an IniSection call GetOrderedValues instead.
/// </summary>
public ICollection<IniValue> Values {
get {
return values.Values;
}
}
void ICollection<KeyValuePair<string, IniValue>>.Add(KeyValuePair<string, IniValue> item) {
((IDictionary<string, IniValue>)values).Add(item);
if (Ordered) {
orderedKeys.Add(item.Key);
}
}
public void Clear() {
values.Clear();
if (Ordered) {
orderedKeys.Clear();
}
}
bool ICollection<KeyValuePair<string, IniValue>>.Contains(KeyValuePair<string, IniValue> item) {
return ((IDictionary<string, IniValue>)values).Contains(item);
}
void ICollection<KeyValuePair<string, IniValue>>.CopyTo(KeyValuePair<string, IniValue>[] array, int arrayIndex) {
((IDictionary<string, IniValue>)values).CopyTo(array, arrayIndex);
}
public int Count {
get { return values.Count; }
}
bool ICollection<KeyValuePair<string, IniValue>>.IsReadOnly {
get { return ((IDictionary<string, IniValue>)values).IsReadOnly; }
}
bool ICollection<KeyValuePair<string, IniValue>>.Remove(KeyValuePair<string, IniValue> item) {
var ret = ((IDictionary<string, IniValue>)values).Remove(item);
if (Ordered && ret) {
for (int i = 0; i < orderedKeys.Count; i++) {
if (Comparer.Equals(orderedKeys[i], item.Key)) {
orderedKeys.RemoveAt(i);
break;
}
}
}
return ret;
}
public IEnumerator<KeyValuePair<string, IniValue>> GetEnumerator() {
if (Ordered) {
return GetOrderedEnumerator();
}
else {
return values.GetEnumerator();
}
}
private IEnumerator<KeyValuePair<string, IniValue>> GetOrderedEnumerator() {
for (int i = 0; i < orderedKeys.Count; i++) {
yield return new KeyValuePair<string, IniValue>(orderedKeys[i], values[orderedKeys[i]]);
}
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
return GetEnumerator();
}
public IEqualityComparer<string> Comparer { get { return values.Comparer; } }
public IniValue this[string name] {
get {
IniValue val;
if (values.TryGetValue(name, out val)) {
return val;
}
return IniValue.Default;
}
set {
if (Ordered && !orderedKeys.Contains(name, Comparer)) {
orderedKeys.Add(name);
}
values[name] = value;
}
}
public static implicit operator IniSection(Dictionary<string, IniValue> dict) {
return new IniSection(dict);
}
public static explicit operator Dictionary<string, IniValue>(IniSection section) {
return section.values;
}
}

View File

@@ -56,6 +56,9 @@
<Reference Include="DevExpress.XtraRichEdit.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraTreeList.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraTreeMap.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="log4net, Version=2.0.12.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
<HintPath>..\packages\log4net.2.0.12\lib\net45\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
@@ -70,7 +73,9 @@
<Reference Include="DevExpress.XtraEditors.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v18.2, Version=18.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@@ -85,10 +90,11 @@
<Compile Include="CommonProperty.cs" />
<Compile Include="Data\CandleData.cs" />
<Compile Include="Data\CandleDataList.cs" />
<Compile Include="Data\CoinGoodsData.cs" />
<Compile Include="FileDBManagement\DBConnection.cs" />
<Compile Include="FileDBManagement\FileContoler.cs" />
<Compile Include="FileDBManagement\Ini.cs" />
<Compile Include="Data\MarketData.cs" />
<Compile Include="DbMangement\DBConnection.cs" />
<Compile Include="DbMangement\DBServiceFunctions.cs" />
<Compile Include="FileManagement\FileContoler.cs" />
<Compile Include="FileManagement\Ini.cs" />
<Compile Include="Indicators\Bollinger Bands.cs" />
<Compile Include="Indicators\Ichimok cloud.cs" />
<Compile Include="Indicators\Moving average.cs" />
@@ -124,8 +130,9 @@
<Compile Include="SubForm\ChartViewerUI.Designer.cs">
<DependentUpon>ChartViewerUI.cs</DependentUpon>
</Compile>
<Compile Include="WebServices\BitthumbWerServices.cs" />
<Compile Include="WebServices\WebConnection.cs" />
<Compile Include="WebMangement\BitthumbWerServices.cs" />
<Compile Include="WebMangement\WebConnection.cs" />
<Compile Include="WebMangement\WebServiceFunctions.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>

View File

@@ -1,148 +0,0 @@
using System;
using System.IO;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
namespace Million.WebServices
{
public class BitthumbWerServices
{
private string m_sAPI_URL = "https://api.bithumb.com";
private string m_sAPI_Key = "f248c48ba6e8f68a2993e7036aed3d13";
private string m_sAPI_Secret = "75eed1ee3ed5d8b09050e54609767f53";
private string sParams = "order_currency=BTC&payment_currency=KRW";
public BitthumbWerServices(string sAPI_Key = null, string sAPI_Secret = null)
{
if (sAPI_Key != null)
this.m_sAPI_Key = sAPI_Key;
if (sAPI_Secret != null)
this.m_sAPI_Secret = sAPI_Secret;
}
private string ByteToString(byte[] rgbyBuff)
{
string sHexStr = "";
for (int nCnt = 0; nCnt < rgbyBuff.Length; nCnt++)
{
sHexStr += rgbyBuff[nCnt].ToString("x2"); // Hex format
}
return (sHexStr);
}
private byte[] StringToByte(string sStr)
{
byte[] rgbyBuff = Encoding.UTF8.GetBytes(sStr);
return (rgbyBuff);
}
private long MicroSecTime()
{
long nEpochTicks = 0;
long nUnixTimeStamp = 0;
long nNowTicks = 0;
long nowMiliseconds = 0;
string sNonce = "";
DateTime DateTimeNow;
nEpochTicks = new DateTime(1970, 1, 1).Ticks;
//DateTimeNow = new DateTime(2021, 4, 18, 0, 0, 0).ToUniversalTime();
DateTimeNow = DateTime.UtcNow;
nNowTicks = DateTimeNow.Ticks;
nowMiliseconds = DateTimeNow.Millisecond;
nUnixTimeStamp = ((nNowTicks - nEpochTicks) / TimeSpan.TicksPerSecond);
sNonce = nUnixTimeStamp.ToString() + nowMiliseconds.ToString("D03");
return (Convert.ToInt64(sNonce));
}
private string Hash_HMAC(string sKey, string sData)
{
byte[] rgbyKey = Encoding.UTF8.GetBytes(sKey);
using (var hmacsha512 = new HMACSHA512(rgbyKey))
{
hmacsha512.ComputeHash(Encoding.UTF8.GetBytes(sData));
return (ByteToString(hmacsha512.Hash));
}
}
public JObject xcoinApiCall(string sEndPoint, string sParams, ref string sRespBodyData)
{
string sAPI_Sign = "";
string sPostData = sParams;
string sHMAC_Key = "";
string sHMAC_Data = "";
string sResult = "";
long nNonce = 0;
HttpStatusCode nCode = 0;
sPostData += "&endpoint=" + Uri.EscapeDataString(sEndPoint);
try
{
HttpWebRequest Request = (HttpWebRequest)WebRequest.Create(this.m_sAPI_URL + sEndPoint);
byte[] rgbyData = Encoding.ASCII.GetBytes(sPostData);
nNonce = MicroSecTime();
sHMAC_Key = this.m_sAPI_Secret;
sHMAC_Data = sEndPoint + (char)0 + sPostData + (char)0 + nNonce.ToString();
sResult = Hash_HMAC(sHMAC_Key, sHMAC_Data);
sAPI_Sign = Convert.ToBase64String(StringToByte(sResult));
Request.Headers.Add("Api-Key", this.m_sAPI_Key);
Request.Headers.Add("Api-Sign", sAPI_Sign);
Request.Headers.Add("Api-Nonce", nNonce.ToString());
Request.Method = "POST";
Request.ContentType = "application/x-www-form-urlencoded";
Request.ContentLength = rgbyData.Length;
using (var stream = Request.GetRequestStream())
{
stream.Write(rgbyData, 0, rgbyData.Length);
}
var Response = (HttpWebResponse)Request.GetResponse();
sRespBodyData = new StreamReader(Response.GetResponseStream()).ReadToEnd();
return (JObject.Parse(sRespBodyData));
}
catch (WebException webEx)
{
using (HttpWebResponse Response = (HttpWebResponse)webEx.Response)
{
nCode = Response.StatusCode;
using (StreamReader reader = new StreamReader(Response.GetResponseStream()))
{
sRespBodyData = reader.ReadToEnd();
return (JObject.Parse(sRespBodyData));
}
}
}
return (null);
}
}
}

View File

@@ -1,240 +0,0 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.WebSockets;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using System.Security.Cryptography;
using DevExpress.Utils.OAuth;
using DevExpress.XtraEditors.Filtering.Templates;
using Million.Data;
using Newtonsoft.Json;
namespace Million.WebServices
{
public class WebConnection
{
public static object SendWebServer(CommonProperty.ExchangeWebReqType exchangeWebReqType,DateTime dateTime, string postData = "")
{
var returnJsonData = new Dictionary<string, object>();
try
{
HttpWebRequest wReq = null;
// Post 방식인 경우만 사용
var rgbyData = Encoding.ASCII.GetBytes(postData);
// 웹 전송 타입 지정
var webConType = CommonProperty.WebConnectionType.GET;
// 1. WebRequest 객체 형성 및 HttpWebRequest 로 형변환
// 2. 거래소에 따른 헤더 파일 처리(POST 일 경우만 지정함)
switch (exchangeWebReqType)
{
// 빗썸 캔들 데이터
case CommonProperty.ExchangeWebReqType.BithumbCandleStick:
wReq = (HttpWebRequest)WebRequest.Create(new Uri(CommonProperty.BithumbURL_CandleStick));
SetBithumHeader(wReq, "", "", "", "", dateTime);
break;
// 빗썸 종목
case CommonProperty.ExchangeWebReqType.BithumbCoinGoods:
wReq = (HttpWebRequest)WebRequest.Create(new Uri(CommonProperty.BithumbURL_CoinGoods));
break;
case CommonProperty.ExchangeWebReqType.UpbitCoinGoods:
break;
}
// GET, POST 구분
switch (webConType)
{
case CommonProperty.WebConnectionType.GET:
break;
case CommonProperty.WebConnectionType.POST:
wReq.Method = "POST"; // 전송 방법 "GET" or "POST"
using (var stream = wReq.GetRequestStream())
{
stream.Write(rgbyData, 0, rgbyData.Length);
}
wReq.ContentType = "application/x-www-form-urlencoded";
wReq.ContentLength = rgbyData.Length;
break;
}
using (var wRes = (HttpWebResponse)wReq.GetResponse())
{
var respPostStream = wRes.GetResponseStream();
var readerPost = new StreamReader(respPostStream, Encoding.GetEncoding("EUC-KR"), true);
var resResult = readerPost.ReadToEnd();
var resultData = JsonConvert.DeserializeObject<Dictionary<string, object>>(resResult);
// 오류 코드 예외처리
var resultDataList = resultData["status"].ToString().Equals("0000")
? resultData["data"]
: null;
switch (exchangeWebReqType)
{
// 빗썸 캔들 데이터
case CommonProperty.ExchangeWebReqType.BithumbCandleStick:
var candleResultDataList = JsonConvert.DeserializeObject<List<List<string>>>(resultDataList.ToString());
var candleDataList = new CandleDataList();
foreach (var data in candleResultDataList)
{
}
break;
// 빗썸 종목
case CommonProperty.ExchangeWebReqType.BithumbCoinGoods:
var objectList = JsonConvert.DeserializeObject<Dictionary<string,object>>(resultDataList.ToString());
var Payment = objectList["payment_currency"].ToString();
objectList.Remove("payment_currency");
objectList.Remove("timestamp");
var conCoinGoodsDatas = new List<CoinGoodsData>();
foreach (var item in objectList)
{
var tempConin = new CoinGoodsData();
tempConin.CodeName = item.Key;
tempConin.ExchangePlace = CommonProperty.ExchangePlace.Bithumb;
tempConin.KorName = "";
tempConin.Payment = Payment;
conCoinGoodsDatas.Add(tempConin);
}
return conCoinGoodsDatas;
break;
case CommonProperty.ExchangeWebReqType.UpbitCoinGoods:
//objectList = JsonConvert.DeserializeObject<List<List<string>>>(resultDataList.ToString());
break;
}
}
}
catch (WebException webEx)
{
using (var Response = (HttpWebResponse)webEx.Response)
{
var nCode = Response.StatusCode;
using (var reader = new StreamReader(Response.GetResponseStream()))
{
var sRespBodyData = reader.ReadToEnd();
//return (JObject.Parse(sRespBodyData));
}
}
}
return returnJsonData;
}
#region 빗썸 API Key 및 헤더 사용
/// <summary>
/// 빗썸 Request 헤더 데이터 추가
/// </summary>
/// <param name="wReq"></param>
/// <param name="endPoint"> /public/candlestick </param>
/// <param name="sPostData"></param>
/// <param name="sApiSecret"></param>
/// <param name="sApiKey"></param>
/// <param name="dateTime"></param>
/// <returns></returns>
public static HttpWebRequest SetBithumHeader(HttpWebRequest wReq, string sPostData, string endPoint, string sApiSecret, string sApiKey, DateTime dateTime)
{
var sAPI_Sign = "";
var nNonce = MicroSecTime(dateTime);
// POST 데이터인 경우에 Key 값 채움
if (!string.IsNullOrEmpty(sPostData))
{
var sHMAC_Key = sApiSecret;
var sHMAC_Data = endPoint + (char)0 + sPostData + (char)0 + nNonce.ToString();
var sResult = Hash_HMAC(sHMAC_Key, sHMAC_Data);
sAPI_Sign = Convert.ToBase64String(StringToByte(sResult));
}
wReq.Headers.Add("Api-Key", sApiKey);
wReq.Headers.Add("Api-Sign", sAPI_Sign);
wReq.Headers.Add("Api-Nonce", nNonce.ToString());
return wReq;
}
// 바이트 to String 변환
private static string ByteToString(byte[] rgbyBuff)
{
var sHexStr = "";
for (var nCnt = 0; nCnt < rgbyBuff.Length; nCnt++)
{
sHexStr += nCnt.ToString("x2"); // Hex format
}
return (sHexStr);
}
// String to Byte 변환
private static byte[] StringToByte(string sStr)
{
var rgbyBuff = Encoding.UTF8.GetBytes(sStr);
return (rgbyBuff);
}
// 빗썸 DateTime 형식 변환
private static long MicroSecTime(DateTime dateTime)
{
long nEpochTicks = 0;
long nUnixTimeStamp = 0;
long nNowTicks = 0;
long nowMiliseconds = 0;
var sNonce = "";
nEpochTicks = new DateTime(1970, 1, 1).Ticks;
dateTime = dateTime.ToUniversalTime();
nNowTicks = dateTime.Ticks;
nowMiliseconds = dateTime.Millisecond;
nUnixTimeStamp = ((nNowTicks - nEpochTicks) / TimeSpan.TicksPerSecond);
sNonce = nUnixTimeStamp.ToString() + nowMiliseconds.ToString("D03");
return (Convert.ToInt64(sNonce));
}
private static string Hash_HMAC(string sKey, string sData)
{
var rgbyKey = Encoding.UTF8.GetBytes(sKey);
using (var hmacsha512 = new HMACSHA512(rgbyKey))
{
hmacsha512.ComputeHash(Encoding.UTF8.GetBytes(sData));
return (ByteToString(hmacsha512.Hash));
}
}
#endregion
}
}

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="log4net" version="2.0.12" targetFramework="net48" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
</packages>