하아찡

[C#/WPF] Upbit 프로젝트 Chart - 6(틱 타입변경) 본문

C#/코인프로그램 - 코드

[C#/WPF] Upbit 프로젝트 Chart - 6(틱 타입변경)

하아찡 2023. 12. 3. 12:52

 

 

콤보박스 이벤트

private DelegateCommand<object> commandselectedmin;
public DelegateCommand<object> CommandSelectedMin =>
    commandselectedmin ?? (commandselectedmin = new DelegateCommand<object>(ExecuteCommandSelectedMin));

void ExecuteCommandSelectedMin(object parameter)
{
    if (parameter is ComboBox)
    {
        ComboBox cb = (ComboBox)parameter;
        PreMinNumber = (int)cb.SelectedItem;
        MinTickTime = PreMinNumber;
        CreateChart();
    }
}

MinType은 TickType이 분일경우 1, 3, 5, 10, 15, 30, 60, 240분으로 정해져있음.

 

 

틱 버튼 이벤트

/// <summary>
/// 캔들 불러오는 시간 타입을 변경시켜줌.
/// 23.11.15 
/// </summary>
private DelegateCommand<string> commandselectedticktype;
public DelegateCommand<string> CommandSelectedTickType =>
    commandselectedticktype ?? (commandselectedticktype = new DelegateCommand<string>(ExecuteCommandSelectedTickType));

void ExecuteCommandSelectedTickType(string type)
{
    TickType = type;

    if (type == "days")
    {
        VisibleComboBoxMin = Visibility.Collapsed;
        MinTickTime = 1440;
    }
    else if (type == "weeks")
    {
        VisibleComboBoxMin = Visibility.Collapsed;
        MinTickTime = 1440 * 7;
    }
    else if (type == "months")
    {
        VisibleComboBoxMin = Visibility.Collapsed;
        MinTickTime = 1440 * 30;
    }
    else
    {
        //23.11.15 - 해당부분 수정 후 완료로 변경
        //후에 TickTime값을 설정해주는작업을 완료했을때 1말고 설정된 값으로 변경시켜줘야함
        VisibleComboBoxMin = Visibility.Visible;
        MinTickTime = PreMinNumber;
    }
    CreateChart();

}

TickType은 현재 분, 일, 주, 월 타입을 저장하여 틱을 불러올때 전달해줘야함.

TickType값은

minutes -> 분

days -> 일

weeks -> 주

months ->월

해당 값들은 PublicFunctions에  Candles함수를 호출 할 때 사용합니다.

 

 

반응형