From c258449c06969ee2d58a38707d89f6f5ff03b4a2 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1A3P75F\\lee" Date: Tue, 8 Feb 2022 17:32:46 +0900 Subject: [PATCH] =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=EC=9A=A9=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EC=97=85=EB=B9=84=ED=8A=B8=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=EC=82=AC=ED=95=AD=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Million Prototype/App.config | 6 + Million Prototype/Form1.Designer.cs | 88 +++++++++++++ Million Prototype/Form1.cs | 59 +++++++++ Million Prototype/Form1.resx | 120 ++++++++++++++++++ Million Prototype/Million Prototype.csproj | 91 +++++++++++++ Million Prototype/Program.cs | 22 ++++ Million Prototype/Properties/AssemblyInfo.cs | 36 ++++++ .../Properties/Resources.Designer.cs | 63 +++++++++ Million Prototype/Properties/Resources.resx | 117 +++++++++++++++++ .../Properties/Settings.Designer.cs | 26 ++++ .../Properties/Settings.settings | 7 + Million.sln | 8 +- Million/CommonProperty.cs | 8 +- Million/WebMangement/WebServiceFunctions.cs | 12 +- 14 files changed, 652 insertions(+), 11 deletions(-) create mode 100644 Million Prototype/App.config create mode 100644 Million Prototype/Form1.Designer.cs create mode 100644 Million Prototype/Form1.cs create mode 100644 Million Prototype/Form1.resx create mode 100644 Million Prototype/Million Prototype.csproj create mode 100644 Million Prototype/Program.cs create mode 100644 Million Prototype/Properties/AssemblyInfo.cs create mode 100644 Million Prototype/Properties/Resources.Designer.cs create mode 100644 Million Prototype/Properties/Resources.resx create mode 100644 Million Prototype/Properties/Settings.Designer.cs create mode 100644 Million Prototype/Properties/Settings.settings diff --git a/Million Prototype/App.config b/Million Prototype/App.config new file mode 100644 index 0000000..4bfa005 --- /dev/null +++ b/Million Prototype/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Million Prototype/Form1.Designer.cs b/Million Prototype/Form1.Designer.cs new file mode 100644 index 0000000..77da485 --- /dev/null +++ b/Million Prototype/Form1.Designer.cs @@ -0,0 +1,88 @@ +namespace Million_Prototype +{ + partial class Form1 + { + /// + /// 필수 디자이너 변수입니다. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 사용 중인 모든 리소스를 정리합니다. + /// + /// 관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form 디자이너에서 생성한 코드 + + /// + /// 디자이너 지원에 필요한 메서드입니다. + /// 이 메서드의 내용을 코드 편집기로 수정하지 마세요. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.listBox1 = new System.Windows.Forms.ListBox(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(33, 18); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(93, 12); + this.label1.TabIndex = 0; + this.label1.Text = "단순 테스트용도"; + // + // button1 + // + this.button1.Location = new System.Drawing.Point(35, 52); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(107, 23); + this.button1.TabIndex = 1; + this.button1.Text = "데이터 수집"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // listBox1 + // + this.listBox1.FormattingEnabled = true; + this.listBox1.ItemHeight = 12; + this.listBox1.Items.AddRange(new object[] { + " "}); + this.listBox1.Location = new System.Drawing.Point(166, 18); + this.listBox1.Name = "listBox1"; + this.listBox1.Size = new System.Drawing.Size(419, 556); + this.listBox1.TabIndex = 2; + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1415, 703); + this.Controls.Add(this.listBox1); + this.Controls.Add(this.button1); + this.Controls.Add(this.label1); + this.Name = "Form1"; + this.Text = "Form1"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ListBox listBox1; + } +} + diff --git a/Million Prototype/Form1.cs b/Million Prototype/Form1.cs new file mode 100644 index 0000000..d31d5d3 --- /dev/null +++ b/Million Prototype/Form1.cs @@ -0,0 +1,59 @@ +using Million.Data; +using Million.WebMangement.Upbit; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Million_Prototype +{ + public partial class Form1 : Form + { + public static string accessKey = "4jfMUL3lpwJ5GQSszm3rPp5M47tD8ssfIGew2dDb"; + public static string secretKey = "iAasVxQt8CyADjzXaAZiF5VZXTZPdElJOP4m97Bz"; + UpbitAPI uApi = new UpbitAPI(accessKey,secretKey); + Stopwatch sw = new Stopwatch(); + public Form1() + { + InitializeComponent(); + } + + /// + /// 1. 데이터 저장 + /// 2. 조건식 검색 + /// 3. 도출 + /// + /// + /// + private void button1_Click(object sender, EventArgs e) + { + sw.Restart(); + var data = uApi.GetMarketDatas(); //전체 목록 + var krwList = data.FindAll(x => x.Payment.Contains("KRW")); //한화 목록 + List> candledataList = new List>(); + + var test = krwList.Select(t => t.CodeFullName).ToList(); + + //var 현재가 = uApi.GetOrderBookList(test);GetTickerList + var 현재가 = uApi.GetTickerList(test); + + foreach (var krw in krwList) + { + + //candledataList.Add(uApi.GetCandleStics(krw.CodeFullName, Million.CommonProperty.MCandleTimeType.D1, DateTime.Now, 50)); + } + + + sw.Stop(); + listBox1.Items.Add("시간 : " + sw.ElapsedMilliseconds); + + 현재가.ToString(); + } + } +} diff --git a/Million Prototype/Form1.resx b/Million Prototype/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Million Prototype/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Million Prototype/Million Prototype.csproj b/Million Prototype/Million Prototype.csproj new file mode 100644 index 0000000..6e2c54d --- /dev/null +++ b/Million Prototype/Million Prototype.csproj @@ -0,0 +1,91 @@ + + + + + Debug + AnyCPU + {828206F2-6876-4B32-8B41-B925D809A1E7} + WinExe + Million_Prototype + Million Prototype + v4.8 + 512 + true + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + {10ef08cb-bf38-4882-a92a-30db34e8e8bd} + Million Core + + + + \ No newline at end of file diff --git a/Million Prototype/Program.cs b/Million Prototype/Program.cs new file mode 100644 index 0000000..8aa8a2b --- /dev/null +++ b/Million Prototype/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Million_Prototype +{ + static class Program + { + /// + /// 해당 애플리케이션의 주 진입점입니다. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/Million Prototype/Properties/AssemblyInfo.cs b/Million Prototype/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..e771383 --- /dev/null +++ b/Million Prototype/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해 +// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면 +// 이러한 특성 값을 변경하세요. +[assembly: AssemblyTitle("Million Prototype")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Million Prototype")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에 +// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면 +// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요. +[assembly: ComVisible(false)] + +// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다. +[assembly: Guid("828206f2-6876-4b32-8b41-b925d809a1e7")] + +// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다. +// +// 주 버전 +// 부 버전 +// 빌드 번호 +// 수정 버전 +// +// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를 +// 기본값으로 할 수 있습니다. +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Million Prototype/Properties/Resources.Designer.cs b/Million Prototype/Properties/Resources.Designer.cs new file mode 100644 index 0000000..7e4f34f --- /dev/null +++ b/Million Prototype/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +namespace Million_Prototype.Properties { + using System; + + + /// + /// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다. + /// + // 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder + // 클래스에서 자동으로 생성되었습니다. + // 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을 + // 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Million_Prototype.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을 + /// 재정의합니다. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Million Prototype/Properties/Resources.resx b/Million Prototype/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Million Prototype/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Million Prototype/Properties/Settings.Designer.cs b/Million Prototype/Properties/Settings.Designer.cs new file mode 100644 index 0000000..32e2095 --- /dev/null +++ b/Million Prototype/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// 이 코드는 도구를 사용하여 생성되었습니다. +// 런타임 버전:4.0.30319.42000 +// +// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면 +// 이러한 변경 내용이 손실됩니다. +// +//------------------------------------------------------------------------------ + +namespace Million_Prototype.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.7.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Million Prototype/Properties/Settings.settings b/Million Prototype/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/Million Prototype/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/Million.sln b/Million.sln index 6328c1a..6401541 100644 --- a/Million.sln +++ b/Million.sln @@ -7,10 +7,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Million Core", "Million\Mil EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Million Saver", "DataSaver\Million Saver.csproj", "{D9DE0F1B-BA15-421E-A263-6859F3D5A3BC}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Million Hunter", "Million Hunter\Million Hunter.csproj", "{C9A8F3B9-AA52-4C8C-8642-D2E22315656D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Million Hunter", "Million Hunter\Million Hunter.csproj", "{C9A8F3B9-AA52-4C8C-8642-D2E22315656D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Million Buyer", "Million Buyer\Million Buyer.csproj", "{7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Million Prototype", "Million Prototype\Million Prototype.csproj", "{828206F2-6876-4B32-8B41-B925D809A1E7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -33,6 +35,10 @@ Global {7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {7C6E28D6-A9CA-465B-88F2-1C3BA33B74BE}.Release|Any CPU.Build.0 = Release|Any CPU + {828206F2-6876-4B32-8B41-B925D809A1E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {828206F2-6876-4B32-8B41-B925D809A1E7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {828206F2-6876-4B32-8B41-B925D809A1E7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {828206F2-6876-4B32-8B41-B925D809A1E7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Million/CommonProperty.cs b/Million/CommonProperty.cs index 9e6911c..30446b2 100644 --- a/Million/CommonProperty.cs +++ b/Million/CommonProperty.cs @@ -113,10 +113,10 @@ namespace Million #region 업비트 URL public static string UpbitURL = "https://api.upbit.com/"; public static string UpbitURL_MarketInfo = "https://api.upbit.com/v1/market/all"; - public static string UpbitURL_MCandleStick = "https://api.upbit.com/v1/candles/minutes"; - public static string UpbitURL_DCandleStick = "https://api.upbit.com/v1/candles/minutes"; - public static string UpbitURL_WCandleStick = "https://api.upbit.com/v1/candles/minutes"; - public static string UpbitURL_MTCandleStick = "https://api.upbit.com/v1/candles/minutes"; + public static string UpbitURL_MCandleStick = "https://api.upbit.com/v1/candles/minutes/"; + public static string UpbitURL_DCandleStick = "https://api.upbit.com/v1/candles/days"; + public static string UpbitURL_WCandleStick = "https://api.upbit.com/v1/candles/weeks"; + public static string UpbitURL_MTCandleStick = "https://api.upbit.com/v1/candles/months"; public static string UpbitURL_Accounts = "https://api.upbit.com/v1/accounts"; public static string UpbitURL_Ticker = "https://api.upbit.com/v1/ticker"; diff --git a/Million/WebMangement/WebServiceFunctions.cs b/Million/WebMangement/WebServiceFunctions.cs index 8f2985c..d6463f2 100644 --- a/Million/WebMangement/WebServiceFunctions.cs +++ b/Million/WebMangement/WebServiceFunctions.cs @@ -212,7 +212,7 @@ namespace Million.WebServices data.TotalBuySize = total_bid_size; data.TotalSellSize = total_ask_size; - var list = (List>)item["orderbook_units"]; + var list = JsonConvert.DeserializeObject>>(JsonConvert.SerializeObject(item["orderbook_units"])); if(list != null) { @@ -228,9 +228,10 @@ namespace Million.WebServices unit.BuySize = bid_size; unit.SellPrice = ask_price; unit.SellSize = ask_size; - data.UnitList.Add(unit); + data.UnitList.Add(unit); } } + returnData.Add(data); } return returnData; } @@ -268,7 +269,7 @@ namespace Million.WebServices var data = new Ticker(); data.CodeFullName = item["market"]?.ToString(); - data.TradeDateTime = Convert.ToDateTime(dateStr).ToUniversalTime(); + data.TradeDateTime = DateTime.ParseExact(dateStr, "yyyyMMddHHmmss", null); data.OpeningPrice = opening_price; data.HighPrice = high_price; data.LowPrice = low_price; @@ -503,9 +504,8 @@ namespace Million.WebServices double.TryParse(item["high_price"]?.ToString(), out var highValue); double.TryParse(item["low_price"]?.ToString(), out var lowValue); //이거는 확인 필요 - double.TryParse(item["candle_acc_trade_price"]?.ToString(), out var moneyVolume); - - int.TryParse(item["unit"]?.ToString(), out var candleTimeType); + double.TryParse(item["candle_acc_trade_price"]?.ToString(), out var moneyVolume); + candleList.Add(new CandleData() { DateTime = Convert.ToDateTime(item["candle_date_time_kst"]?.ToString()),