API(C#)를 이용한 자동매매 개발 #1차트(3/3)

in #kr7 years ago (edited)

이제 필요한 데이터는 모두 준비되었습니다.
MSChart 를 이용하여 받아놓은 차트를 표시해보겠습니다.

C# WinForm 프로젝트에 MSChart 를 추가하고요~
차트 속성에 수정한 값은 아래와 같습니다.
//
// chart1
//
chartArea3.AxisX.LabelStyle.Format = "MMdd HH:mm";
chartArea3.AxisX.ScaleView.MinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
chartArea3.AxisX.ScaleView.SmallScrollMinSizeType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
chartArea3.AxisY.IsStartedFromZero = false;
chartArea3.CursorX.IntervalOffsetType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
chartArea3.CursorX.IsUserSelectionEnabled = true;
chartArea3.Name = "ChartArea1";
this.chart1.ChartAreas.Add(chartArea3);
this.chart1.Location = new System.Drawing.Point(12, 38);
this.chart1.Name = "chart1";
series5.ChartArea = "ChartArea1";
series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Candlestick;
series5.Name = "Series";
series5.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime;
series5.YValuesPerPoint = 4;
series6.ChartArea = "ChartArea1";
series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;
series6.Name = "Point";
this.chart1.Series.Add(series5);
this.chart1.Series.Add(series6);
this.chart1.Size = new System.Drawing.Size(1384, 541);
this.chart1.TabIndex = 1;
this.chart1.Text = "chart1";
this.chart1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.Chart1_MouseMove);
this.chart1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.chart1_MouseUp);

자, 이제 차트 그리는 함수

    private void PaintChart()
    {
        string currency = comboBox1.SelectedItem.ToString();

        List<BitcoinModels.Series> chartData = stocks[currency].seriesDic[s_type];

        System.Windows.Forms.DataVisualization.Charting.Series series = chart1.Series[0];

        series.Name = currency;
        series["OpenCloseStyle"] = "Triangle";
        series["ShowOpenClose"] = "Both";
        //series["PointWidth"] = "1.0";
        series["PriceUpColor"] = "Red";
        series["PriceDownColor"] = "Blue";

        series.Points.Clear();
        for (int i = 0; i < chartData.Count; i++)
        {
            series.Points.AddXY(chartData[i].dt, chartData[i].high);
            series.Points[i].YValues[1] = chartData[i].low;
            series.Points[i].YValues[2] = chartData[i].open;
            series.Points[i].YValues[3] = chartData[i].close;
        }
    }

짜잔!! 이제 다음 스탭을 향하여... (잔고조회)

#차트 1/3 https://steemit.com/kr/@cowin/api-c-1-1-2
#차트 2/3 https://steemit.com/kr/@cowin/api-c-1-2-3
#차트 3/3 https://steemit.com/kr/@cowin/api-c-1-3-3
#잔고 1/2 https://steemit.com/kr/@cowin/api-c-2-1-1
#현재까지 완료된 실행파일 : http://bitcoin.cowincomfunny.com/

Sort:  

뉴비는 언제나 응원!이에요.
팁! : 유명 코인 거래소인 poloniex의 SBD, STEEM 송금이 조금 불안정하다고 합니다.
6.94% 보팅
현재 보상량 : [ 평균 - 0.43 / 4개 / 합계 : 1.71 ]

  • kr-newbie 보안관 봇! (beta 0.5.0 - 2017/07/17)

Coin Marketplace

STEEM 0.26
TRX 0.20
JST 0.038
BTC 96315.76
ETH 3565.22
USDT 1.00
SBD 3.90