Skip to content

Commit

Permalink
Update and code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
teranum committed Dec 7, 2023
1 parent a9577ba commit e8bc517
Show file tree
Hide file tree
Showing 37 changed files with 1,084 additions and 304 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@
* 조건검색식 호출
![](./img/run-004.png)

* 차트요청
![](./img/run-005.png)

* 주문요청
![](./img/run-006.png)

Binary file added img/run-005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/run-006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 1 addition & 14 deletions src/KOAStudio.Core/Controls/OrderControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;

namespace KOAStudio.Core.Controls
{
Expand Down
14 changes: 8 additions & 6 deletions src/KOAStudio.Core/Converters/BooleanToNamedBrushConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ public class BooleanToNamedBrushConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string? retVals = parameter as string;
if (retVals != null)
if (value is bool bValue)
{
var true_false = retVals.Split(',');
if (true_false.Length == 2)
if (parameter is string retVals)
{
var brushConverter = new BrushConverter();
return (bool)value ? brushConverter.ConvertFromString(true_false[1]) : brushConverter.ConvertFromString(true_false[0]);
var true_false = retVals.Split(',');
if (true_false.Length == 2)
{
var brushConverter = new BrushConverter();
return bValue ? brushConverter.ConvertFromString(true_false[1]) : brushConverter.ConvertFromString(true_false[0]);
}
}
}
return new SolidColorBrush(Color.FromRgb(0, 0, 0));
Expand Down
12 changes: 7 additions & 5 deletions src/KOAStudio.Core/Converters/BooleanToStringConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ public class BooleanToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string? retVals = parameter as string;
if (retVals != null)
if (value is bool bValue)
{
var true_false = retVals.Split(',');
if (true_false.Length == 2)
if (parameter is string retVals)
{
return (bool)value ? true_false[1] : true_false[0];
var true_false = retVals.Split(',');
if (true_false.Length == 2)
{
return bValue ? true_false[1] : true_false[0];
}
}
}
return "Invalid";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace KOAStudio.Core.Converters
{
internal class HasChartRoundInterval : IValueConverter
internal class HasChartRoundIntervalConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
4 changes: 0 additions & 4 deletions src/KOAStudio.Core/Converters/InverseBooleanConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ namespace KOAStudio.Core.Converters
[ValueConversion(typeof(bool), typeof(bool))]
internal class InverseBooleanConverter : IValueConverter
{
#region IValueConverter Members

public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
Expand All @@ -21,7 +19,5 @@ public object ConvertBack(object value, Type targetType, object parameter,
{
throw new NotSupportedException();
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public sealed class InvertBooleanToVisibilityConverter : IValueConverter
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool flag = false;
if (value is bool)
if (value is bool v)
{
flag = (bool)value;
flag = v;
}
else if (value is bool?)
{
Expand All @@ -32,9 +32,9 @@ public object Convert(object value, Type targetType, object parameter, CultureIn

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Visibility)
if (value is Visibility visibility)
{
return (Visibility)value != Visibility.Visible;
return visibility != Visibility.Visible;
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ public class RadioBooleanToNamedBrushConverter : IMultiValueConverter
{
public object? Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
string? retVals = parameter as string;
if (retVals != null)
if (parameter is string retVals)
{
var true_false = retVals.Split(',');
if (true_false.Length == values.Length)
Expand Down
27 changes: 0 additions & 27 deletions src/KOAStudio.Core/Converters/StokItemInfoPriceConverter.cs

This file was deleted.

29 changes: 29 additions & 0 deletions src/KOAStudio.Core/Converters/ValueCompareToBrushConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace KOAStudio.Core.Converters
{
public class ValueCompareToBrushConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{

if (value is double compValue)
{
if (compValue > 0)
return Brushes.Red;

if (compValue < 0)
return Brushes.Blue;
}
return Brushes.Black;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}

2 changes: 1 addition & 1 deletion src/KOAStudio.Core/Helpers/OcxPathHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace KOAStudio.Core.Helpers
{
public class OcxPathHelper
public static class OcxPathHelper
{
public static string GetOcxPathFromClassID(string classID)
{
Expand Down
2 changes: 1 addition & 1 deletion src/KOAStudio.Core/KOAStudio.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UseWPF>true</UseWPF>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>x86;x64</Platforms>
<NoWarn>$(NoWarn);MA0048;MA0069</NoWarn>
<NoWarn>$(NoWarn);MA0048;MA0053;MA0069</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
18 changes: 18 additions & 0 deletions src/KOAStudio.Core/Models/JangoItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace KOAStudio.Core.Models
{
public class JangoItem(string 종목코드, string 종목명, bool 매도수구분, int 보유수량, double 평균단가, double 현재가, double 평가손익, string 통화코드)
{
public string 종목코드 { get; } = 종목코드;
public string 종목명 { get; } = 종목명;

/// <summary>
/// true: 매도, false: 매수
/// </summary>
public bool 매도수구분 { get; set; } = 매도수구분;
public int 보유수량 { get; set; } = 보유수량;
public double 평균단가 { get; set; } = 평균단가;
public double 현재가 { get; set; } = 현재가;
public double 평가손익 { get; protected set; } = 평가손익;
public string 통화코드 { get; } = 통화코드;
}
}
20 changes: 20 additions & 0 deletions src/KOAStudio.Core/Models/MicheItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace KOAStudio.Core.Models
{
public class MicheItem(string 종목코드, string 종목명, string 주문번호, string 원주문번호, bool 매도수구분, int 주문수량, int 미체결수량, double 주문가격, string 통화코드, string 주문시각)
{
public string 종목코드 { get; } = 종목코드;
public string 종목명 { get; } = 종목명;
public string 주문번호 { get; } = 주문번호;
public string 원주문번호 { get; set; } = 원주문번호;
/// <summary>
/// true: 매도, false: 매수
/// </summary>
public bool 매도수구분 { get; } = 매도수구분;

public int 주문수량 { get; set; } = 주문수량;
public int 미체결수량 { get; set; } = 미체결수량;
public double 주문가격 { get; set; } = 주문가격;
public string 통화코드 { get; } = 통화코드;
public string 주문시각 { get; set; } = 주문시각;
}
}
8 changes: 1 addition & 7 deletions src/KOAStudio.Core/Models/OrderKind.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KOAStudio.Core.Models
namespace KOAStudio.Core.Models
{
public enum OrderKind
{
Expand Down
8 changes: 1 addition & 7 deletions src/KOAStudio.Core/Models/OrderModel.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KOAStudio.Core.Models
namespace KOAStudio.Core.Models
{
internal class OrderModel
{
Expand Down
8 changes: 1 addition & 7 deletions src/KOAStudio.Core/Models/OrderType.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KOAStudio.Core.Models
namespace KOAStudio.Core.Models
{
public enum OrderType
{
Expand Down
81 changes: 0 additions & 81 deletions src/KOAStudio.Core/Models/StockItemInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/KOAStudio.Core/Services/BaseAppLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void OutputLog(int tabIndex, object? content = null, int maxLines = -1, b
WeakReferenceMessenger.Default.Send(new LogOutputMessageType(tabIndex, content, maxLines, focus));
}

public void OutputLogResetAllChangeState()
public static void OutputLogResetAllChangeState()
{
WeakReferenceMessenger.Default.Send(new LogOutputResetAllChangeStateMessageType());
}
Expand Down
12 changes: 12 additions & 0 deletions src/KOAStudio.Core/ViewModels/LogsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ private void Popup_Clear()
TabDatas?[TabSelectedIndex].Items.Clear();
}

// 전체 탭 지우기
[RelayCommand]
private void Popup_AllClear()
{
if (TabDatas == null) return;
foreach (var list in TabDatas)
{
list.Items.Clear();
list.BallImage = 0;
}
}

// 실시간 중지
[RelayCommand]
private void Popup_Stop_RT()
Expand Down
Loading

0 comments on commit e8bc517

Please sign in to comment.