1. 최신 Ticker 계산 함수
2. DB Data Saver 수정 3.
This commit is contained in:
@@ -11,14 +11,14 @@ namespace DataSaver
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
// Key(임시)
|
||||
public static string accessKey = "4jfMUL3lpwJ5GQSszm3rPp5M47tD8ssfIGew2dDb";
|
||||
public static string secretKey = "iAasVxQt8CyADjzXaAZiF5VZXTZPdElJOP4m97Bz";
|
||||
//public static string accessKey = "4jfMUL3lpwJ5GQSszm3rPp5M47tD8ssfIGew2dDb";
|
||||
//public static string secretKey = "iAasVxQt8CyADjzXaAZiF5VZXTZPdElJOP4m97Bz";
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
CommonProperty.UpbitApi = new Million.WebMangement.Upbit.UpbitAPI(accessKey, secretKey);
|
||||
//CommonProperty.UpbitApi = new Million.WebMangement.Upbit.UpbitAPI(accessKey, secretKey);
|
||||
|
||||
InitForm();
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using Million.Data;
|
||||
using Million.DbManagement;
|
||||
using Million.Indicators;
|
||||
using Million.Manager;
|
||||
using Million.WebMangement.Upbit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -20,9 +21,9 @@ namespace Million_Prototype
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public static string accessKey = "4jfMUL3lpwJ5GQSszm3rPp5M47tD8ssfIGew2dDb";
|
||||
public static string secretKey = "iAasVxQt8CyADjzXaAZiF5VZXTZPdElJOP4m97Bz";
|
||||
UpbitAPI uApi = new UpbitAPI(accessKey,secretKey);
|
||||
//public static string accessKey = "4jfMUL3lpwJ5GQSszm3rPp5M47tD8ssfIGew2dDb";
|
||||
//public static string secretKey = "iAasVxQt8CyADjzXaAZiF5VZXTZPdElJOP4m97Bz";
|
||||
//UpbitAPI uApi = new UpbitAPI(accessKey,secretKey);
|
||||
Stopwatch sw = new Stopwatch();
|
||||
public Form1()
|
||||
{
|
||||
@@ -39,7 +40,7 @@ namespace Million_Prototype
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
sw.Restart();
|
||||
var data = uApi.GetMarketDatas(); //전체 목록
|
||||
var data = UpbitApi.GetMarketDatas(); //전체 목록
|
||||
var krwList = data.FindAll(x => x.Payment.Contains("KRW")); //한화 목록
|
||||
|
||||
List<CandleDataList> dataList = new List<CandleDataList>();
|
||||
@@ -53,7 +54,7 @@ namespace Million_Prototype
|
||||
//4시간 가져오기
|
||||
foreach(var krw in dataList)
|
||||
{
|
||||
krw.CandleDataLists_Im= uApi.GetCandleStics(krw.ConGoodsData.CodeFullName, MCandleTimeType.H4, dateTime);
|
||||
krw.CandleDataLists_Im= UpbitApi.GetCandleStics(krw.ConGoodsData.CodeFullName, MCandleTimeType.H4, dateTime);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -80,7 +81,7 @@ namespace Million_Prototype
|
||||
|
||||
var test = krwList.Select(t => t.CodeFullName).ToList();
|
||||
//var 현재가 = uApi.GetOrderBookList(test);GetTickerList
|
||||
var 현재가 = uApi.GetTickerList(test);
|
||||
var 현재가 = UpbitApi.GetTickerList(test);
|
||||
|
||||
foreach (var krw in krwList)
|
||||
{
|
||||
@@ -126,6 +127,8 @@ namespace Million_Prototype
|
||||
candleData.CandleDataLists_Im.ToString();
|
||||
}
|
||||
|
||||
//var datas = DataSettingManager.GetBasicDataSetting(PaymentType.KRW, MCandleTimeType.M1, 100001);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,9 @@ namespace Million
|
||||
{
|
||||
|
||||
#region default로 가지고 있어야하는 데이터
|
||||
public static UpbitAPI UpbitApi = null;
|
||||
public static string accessKey = "4jfMUL3lpwJ5GQSszm3rPp5M47tD8ssfIGew2dDb";
|
||||
public static string secretKey = "iAasVxQt8CyADjzXaAZiF5VZXTZPdElJOP4m97Bz";
|
||||
public static UpbitAPI UpbitApi = new UpbitAPI(accessKey, secretKey);
|
||||
#endregion
|
||||
|
||||
#region Enumable
|
||||
@@ -165,8 +167,9 @@ namespace Million
|
||||
|
||||
// 현재 시점에서 사용되고 있는 Place의 Market List 정보
|
||||
public static List<MarketData> selectedMarketOfPlaceList = null;
|
||||
public static List<MarketData> recentlyMarketOfPlaceList = null;
|
||||
public static List<MarketData> recentlyMarketOfPlaceList = null;
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,18 +60,34 @@ namespace Million.DbManagement
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DB로부터 코인(Market) 정보 가져오기
|
||||
/// DB로부터 코인(Market) 정보 가져오기(Data Saver 전용)
|
||||
/// </summary>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
public static void GetMarketTable_FromDB(string TableName)
|
||||
public static void GetMarketTable_FromDB(string tableName)
|
||||
{
|
||||
selectedMarketOfPlaceList = GetMarketDatas(tableName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// DB에서 Market Data 정보 가져오는 함수
|
||||
/// </summary>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
public static List<MarketData> GetMarketDatas(string tableName, string payment = null)
|
||||
{
|
||||
var strDbCon = $"{CommonProperty.DbConnectionStr}Market";
|
||||
|
||||
// Query문 만들기
|
||||
var sqlQuery = string.Format("select * from dbo.{0} where IsValid = 1;", TableName);
|
||||
var subSql = "";
|
||||
if(payment != null)
|
||||
{
|
||||
subSql = string.Format("AND [Payment] = '{0}'", payment);
|
||||
}
|
||||
|
||||
selectedMarketOfPlaceList = DBConnection.QueryGetExcuter_Market(strDbCon, sqlQuery);
|
||||
// Query문 만들기
|
||||
var sqlQuery = string.Format("select * from dbo.{0} where IsValid = 1 {1};", tableName, subSql);
|
||||
|
||||
return DBConnection.QueryGetExcuter_Market(strDbCon, sqlQuery);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -243,6 +259,7 @@ namespace Million.DbManagement
|
||||
var dateTime = DateTime.Now;
|
||||
var tableName = item.ConGoodsData.CodeFullName;
|
||||
int step = 0;
|
||||
bool firstFlag = true;
|
||||
var recentlyFlag = true;
|
||||
switch (place)
|
||||
{
|
||||
@@ -282,6 +299,13 @@ namespace Million.DbManagement
|
||||
|
||||
insertDataList = insertDataList.OrderBy(t => t.DateTime).ToList();
|
||||
|
||||
if (firstFlag) {
|
||||
if(insertDataList.Count > 0) {
|
||||
insertDataList.Remove(insertDataList[insertDataList.Count - 1]);
|
||||
firstFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
//데이터 insert
|
||||
foreach (var data in insertDataList)
|
||||
{
|
||||
|
||||
84
Million/Manager/DataSettingManager.cs
Normal file
84
Million/Manager/DataSettingManager.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using Million.Data;
|
||||
using Million.Data.Upbit;
|
||||
using Million.DbManagement;
|
||||
using Million.WebMangement.Upbit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static Million.CommonProperty;
|
||||
|
||||
namespace Million.Manager
|
||||
{
|
||||
/// <summary>
|
||||
/// Data Setting하는 Manager Class
|
||||
/// </summary>
|
||||
public static class DataSettingManager
|
||||
{
|
||||
/// <summary>
|
||||
/// 실시간 데이터 가져오는 함수(Ticker와 CandleDataList두개를 Return 할 수 있도록 구성)
|
||||
/// </summary>
|
||||
/// <param name="candleDatas"></param>
|
||||
/// <param name="codeFullNameList"></param>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Ticker> GetRecentlyCandleData(List<string> codeFullNameList = null, string tableName = "Upbit")
|
||||
{
|
||||
var dateTime = DateTime.Now;
|
||||
var resultList = new List<CandleData>();
|
||||
var marketList = DbServiceFunctions.GetMarketDatas(tableName);
|
||||
|
||||
//null일경우 전체가 가져옴
|
||||
if (codeFullNameList == null)
|
||||
{
|
||||
//Upbit로 임시
|
||||
codeFullNameList = marketList.Select(t => t.CodeFullName).ToList();
|
||||
}
|
||||
|
||||
var tickerList = CommonProperty.UpbitApi.GetTickerList(codeFullNameList);
|
||||
|
||||
return tickerList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///// <summary>
|
||||
///// 기본 시작시 필요한 Data Setting
|
||||
///// </summary>
|
||||
///// <param name="buyType"></param>
|
||||
///// <param name="codeFullNameList"></param>
|
||||
///// <param name="tableName"></param>
|
||||
///// <returns></returns>
|
||||
//public static List<CandleDataList> GetBasicDataSetting(PaymentType buyType, MCandleTimeType timeType, int count = 100000, List<string> codeFullNameList = null, string tableName = "Upbit")
|
||||
//{
|
||||
// var returnData = new List<CandleDataList>();
|
||||
|
||||
// var dateTime = DateTime.Now;
|
||||
// var resultList = new List<CandleData>();
|
||||
|
||||
|
||||
// var marketList = DbServiceFunctions.GetMarketDatas(tableName, Enum.GetName(typeof(PaymentType), buyType));
|
||||
|
||||
// //null일경우 전체가 가져옴
|
||||
// if (codeFullNameList == null)
|
||||
// {
|
||||
// //Upbit로 임시
|
||||
// codeFullNameList = marketList.Select(t => t.CodeFullName).ToList();
|
||||
// }
|
||||
|
||||
// Parallel.For(0, codeFullNameList.Count, i =>
|
||||
// {
|
||||
// var val = new CandleDataList();
|
||||
// val.ConGoodsData = marketList.FirstOrDefault(t => t.CodeFullName == codeFullNameList[i]);
|
||||
// val.CandleDataLists_Im = CommonProperty.UpbitApi.GetCandleStics(codeFullNameList[i], timeType, dateTime, count);
|
||||
|
||||
// returnData.Add(val);
|
||||
// });
|
||||
|
||||
|
||||
// return returnData;
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -127,6 +127,7 @@
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Manager\DataSettingManager.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SubForm\AccumulateDataUI.cs">
|
||||
|
||||
Reference in New Issue
Block a user