위와 내용 같음

This commit is contained in:
USER002
2024-05-29 17:37:10 +09:00
parent 01f8a3cae0
commit 3954ad3315
33 changed files with 71445 additions and 62 deletions

View File

@@ -40,7 +40,9 @@
<Reference Include="DevExpress.Utils.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <Reference Include="DevExpress.Utils.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraBars.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <Reference Include="DevExpress.XtraBars.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraEditors.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <Reference Include="DevExpress.XtraEditors.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraGrid.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraLayout.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" /> <Reference Include="DevExpress.XtraLayout.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraTreeList.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" /> <Reference Include="DevExpress.XtraTreeList.v23.2, Version=23.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> <Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath> <HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
@@ -69,6 +71,12 @@
<Compile Include="Data\MarketInfo.cs" /> <Compile Include="Data\MarketInfo.cs" />
<Compile Include="Data\TradeData.cs" /> <Compile Include="Data\TradeData.cs" />
<Compile Include="Data\WebSocketCandle.cs" /> <Compile Include="Data\WebSocketCandle.cs" />
<Compile Include="Data\IndicatorData.cs" />
<Compile Include="IndicatorConditionSetup\IchimokuConditionSetup.cs" />
<Compile Include="IndicatorConditionSetup\MovingAverageConditionSetup.cs" />
<Compile Include="IndicatorData\IchimokData.cs" />
<Compile Include="IndicatorData\IndicatorProcess.cs" />
<Compile Include="IndicatorData\MovingAverageData.cs" />
<Compile Include="MainForm.cs"> <Compile Include="MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -94,6 +102,7 @@
<DependentUpon>Resources.resx</DependentUpon> <DependentUpon>Resources.resx</DependentUpon>
</Compile> </Compile>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Properties\DataSources\BitgetAPI.Data.MarketInfo.datasource" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>

View File

@@ -143,6 +143,30 @@ namespace BitgetAPI
*/ */
} }
// 기준선 설정 (볼린저)
public enum Indicator_BolingerOverLine
{
하향선 = -1,
기준선 = 0,
상향선 = 1
}
// 기준선 설정 (일목)
public enum Indicator_IchmokuOverLine
{
선행스팬1 = 1,
선행스팬2 = 2,
선행스팬1OR2중고가 = 3,
선행스팬1OR2중저가 = 4
}
// 이동평균선 종류
public enum MovingAverageType
{
캔들 = 1,
거래량 = 2
}
#region 업비트 URL #region 업비트 URL
public static string UpbitURL = "https://api.upbit.com/"; public static string UpbitURL = "https://api.upbit.com/";

View File

@@ -1,9 +1,11 @@
using BitgetAPI; using BitgetAPI;
using BitgetAPI.Data.IndicatorData;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms;
namespace BitgetAPI.Data namespace BitgetAPI.Data
{ {
@@ -25,6 +27,10 @@ namespace BitgetAPI.Data
// USDT 거래량 // USDT 거래량
public double Vol_USDT { get; set; } public double Vol_USDT { get; set; }
// 웹소켓 업데이트 기록 여부
public bool WebSocketUpdate { get; set; } = false;
// 웹 서비스 업데이트 기록 여부
public bool WebServiceUpdate { get; set; } = false;
public CandleData() { } public CandleData() { }
public CandleData(DateTime argument, double low, double high, double open, double close, public CandleData(DateTime argument, double low, double high, double open, double close,
@@ -39,5 +45,7 @@ namespace BitgetAPI.Data
this.Vol_USD = vol_USD; this.Vol_USD = vol_USD;
this.Vol_USDT = vol_USDT; this.Vol_USDT = vol_USDT;
} }
public IchimokData IchimokData { get; set; }
} }
} }

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetApi.Data
{
public class IndicatorData
{
}
}

View File

@@ -0,0 +1,101 @@
using BitgetAPI.Data;
using BitgetAPI.Data.IndicatorData;
using DevExpress.Utils.Extensions;
using Million.Data;
using Million.Manager;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetAPI.IndicatorConditionSetup
{
[Serializable]
public class IchimokuConditionSetup
{
// 지표 기본 값 설정
/// <summary>
/// 기준선
/// </summary>
public int BaselinePeriod { get; set; }
/// <summary>
/// 전환선
/// </summary>
public int ConversionPeriod { get; set; }
/// <summary>
/// 선행스팬2
/// </summary>
public int LaggingSpan2Period { get; set; }
/// <summary>
/// Shift
/// </summary>
public int Displacement { get; set; }
// 기준선 설정z
public CommonProperty.Indicator_IchmokuOverLine IndicatorIchmokuOverLine { get; set; }
public void GetIchmokuData(List<CandleData> candleDatas)
{
/*
* 전환선 : (과거 n일간의 최고가 + 과거 n일간의 최저가) / 2
기준선 : (과거 m일간의 최고가 + 과거 m일간의 최저가) / 2
후행스팬 : 금일 종가를 ℓ일 전에 기입
선행스팬1 : (금일 전환선 + 금일 기준선) / 2한 값을 ℓ일 후에 기입
선행스팬2 : (과거 k일간의 최고가 + 과거 k일간의 최저가) /2한 값을 ℓ일 후에 기입
*/
foreach (var data in )
// 현재 시간 캔들
var nowCandle = candleDatas.Last();
// 현재 종가
var endValue = nowCandle.Close;
// 현재 종가 인덱스
var endIndex = candleDatas.Count - 1;
var 한봉전까지Index = endIndex - 1;
// 전봉까지 만듬
var datas = candleDatas.FindAll(i =>
candleDatas.IndexOf(i) >= 한봉전까지Index -ConversionPeriod &&
candleDatas.IndexOf(i) <= 한봉전까지Index);
// Ichimok 없으면 생성
if (nowCandle.IchimokData == null) nowCandle.IchimokData = new IchimokData();
// 전환선
nowCandle.IchimokData.전환선 = (datas.Min(i => i.Low) + datas.Min(i => i.High)) / 2;
datas = candleDatas.FindAll(i =>
candleDatas.IndexOf(i) >= 한봉전까지Index - BaselinePeriod &&
candleDatas.IndexOf(i) <= 한봉전까지Index);
// 기준선
nowCandle.IchimokData.기준선 = (datas.Min(i => i.Low) + datas.Min(i => i.High)) / 2;
// 후행스팬
if (candleDatas.Count - Displacement >= 0)
candleDatas[candleDatas.Count - Displacement].IchimokData.후행스팬 = endValue;
if(Displacement + )
// 선행스팬 1
nowCandle.IchimokData.선행스팬1 =
(nowCandle.IchimokData.전환선 + nowCandle.IchimokData.기준선) / 2
// 선행스팬 2
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetAPI.IndicatorConditionSetup
{
[Serializable]
public class MovingAverageConditionSetup
{
// 지표 기본 값 설정
// 이동 평균선 종류
public CommonProperty.MovingAverageType MovingAverageType { get; set; }
// 기간
public int CandleLegnth { get; set; }
// 가격
public CommonProperty.CandlePriceType MACandlePriceType { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetAPI.Data.IndicatorData
{
[Serializable]
public class IchimokData
{
public double 기준선 = 0;
public double 전환선 = 0;
public double 후행스팬 = 0;
public double 선행스팬1 = 0;
public double 선행스팬2 = 0;
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetAPI.Data
{
public class IndicatorProcess
{
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitgetAPI.Data.IndicatorData
{
[Serializable]
public class MovingAverageData
{
public int period;
}
}

View File

@@ -28,9 +28,12 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container();
this.groupControl_Setting = new DevExpress.XtraEditors.GroupControl(); this.groupControl_Setting = new DevExpress.XtraEditors.GroupControl();
this.progressBarControl_data = new DevExpress.XtraEditors.ProgressBarControl();
this.comboBoxEdit_ConinType = new DevExpress.XtraEditors.ComboBoxEdit(); this.comboBoxEdit_ConinType = new DevExpress.XtraEditors.ComboBoxEdit();
this.comboBoxEdit_ExchangePlace = new DevExpress.XtraEditors.ComboBoxEdit(); this.comboBoxEdit_ExchangePlace = new DevExpress.XtraEditors.ComboBoxEdit();
this.labelControl4 = new DevExpress.XtraEditors.LabelControl();
this.labelControl2 = new DevExpress.XtraEditors.LabelControl(); this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
this.labelControl1 = new DevExpress.XtraEditors.LabelControl(); this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.groupControl_MarketInfo = new DevExpress.XtraEditors.GroupControl(); this.groupControl_MarketInfo = new DevExpress.XtraEditors.GroupControl();
@@ -50,10 +53,21 @@
this.xtraTabPage_Status = new DevExpress.XtraTab.XtraTabPage(); this.xtraTabPage_Status = new DevExpress.XtraTab.XtraTabPage();
this.xtraTabPage_Searcher = new DevExpress.XtraTab.XtraTabPage(); this.xtraTabPage_Searcher = new DevExpress.XtraTab.XtraTabPage();
this.groupControl_SignalSeacher = new DevExpress.XtraEditors.GroupControl(); this.groupControl_SignalSeacher = new DevExpress.XtraEditors.GroupControl();
this.marketInfoBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.treeListColumn1 = new DevExpress.XtraTreeList.Columns.TreeListColumn();
this.groupControl_SearcherCondition = new DevExpress.XtraEditors.GroupControl(); this.groupControl_SearcherCondition = new DevExpress.XtraEditors.GroupControl();
this.checkedComboBoxEdit_MarketInfoList = new DevExpress.XtraEditors.CheckedComboBoxEdit(); this.checkedComboBoxEdit_MarketInfoList = new DevExpress.XtraEditors.CheckedComboBoxEdit();
this.popupMenu_marketInfo = new DevExpress.XtraBars.PopupMenu(this.components);
this.labelControl5 = new DevExpress.XtraEditors.LabelControl();
this.labelControl6 = new DevExpress.XtraEditors.LabelControl();
this.checkedComboBoxEdit1 = new DevExpress.XtraEditors.CheckedComboBoxEdit();
this.checkEdit_ichmokuUp = new DevExpress.XtraEditors.CheckEdit();
this.checkEdit_IchmokuDown = new DevExpress.XtraEditors.CheckEdit();
this.groupControl1 = new DevExpress.XtraEditors.GroupControl();
this.groupControl2 = new DevExpress.XtraEditors.GroupControl();
((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).BeginInit();
this.groupControl_Setting.SuspendLayout(); this.groupControl_Setting.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.progressBarControl_data.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ConinType.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ConinType.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).BeginInit();
@@ -64,25 +78,44 @@
this.xtraTabPage_Status.SuspendLayout(); this.xtraTabPage_Status.SuspendLayout();
this.xtraTabPage_Searcher.SuspendLayout(); this.xtraTabPage_Searcher.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.groupControl_SignalSeacher)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_SignalSeacher)).BeginInit();
this.groupControl_SignalSeacher.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.marketInfoBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_SearcherCondition)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_SearcherCondition)).BeginInit();
this.groupControl_SearcherCondition.SuspendLayout(); this.groupControl_SearcherCondition.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.popupMenu_marketInfo)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit1.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkEdit_ichmokuUp.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.checkEdit_IchmokuDown.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl2)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupControl_Setting // groupControl_Setting
// //
this.groupControl_Setting.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.groupControl_Setting.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupControl_Setting.Controls.Add(this.progressBarControl_data);
this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ConinType); this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ConinType);
this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ExchangePlace); this.groupControl_Setting.Controls.Add(this.comboBoxEdit_ExchangePlace);
this.groupControl_Setting.Controls.Add(this.labelControl4);
this.groupControl_Setting.Controls.Add(this.labelControl2); this.groupControl_Setting.Controls.Add(this.labelControl2);
this.groupControl_Setting.Controls.Add(this.labelControl1); this.groupControl_Setting.Controls.Add(this.labelControl1);
this.groupControl_Setting.Location = new System.Drawing.Point(3, 2); this.groupControl_Setting.Location = new System.Drawing.Point(3, 2);
this.groupControl_Setting.Name = "groupControl_Setting"; this.groupControl_Setting.Name = "groupControl_Setting";
this.groupControl_Setting.Size = new System.Drawing.Size(907, 75); this.groupControl_Setting.Size = new System.Drawing.Size(842, 75);
this.groupControl_Setting.TabIndex = 0; this.groupControl_Setting.TabIndex = 0;
this.groupControl_Setting.Text = "초기 설정"; this.groupControl_Setting.Text = "초기 설정";
// //
// progressBarControl_data
//
this.progressBarControl_data.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.progressBarControl_data.Location = new System.Drawing.Point(637, 43);
this.progressBarControl_data.Name = "progressBarControl_data";
this.progressBarControl_data.Properties.ShowTitle = true;
this.progressBarControl_data.Size = new System.Drawing.Size(200, 18);
this.progressBarControl_data.TabIndex = 2;
//
// comboBoxEdit_ConinType // comboBoxEdit_ConinType
// //
this.comboBoxEdit_ConinType.Location = new System.Drawing.Point(248, 41); this.comboBoxEdit_ConinType.Location = new System.Drawing.Point(248, 41);
@@ -105,6 +138,15 @@
this.comboBoxEdit_ExchangePlace.TabIndex = 1; this.comboBoxEdit_ExchangePlace.TabIndex = 1;
this.comboBoxEdit_ExchangePlace.SelectedIndexChanged += new System.EventHandler(this.comboBox_ExchangePlace_SelectedIndexChanged); this.comboBoxEdit_ExchangePlace.SelectedIndexChanged += new System.EventHandler(this.comboBox_ExchangePlace_SelectedIndexChanged);
// //
// labelControl4
//
this.labelControl4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.labelControl4.Location = new System.Drawing.Point(543, 44);
this.labelControl4.Name = "labelControl4";
this.labelControl4.Size = new System.Drawing.Size(88, 14);
this.labelControl4.TabIndex = 0;
this.labelControl4.Text = "검색기 데이터 구성";
//
// labelControl2 // labelControl2
// //
this.labelControl2.Location = new System.Drawing.Point(186, 44); this.labelControl2.Location = new System.Drawing.Point(186, 44);
@@ -251,7 +293,7 @@
this.xtraTabControl_Main.Location = new System.Drawing.Point(3, 83); this.xtraTabControl_Main.Location = new System.Drawing.Point(3, 83);
this.xtraTabControl_Main.Name = "xtraTabControl_Main"; this.xtraTabControl_Main.Name = "xtraTabControl_Main";
this.xtraTabControl_Main.SelectedTabPage = this.xtraTabPage_Status; this.xtraTabControl_Main.SelectedTabPage = this.xtraTabPage_Status;
this.xtraTabControl_Main.Size = new System.Drawing.Size(907, 456); this.xtraTabControl_Main.Size = new System.Drawing.Size(842, 396);
this.xtraTabControl_Main.TabIndex = 2; this.xtraTabControl_Main.TabIndex = 2;
this.xtraTabControl_Main.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] { this.xtraTabControl_Main.TabPages.AddRange(new DevExpress.XtraTab.XtraTabPage[] {
this.xtraTabPage_Status, this.xtraTabPage_Status,
@@ -269,51 +311,141 @@
this.xtraTabPage_Searcher.Controls.Add(this.groupControl_SignalSeacher); this.xtraTabPage_Searcher.Controls.Add(this.groupControl_SignalSeacher);
this.xtraTabPage_Searcher.Controls.Add(this.groupControl_SearcherCondition); this.xtraTabPage_Searcher.Controls.Add(this.groupControl_SearcherCondition);
this.xtraTabPage_Searcher.Name = "xtraTabPage_Searcher"; this.xtraTabPage_Searcher.Name = "xtraTabPage_Searcher";
this.xtraTabPage_Searcher.Size = new System.Drawing.Size(910, 428); this.xtraTabPage_Searcher.PageEnabled = false;
this.xtraTabPage_Searcher.Size = new System.Drawing.Size(840, 370);
this.xtraTabPage_Searcher.Text = "검색기"; this.xtraTabPage_Searcher.Text = "검색기";
// //
// groupControl_SignalSeacher // groupControl_SignalSeacher
// //
this.groupControl_SignalSeacher.Controls.Add(this.groupControl2);
this.groupControl_SignalSeacher.Controls.Add(this.groupControl1);
this.groupControl_SignalSeacher.Dock = System.Windows.Forms.DockStyle.Fill; this.groupControl_SignalSeacher.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupControl_SignalSeacher.Location = new System.Drawing.Point(0, 100); this.groupControl_SignalSeacher.Location = new System.Drawing.Point(0, 85);
this.groupControl_SignalSeacher.Name = "groupControl_SignalSeacher"; this.groupControl_SignalSeacher.Name = "groupControl_SignalSeacher";
this.groupControl_SignalSeacher.Size = new System.Drawing.Size(910, 328); this.groupControl_SignalSeacher.Size = new System.Drawing.Size(840, 285);
this.groupControl_SignalSeacher.TabIndex = 1; this.groupControl_SignalSeacher.TabIndex = 1;
this.groupControl_SignalSeacher.Text = "신호 검색"; this.groupControl_SignalSeacher.Text = "신호 검색";
// //
// marketInfoBindingSource
//
this.marketInfoBindingSource.DataSource = typeof(BitgetAPI.Data.MarketInfo);
//
// treeListColumn1
//
this.treeListColumn1.Caption = "treeListColumn1";
this.treeListColumn1.Name = "treeListColumn1";
this.treeListColumn1.Visible = true;
this.treeListColumn1.VisibleIndex = 0;
//
// groupControl_SearcherCondition // groupControl_SearcherCondition
// //
this.groupControl_SearcherCondition.Controls.Add(this.checkEdit_IchmokuDown);
this.groupControl_SearcherCondition.Controls.Add(this.checkEdit_ichmokuUp);
this.groupControl_SearcherCondition.Controls.Add(this.labelControl6);
this.groupControl_SearcherCondition.Controls.Add(this.labelControl5);
this.groupControl_SearcherCondition.Controls.Add(this.checkedComboBoxEdit1);
this.groupControl_SearcherCondition.Controls.Add(this.checkedComboBoxEdit_MarketInfoList); this.groupControl_SearcherCondition.Controls.Add(this.checkedComboBoxEdit_MarketInfoList);
this.groupControl_SearcherCondition.Dock = System.Windows.Forms.DockStyle.Top; this.groupControl_SearcherCondition.Dock = System.Windows.Forms.DockStyle.Top;
this.groupControl_SearcherCondition.Location = new System.Drawing.Point(0, 0); this.groupControl_SearcherCondition.Location = new System.Drawing.Point(0, 0);
this.groupControl_SearcherCondition.Name = "groupControl_SearcherCondition"; this.groupControl_SearcherCondition.Name = "groupControl_SearcherCondition";
this.groupControl_SearcherCondition.Size = new System.Drawing.Size(910, 100); this.groupControl_SearcherCondition.Size = new System.Drawing.Size(840, 85);
this.groupControl_SearcherCondition.TabIndex = 0; this.groupControl_SearcherCondition.TabIndex = 0;
this.groupControl_SearcherCondition.Text = "조건 설정"; this.groupControl_SearcherCondition.Text = "조건 설정";
// //
// checkedComboBoxEdit_MarketInfoList // checkedComboBoxEdit_MarketInfoList
// //
this.checkedComboBoxEdit_MarketInfoList.Location = new System.Drawing.Point(17, 52); this.checkedComboBoxEdit_MarketInfoList.Location = new System.Drawing.Point(65, 26);
this.checkedComboBoxEdit_MarketInfoList.Name = "checkedComboBoxEdit_MarketInfoList"; this.checkedComboBoxEdit_MarketInfoList.Name = "checkedComboBoxEdit_MarketInfoList";
this.checkedComboBoxEdit_MarketInfoList.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] { this.checkedComboBoxEdit_MarketInfoList.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}); new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.checkedComboBoxEdit_MarketInfoList.Properties.IncrementalSearch = true; this.checkedComboBoxEdit_MarketInfoList.Properties.IncrementalSearch = true;
this.checkedComboBoxEdit_MarketInfoList.Size = new System.Drawing.Size(129, 20); this.checkedComboBoxEdit_MarketInfoList.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
this.checkedComboBoxEdit_MarketInfoList.Size = new System.Drawing.Size(547, 20);
this.checkedComboBoxEdit_MarketInfoList.TabIndex = 0; this.checkedComboBoxEdit_MarketInfoList.TabIndex = 0;
// //
// popupMenu_marketInfo
//
this.popupMenu_marketInfo.Name = "popupMenu_marketInfo";
//
// labelControl5
//
this.labelControl5.Location = new System.Drawing.Point(9, 29);
this.labelControl5.Name = "labelControl5";
this.labelControl5.Size = new System.Drawing.Size(56, 14);
this.labelControl5.TabIndex = 1;
this.labelControl5.Text = "종목 선택 : ";
//
// labelControl6
//
this.labelControl6.Location = new System.Drawing.Point(9, 52);
this.labelControl6.Name = "labelControl6";
this.labelControl6.Size = new System.Drawing.Size(56, 14);
this.labelControl6.TabIndex = 1;
this.labelControl6.Text = "분봉 선택 : ";
//
// checkedComboBoxEdit1
//
this.checkedComboBoxEdit1.Location = new System.Drawing.Point(65, 49);
this.checkedComboBoxEdit1.Name = "checkedComboBoxEdit1";
this.checkedComboBoxEdit1.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.checkedComboBoxEdit1.Properties.IncrementalSearch = true;
this.checkedComboBoxEdit1.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;
this.checkedComboBoxEdit1.Size = new System.Drawing.Size(547, 20);
this.checkedComboBoxEdit1.TabIndex = 0;
//
// checkEdit_ichmokuUp
//
this.checkEdit_ichmokuUp.Location = new System.Drawing.Point(636, 26);
this.checkEdit_ichmokuUp.Name = "checkEdit_ichmokuUp";
this.checkEdit_ichmokuUp.Properties.Caption = "구름떼 돌파";
this.checkEdit_ichmokuUp.Size = new System.Drawing.Size(102, 20);
this.checkEdit_ichmokuUp.TabIndex = 2;
//
// checkEdit_IchmokuDown
//
this.checkEdit_IchmokuDown.Location = new System.Drawing.Point(636, 45);
this.checkEdit_IchmokuDown.Name = "checkEdit_IchmokuDown";
this.checkEdit_IchmokuDown.Properties.Caption = "구름떼 하락";
this.checkEdit_IchmokuDown.Size = new System.Drawing.Size(102, 20);
this.checkEdit_IchmokuDown.TabIndex = 2;
//
// groupControl1
//
this.groupControl1.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.groupControl1.Location = new System.Drawing.Point(436, 26);
this.groupControl1.Name = "groupControl1";
this.groupControl1.Size = new System.Drawing.Size(401, 256);
this.groupControl1.TabIndex = 0;
this.groupControl1.Text = "관심 및 매수종목";
//
// groupControl2
//
this.groupControl2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.groupControl2.Location = new System.Drawing.Point(3, 26);
this.groupControl2.Name = "groupControl2";
this.groupControl2.Size = new System.Drawing.Size(427, 256);
this.groupControl2.TabIndex = 0;
this.groupControl2.Text = "검색 현황";
//
// MainForm // MainForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(911, 544); this.ClientSize = new System.Drawing.Size(846, 484);
this.Controls.Add(this.xtraTabControl_Main); this.Controls.Add(this.xtraTabControl_Main);
this.Controls.Add(this.groupControl_Setting); this.Controls.Add(this.groupControl_Setting);
this.MinimumSize = new System.Drawing.Size(719, 303);
this.Name = "MainForm"; this.Name = "MainForm";
this.Text = "Searcher"; this.Text = "Searcher";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_Setting)).EndInit();
this.groupControl_Setting.ResumeLayout(false); this.groupControl_Setting.ResumeLayout(false);
this.groupControl_Setting.PerformLayout(); this.groupControl_Setting.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.progressBarControl_data.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ConinType.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ConinType.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.comboBoxEdit_ExchangePlace.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_MarketInfo)).EndInit();
@@ -325,9 +457,18 @@
this.xtraTabPage_Status.ResumeLayout(false); this.xtraTabPage_Status.ResumeLayout(false);
this.xtraTabPage_Searcher.ResumeLayout(false); this.xtraTabPage_Searcher.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.groupControl_SignalSeacher)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_SignalSeacher)).EndInit();
this.groupControl_SignalSeacher.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.marketInfoBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl_SearcherCondition)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.groupControl_SearcherCondition)).EndInit();
this.groupControl_SearcherCondition.ResumeLayout(false); this.groupControl_SearcherCondition.ResumeLayout(false);
this.groupControl_SearcherCondition.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit_MarketInfoList.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.popupMenu_marketInfo)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkedComboBoxEdit1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkEdit_ichmokuUp.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.checkEdit_IchmokuDown.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.groupControl2)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
} }
@@ -358,6 +499,18 @@
private DevExpress.XtraEditors.GroupControl groupControl_SignalSeacher; private DevExpress.XtraEditors.GroupControl groupControl_SignalSeacher;
private DevExpress.XtraEditors.GroupControl groupControl_SearcherCondition; private DevExpress.XtraEditors.GroupControl groupControl_SearcherCondition;
private DevExpress.XtraEditors.CheckedComboBoxEdit checkedComboBoxEdit_MarketInfoList; private DevExpress.XtraEditors.CheckedComboBoxEdit checkedComboBoxEdit_MarketInfoList;
private DevExpress.XtraEditors.ProgressBarControl progressBarControl_data;
private DevExpress.XtraEditors.LabelControl labelControl4;
private DevExpress.XtraBars.PopupMenu popupMenu_marketInfo;
private System.Windows.Forms.BindingSource marketInfoBindingSource;
private DevExpress.XtraTreeList.Columns.TreeListColumn treeListColumn1;
private DevExpress.XtraEditors.GroupControl groupControl2;
private DevExpress.XtraEditors.GroupControl groupControl1;
private DevExpress.XtraEditors.CheckEdit checkEdit_IchmokuDown;
private DevExpress.XtraEditors.CheckEdit checkEdit_ichmokuUp;
private DevExpress.XtraEditors.LabelControl labelControl6;
private DevExpress.XtraEditors.LabelControl labelControl5;
private DevExpress.XtraEditors.CheckedComboBoxEdit checkedComboBoxEdit1;
} }
} }

View File

@@ -1,5 +1,6 @@
using BitgetAPI.Data; using BitgetAPI.Data;
using BitgetAPI.WebService; using BitgetAPI.WebService;
using DevExpress.Utils.MVVM;
using DevExpress.XtraEditors; using DevExpress.XtraEditors;
using Newtonsoft.Json; using Newtonsoft.Json;
using System; using System;
@@ -28,6 +29,8 @@ namespace BitgetAPI
Thread treeListMarketInfoListUpdateTimer = null; Thread treeListMarketInfoListUpdateTimer = null;
// 현황판 웹소켓 스레드 // 현황판 웹소켓 스레드
Thread th_MarketStatus = null; Thread th_MarketStatus = null;
// WebSocket 내 스레드 관리
List<Thread> webSocketThreadList = new List<Thread>();
// 종목별 캔들 데이터 스레드 // 종목별 캔들 데이터 스레드
Thread th_MarketCandeData = null; Thread th_MarketCandeData = null;
@@ -79,30 +82,55 @@ namespace BitgetAPI
} }
// 웹소켓 생성 관련 함수 스레드 => Thread
private async void ThreadEventAsync(BitgetWebSocketType bitgetWebSocketType, string channel) private async void ThreadEventAsync(BitgetWebSocketType bitgetWebSocketType, string channel)
{ {
// WebSocket 생성 // WebSocket 생성
var webConnection = new WebConnection(); WebConnection webConnection = new WebConnection();
webConnection.BitGetWebSocektStart(bitgetWebSocketType, channel); webConnection.BitGetWebSocektStart(bitgetWebSocketType, channel);
Invoke(new MethodInvoker(delegate ()
{
// WebSocket 내 스레드 관리
webSocketThreadList.Add(webConnection.th_PingTimer);
}));
} }
// 마켓 현황판 업데이트 (1) => Thread
// 지표 생성 및 신호 검색 (2)
private void TreeListMarketInfoListUpdate( ) private void TreeListMarketInfoListUpdate( )
{ {
// 마켓 현황판 업데이트
while(true) while(true)
{ {
Thread.Sleep(300); Thread.Sleep(300);
Invoke(new MethodInvoker(delegate () Invoke(new MethodInvoker(delegate ()
{ {
var scrollPoint = treeList_MarketInfo.TopVisibleNodeIndex;
treeList_MarketInfo.RefreshDataSource(); treeList_MarketInfo.RefreshDataSource();
treeList_MarketInfo.ClearSelection(); treeList_MarketInfo.ClearSelection();
treeList_MarketInfo.TopVisibleNodeIndex = scrollPoint;
})); }));
} }
// 지표생성 및 신호 검색
} }
// 종목별 캔들데이터 가져오기 (초기 설정) // 종목별 캔들데이터 가져오기 (초기 설정) => Thread
private void getMarketCandleData_WebService(ExchangeWebReqType exchangeWebReqType) private void getMarketCandleData_WebService(ExchangeWebReqType exchangeWebReqType)
{ {
// 프로그레스 바
progressBarControl_data.Properties.Minimum = 0;
progressBarControl_data.Properties.Maximum = commonProperty.candleDataLists.Count;
progressBarControl_data.Properties.Step = 1;
progressBarControl_data.EditValue = 0;
var progressCnt = 0;
// WebServicee 초기 캔들 데이터 가져오기 : 종목, 개수 // WebServicee 초기 캔들 데이터 가져오기 : 종목, 개수
foreach (var marketCandleDataList in commonProperty.candleDataLists) foreach (var marketCandleDataList in commonProperty.candleDataLists)
{ {
@@ -152,8 +180,25 @@ namespace BitgetAPI
// Thread.Sleep(50); // Thread.Sleep(50);
var candleList = BitgetAPI.WebService.WebConnection.SendWebServer(exchangeWebReqType, url, marketCandleDataList, (CommonProperty.MCandleTimeType) interval); var candleList = BitgetAPI.WebService.WebConnection.SendWebServer(exchangeWebReqType, url, marketCandleDataList, (CommonProperty.MCandleTimeType) interval);
} }
break;
// 프로그레스 바
progressCnt++;
Invoke(new MethodInvoker(delegate ()
{
progressBarControl_data.EditValue = progressCnt;
progressBarControl_data.PerformStep();
progressBarControl_data.Update();
xtraTabPage_Searcher.PageEnabled = true;
xtraTabControl_Main.SelectedTabPage = xtraTabPage_Searcher;
}));
} }
Invoke(new MethodInvoker(delegate ()
{
xtraTabPage_Searcher.PageEnabled = true;
xtraTabControl_Main.SelectedTabPage = xtraTabPage_Searcher;
}));
} }
// 거래소 콤보박스 클릭 시 이벤트 처리 // 거래소 콤보박스 클릭 시 이벤트 처리
@@ -223,7 +268,6 @@ namespace BitgetAPI
foreach (var item in commonProperty.candleDataLists) foreach (var item in commonProperty.candleDataLists)
checkedComboBoxEdit_MarketInfoList.Properties.Items.Add(item.ConGoodsData.MarketName); checkedComboBoxEdit_MarketInfoList.Properties.Items.Add(item.ConGoodsData.MarketName);
commonProperty.webSocketCandles = new List<BitgetApi.Data.WebSocketTickerInfo>(); commonProperty.webSocketCandles = new List<BitgetApi.Data.WebSocketTickerInfo>();
#region 캔들 웹소켓 : 종목 50, 캔들 1 개만 해도 뒤지려고 함 !! (일딴 패스) #region 캔들 웹소켓 : 종목 50, 캔들 1 개만 해도 뒤지려고 함 !! (일딴 패스)
@@ -258,6 +302,22 @@ namespace BitgetAPI
treeListMarketInfoListUpdateTimer.Abort(); treeListMarketInfoListUpdateTimer.Abort();
treeListMarketInfoListUpdateTimer = null; treeListMarketInfoListUpdateTimer = null;
} }
if (th_MarketCandeData != null)
{
th_MarketCandeData.Abort();
th_MarketCandeData = null;
}
for(var cnt = 0; cnt < webSocketThreadList.Count; cnt++)
{
if(webSocketThreadList[cnt] != null && webSocketThreadList[cnt].ThreadState != ThreadState.Running)
{
webSocketThreadList[cnt].Abort();
webSocketThreadList[cnt] = null;
}
}
} }
} }
} }

View File

@@ -117,4 +117,10 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="marketInfoBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>200, 17</value>
</metadata>
<metadata name="popupMenu_marketInfo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="MarketInfo" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>BitgetAPI.Data.MarketInfo, BitgetApi, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@@ -21,6 +21,8 @@ namespace BitgetAPI.WebService
{ {
public class WebConnection public class WebConnection
{ {
public Thread th_PingTimer {get; set;} = null;
public static object SendWebServer(CommonProperty.ExchangeWebReqType exchangeWebReqType, string url = "", public static object SendWebServer(CommonProperty.ExchangeWebReqType exchangeWebReqType, string url = "",
MarketCandleDataList marketCandleDataList = null, CommonProperty.MCandleTimeType interval = MCandleTimeType.M1, MarketCandleDataList marketCandleDataList = null, CommonProperty.MCandleTimeType interval = MCandleTimeType.M1,
string postData = "", string subUri = "") string postData = "", string subUri = "")
@@ -147,21 +149,29 @@ namespace BitgetAPI.WebService
candleData.Vol_USD = Convert.ToDouble(item[6]); candleData.Vol_USD = Convert.ToDouble(item[6]);
// 같은 시간이 존재하면 업데이트 : 1개밖에 없음 // 같은 시간이 존재하면 업데이트 : 1개밖에 없음
var sameCandleData = candleDataList.Find(i => i.Argument.Minute == candleData.Argument.Minute && var sameCandleData_WebService = candleDataList.Find(i => i.Argument.Minute == candleData.Argument.Minute &&
i.Argument.Hour == candleData.Argument.Hour); i.Argument.Hour == candleData.Argument.Hour && i.WebSocketUpdate == true);
if (sameCandleData != null) // 기존 웹소켓으로 부터 받은 데이터에 수정 등록
if (sameCandleData_WebService != null)
{ {
// 종가 => 웹소켓 데이터 사용 (웹 서비스 호출 데이터 중 마지막 데이터는 캔들이 완성되지 않음) // 종가 => 웹소켓 데이터 사용 (웹 서비스 호출 데이터 중 마지막 데이터는 캔들이 완성되지 않음)
// 시가 => 웹 서비스 데이터 사용 // 시가 => 웹 서비스 데이터 사용
sameCandleData.Open = candleData.Open; sameCandleData_WebService.Open = candleData.Open;
// 저가, 고가 => 비교해서 사용 // 저가, 고가 => 비교해서 사용
sameCandleData.Low = Math.Min(sameCandleData.Low, candleData.Low); sameCandleData_WebService.Low = Math.Min(sameCandleData_WebService.Low, candleData.Low);
sameCandleData.High = Math.Max(sameCandleData.High, candleData.High); sameCandleData_WebService.High = Math.Max(sameCandleData_WebService.High, candleData.High);
}
}
return candleDatas; sameCandleData_WebService.WebServiceUpdate = true;
}
// 웹 서비스로 받은 데이터를 새로 추가
else
{
candleDataList.Add(candleData);
candleData.WebServiceUpdate = true;
}
}
} }
break; break;
#endregion #endregion
@@ -211,9 +221,9 @@ namespace BitgetAPI.WebService
string WebSocketUrl = "wss://ws.bitget.com/v2/ws/public"; string WebSocketUrl = "wss://ws.bitget.com/v2/ws/public";
string message = ""; string message = "";
var tempStrData = ""; var tempStrData = "";
try try
{ {
await webSocket.ConnectAsync(new Uri(WebSocketUrl), CancellationToken.None); await webSocket.ConnectAsync(new Uri(WebSocketUrl), CancellationToken.None);
// 연결이 성공적으로 이루어지면 처리할 코드 작성 // 연결이 성공적으로 이루어지면 처리할 코드 작성
Console.WriteLine("WebSocket 연결 성공"); Console.WriteLine("WebSocket 연결 성공");
@@ -240,12 +250,9 @@ namespace BitgetAPI.WebService
var jsonData = JsonConvert.SerializeObject(dic); var jsonData = JsonConvert.SerializeObject(dic);
//await SendMessage(webSocket, jsonData);
// Ping 유지용 (25초) // Ping 유지용 (25초)
var pingTimer = new Thread(() => ContinuePing(webSocket)); th_PingTimer = new Thread(() => ContinuePing(webSocket));
pingTimer.Start(); th_PingTimer.Start();
await SendMessage(webSocket, jsonData); await SendMessage(webSocket, jsonData);
@@ -313,8 +320,10 @@ namespace BitgetAPI.WebService
candleDataList.Add(candleData); candleDataList.Add(candleData);
else else
{ {
var lastCandleData_Edit = candleDataList.ToList();
// 마지막 시간 데이터 가져오기 // 마지막 시간 데이터 가져오기
var lastCandleData = candleDataList.Find(j=>j.Argument == candleDataList.Max(i => i.Argument)); var lastCandleData = lastCandleData_Edit.Find(j=>j.Argument == lastCandleData_Edit.Max(i => i.Argument));
// 업데이트 or 추가 // 업데이트 or 추가
bool updateFlag = true; bool updateFlag = true;
@@ -372,6 +381,8 @@ namespace BitgetAPI.WebService
if(lastCandleData.Low == 0 || lastCandleData.Low > candleData.Close) lastCandleData.Low = candleData.Close; if(lastCandleData.Low == 0 || lastCandleData.Low > candleData.Close) lastCandleData.Low = candleData.Close;
// 고가 등록 // 고가 등록
if (lastCandleData.High == 0 || lastCandleData.High < candleData.Close) lastCandleData.High = candleData.Close; if (lastCandleData.High == 0 || lastCandleData.High < candleData.Close) lastCandleData.High = candleData.Close;
lastCandleData.WebSocketUpdate = true;
} }
// 없는 경우 추가 // 없는 경우 추가
else else
@@ -379,9 +390,11 @@ namespace BitgetAPI.WebService
// 새 데이터 등록 // 새 데이터 등록
candleDataList.Add(candleData); candleDataList.Add(candleData);
// 시가 등록 // 1분 이상 Ticker가 없는 겨우는 Open 가만 가격이 등록됨
candleData.Open = candleData.Close; candleData.Open = candleData.Close;
candleData.WebSocketUpdate = true;
// 기존 데이터 삭제 // 기존 데이터 삭제
if (candleDataList.Count > 250) if (candleDataList.Count > 250)
{ {
@@ -500,35 +513,9 @@ namespace BitgetAPI.WebService
break; break;
} }
//var sendTime = dt.AddMilliseconds(Convert.ToDouble(datalist["ts"])).ToLocalTime();
// Candle 리스트에 데이터 쌓기
//var marketCandleList = commonProperty.candleDataLists.Find(i => i.ConGoodsData.MarketName == candleInfo[0]["instId"].ToString());
// 분 업데이트 (1,3,5,10,15,30)
//if(recieveTime.Second == 0)
{
}
// 시 업데이트 (1,4,6)
//if(recieveTime.Minute == 0)
{
}
//else
{
}
} }
// 요청시간
// Candle 시간
} }
} }
catch (Exception ex) catch (Exception ex)
@@ -539,13 +526,15 @@ namespace BitgetAPI.WebService
{ {
if (webSocket.State == WebSocketState.Open) if (webSocket.State == WebSocketState.Open)
await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "WebSocket 연결 종료", CancellationToken.None); await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "WebSocket 연결 종료", CancellationToken.None);
webSocket.Dispose(); webSocket.Dispose();
// 웹소켓 재귀
BitGetWebSocektStart(bitgetWebSocketType, chnnelType);
} }
} }
// Ping 테스트 (25초), 30초에 한번 응답 확인 필요 // Ping 테스트 (25초), 30초에 한번 응답 확인 필요
private async void ContinuePing(ClientWebSocket webSocket) public static async void ContinuePing(ClientWebSocket webSocket)
{ {
while(true) while(true)
{ {
@@ -556,9 +545,15 @@ namespace BitgetAPI.WebService
private static async Task SendMessage(ClientWebSocket webSocket, string message) private static async Task SendMessage(ClientWebSocket webSocket, string message)
{ {
byte[] buffer = Encoding.UTF8.GetBytes(message); try
await webSocket.SendAsync(new ArraySegment<byte>(buffer), WebSocketMessageType.Text, true, CancellationToken.None); {
Console.WriteLine("메시지 전송: " + message); byte[] buffer = Encoding.UTF8.GetBytes(message);
await webSocket.SendAsync(new ArraySegment<byte>(buffer), WebSocketMessageType.Text, true, CancellationToken.None);
Console.WriteLine("메시지 전송: " + message);
} catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
} }
public static bool ValidateJSON(string s) public static bool ValidateJSON(string s)

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
de2376a28837696d492ad849cb9354ad9b1cfb55d6706aec738e85235278bf1a 2a1b4762b86e802d55729f9ff5ca25418e53343c37d5ee19f15302eefed13697

View File

@@ -72,3 +72,11 @@ D:\Project\BitGet_API\BitgetApi\obj\Debug\BitgetApi.exe
D:\Project\BitGet_API\BitgetApi\obj\Debug\BitgetApi.pdb D:\Project\BitGet_API\BitgetApi\obj\Debug\BitgetApi.pdb
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraBars.v23.2.dll D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraBars.v23.2.dll
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraBars.v23.2.xml D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraBars.v23.2.xml
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraGrid.v23.2.dll
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraPrinting.v23.2.dll
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.RichEdit.v23.2.Core.dll
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.Office.v23.2.Core.dll
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraGrid.v23.2.xml
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.XtraPrinting.v23.2.xml
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.RichEdit.v23.2.Core.xml
D:\Project\BitGet_API\BitgetApi\bin\Debug\DevExpress.Office.v23.2.Core.xml

Binary file not shown.

Binary file not shown.