57 lines
1.9 KiB
C#
57 lines
1.9 KiB
C#
using Million.Data;
|
|
using Million.WebServices;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Specialized;
|
|
using System.Linq;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using static Million.CommonProperty;
|
|
|
|
namespace Million.WebMangement.Upbit
|
|
{
|
|
/// <summary>
|
|
/// Upbit 관련 API List
|
|
/// </summary>
|
|
public class UpbitAPI
|
|
{
|
|
UpbitProcess process;
|
|
/// <summary>
|
|
/// Upbit API 사용하기 위한 API
|
|
/// </summary>
|
|
public UpbitAPI(string acessKey, string secretKey)
|
|
{
|
|
this.process = new UpbitProcess(acessKey, secretKey);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Candle Stick Data
|
|
/// </summary>
|
|
/// <param name="market"></param>
|
|
/// <param name="candleType"></param>
|
|
/// <param name="datetime"></param>
|
|
/// <param name="count"></param>
|
|
/// <returns></returns>
|
|
public List<CandleData> GetCandleStics(string market, CandleTimeType candleType, DateTime datetime, int count = 200)
|
|
{
|
|
var url = UpbitURL_CandleStick + (int)candleType;
|
|
|
|
var resResult = process.CallAPI(url, HttpMethod.Get,
|
|
new NameValueCollection { { "market", market }, { "to", (datetime == default(DateTime)) ? process.DateTime2String(DateTime.Now) : process.DateTime2String(datetime) }, { "count", count.ToString() } });
|
|
return WebServiceFunctions.GetUpbitCandleDatas(resResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Get Market List Data
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<MarketData> GetMarketDatas()
|
|
{
|
|
var url = UpbitURL_MarketInfo;
|
|
var resResult = process.CallAPI(url, HttpMethod.Get);
|
|
return WebServiceFunctions.GetUpbitMarketDatas(resResult);
|
|
}
|
|
}
|
|
}
|