위와 내용 같음
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using BitgetAPI.Data;
|
||||
using BitgetAPI.WebService;
|
||||
using DevExpress.Utils.MVVM;
|
||||
using DevExpress.XtraEditors;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
@@ -28,6 +29,8 @@ namespace BitgetAPI
|
||||
Thread treeListMarketInfoListUpdateTimer = null;
|
||||
// 현황판 웹소켓 스레드
|
||||
Thread th_MarketStatus = null;
|
||||
// WebSocket 내 스레드 관리
|
||||
List<Thread> webSocketThreadList = new List<Thread>();
|
||||
// 종목별 캔들 데이터 스레드
|
||||
Thread th_MarketCandeData = null;
|
||||
|
||||
@@ -79,30 +82,55 @@ namespace BitgetAPI
|
||||
|
||||
}
|
||||
|
||||
// 웹소켓 생성 관련 함수 스레드 => Thread
|
||||
private async void ThreadEventAsync(BitgetWebSocketType bitgetWebSocketType, string channel)
|
||||
{
|
||||
// WebSocket 생성
|
||||
var webConnection = new WebConnection();
|
||||
WebConnection webConnection = new WebConnection();
|
||||
|
||||
webConnection.BitGetWebSocektStart(bitgetWebSocketType, channel);
|
||||
|
||||
Invoke(new MethodInvoker(delegate ()
|
||||
{
|
||||
// WebSocket 내 스레드 관리
|
||||
webSocketThreadList.Add(webConnection.th_PingTimer);
|
||||
}));
|
||||
}
|
||||
|
||||
// 마켓 현황판 업데이트 (1) => Thread
|
||||
// 지표 생성 및 신호 검색 (2)
|
||||
private void TreeListMarketInfoListUpdate( )
|
||||
{
|
||||
// 마켓 현황판 업데이트
|
||||
while(true)
|
||||
{
|
||||
Thread.Sleep(300);
|
||||
|
||||
Invoke(new MethodInvoker(delegate ()
|
||||
{
|
||||
var scrollPoint = treeList_MarketInfo.TopVisibleNodeIndex;
|
||||
treeList_MarketInfo.RefreshDataSource();
|
||||
treeList_MarketInfo.ClearSelection();
|
||||
|
||||
treeList_MarketInfo.TopVisibleNodeIndex = scrollPoint;
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
// 지표생성 및 신호 검색
|
||||
}
|
||||
|
||||
// 종목별 캔들데이터 가져오기 (초기 설정)
|
||||
// 종목별 캔들데이터 가져오기 (초기 설정) => Thread
|
||||
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 초기 캔들 데이터 가져오기 : 종목, 개수
|
||||
foreach (var marketCandleDataList in commonProperty.candleDataLists)
|
||||
{
|
||||
@@ -152,8 +180,25 @@ namespace BitgetAPI
|
||||
// Thread.Sleep(50);
|
||||
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)
|
||||
checkedComboBoxEdit_MarketInfoList.Properties.Items.Add(item.ConGoodsData.MarketName);
|
||||
|
||||
|
||||
commonProperty.webSocketCandles = new List<BitgetApi.Data.WebSocketTickerInfo>();
|
||||
|
||||
#region 캔들 웹소켓 : 종목 50, 캔들 1 개만 해도 뒤지려고 함 !! (일딴 패스)
|
||||
@@ -258,6 +302,22 @@ namespace BitgetAPI
|
||||
treeListMarketInfoListUpdateTimer.Abort();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user