270 lines
9.0 KiB
C#
270 lines
9.0 KiB
C#
using System;
|
|
|
|
using BitgetAPI.Data;
|
|
using BitgetAPI.Utils;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using BitgetApi.Data;
|
|
using System.Net.WebSockets;
|
|
|
|
namespace BitgetAPI
|
|
{
|
|
public class CommonProperty : BaseSettings<CommonProperty>
|
|
{
|
|
public enum WebConnectionType
|
|
{
|
|
POST = 0,
|
|
GET = 1
|
|
}
|
|
|
|
public enum ExchangePlace
|
|
{
|
|
Upbit = 0,
|
|
Bithumb = 1,
|
|
Bitget = 2
|
|
}
|
|
|
|
// 코인 Payument 타입
|
|
public enum PaymentType
|
|
{
|
|
KRW = 0,
|
|
BTC = 1,
|
|
USDT = 2,
|
|
}
|
|
|
|
// 최신, 가장오래된, None
|
|
public enum CandleType
|
|
{
|
|
None = 0,
|
|
Old = 1,
|
|
New = 2
|
|
}
|
|
|
|
// Bitget FUTURE 코인 타입
|
|
public enum BitgetProductType
|
|
{
|
|
COIN = 0,
|
|
FUTURE = 1,
|
|
MARGIN_보류 = 2
|
|
}
|
|
|
|
// SMA Band Type
|
|
public enum SMABandType
|
|
{
|
|
LongBuy = 0,
|
|
LongSell = 1,
|
|
ShortBuy = 2,
|
|
ShortSell = 3
|
|
}
|
|
|
|
public ExchangePlace selectedChangePlace;
|
|
public PaymentType selectedPaymentType;
|
|
public BitgetProductType selectedBitgetProductType;
|
|
|
|
public List<MarketInfo> marketInfoList = null;
|
|
public List<MarketCandleDataList> candleDataLists = null;
|
|
public List<WebSocketTickerInfo> webSocketCandles = null;
|
|
public WebService.WebConnection webConnection = null;
|
|
|
|
// 폼 및 컨트롤
|
|
public MainForm mainform = null;
|
|
|
|
/// <summary>
|
|
/// TODO 업비트 기능 추가
|
|
/// </summary>
|
|
// 빗썸 Web 요청 타입
|
|
public enum ExchangeWebReqType
|
|
{
|
|
#region 빗썸 웹 요청 타입
|
|
[Description("/Public/CandleStick")]
|
|
BithumbCandleStick = 0,
|
|
[Description("/public/ticker")]
|
|
BithumbCandleTicker = 1,
|
|
[Description("/public/Orderbook")]
|
|
BithumbMarket = 2,
|
|
#endregion
|
|
|
|
#region 업비트 웹 요청 타입
|
|
[Description("UpbitCandle")]
|
|
UpbitCandleStick = 10,
|
|
[Description("UpbitMarket")]
|
|
UpbitMarket = 11,
|
|
#endregion
|
|
|
|
#region 비트겟 웹 요청 타입
|
|
[Description("BitgetMarketInfo_SPOT")]
|
|
BitgetMarket_Spot = 20,
|
|
[Description("BitgetMarketInfo_FUTURE")]
|
|
BitgetMarket_Future = 21,
|
|
[Description("BitgetMCandle_COIN")]
|
|
BitgetCandleStick_Coin = 22,
|
|
[Description("BitgetMCandle_FUTURE")]
|
|
BitgetCandleStick_Future = 23,
|
|
[Description("BitgetAccountList_FUTURE")]
|
|
BitgetAccountList_Future = 30,
|
|
[Description("BitgetOrder_FUTURE")]
|
|
BitgetOrder_Future = 31,
|
|
[Description("BitgetOrderCancel_FUTURE")]
|
|
BitgetCancelOrder_Future = 32,
|
|
[Description("BitgetPendingOrder_FUTURE")]
|
|
BitgetPendingOrder_Future = 33,
|
|
[Description("BitgetChangeLeverage_FUTURE")]
|
|
BitgetChangeLeverage_Future = 34,
|
|
[Description("BitgetChangeMarginMode_FUTURE")]
|
|
BitgetChangeMarginMode_Future = 35,
|
|
[Description("BitgetChangePositionMode_FUTURE")]
|
|
BitgetChangePositionMode_Future = 36,
|
|
[Description("BitgetOrderDetail_FUTURE")]
|
|
BitgetOrderDetail_Future = 37,
|
|
[Description("BitgetGetTimeStamp")]
|
|
BitgetGetTimeStamp = 38
|
|
#endregion
|
|
}
|
|
|
|
// Bitget WebSocketType
|
|
public enum BitgetWebSocketType
|
|
{
|
|
현황정보_전체종목 = 0,
|
|
캔들정보 = 1,
|
|
보유List = 2,
|
|
주문하기 = 3,
|
|
}
|
|
|
|
public enum Side
|
|
{
|
|
[Description("buy")]
|
|
buy = 0,
|
|
[Description("sell")]
|
|
sell =1
|
|
}
|
|
|
|
public enum FuturePositionMode
|
|
{
|
|
[Description("one_way_mode")]
|
|
one_way_mode = 0,
|
|
[Description("hedge_mode")]
|
|
hedge_mode = 1
|
|
}
|
|
|
|
public enum OrderType
|
|
{
|
|
[Description("limit")]
|
|
limit = 0,
|
|
[Description("market")]
|
|
market = 1,
|
|
}
|
|
|
|
#region 선물거래 관련
|
|
public enum FutureMarginMode
|
|
{
|
|
[Description("isolated")]
|
|
isolated = 0,
|
|
[Description("crossed")]
|
|
crossed = 1,
|
|
}
|
|
|
|
|
|
|
|
public enum FutureSide
|
|
{
|
|
BuyShort = 0,
|
|
BuyLong = 1,
|
|
SellShort = 2,
|
|
SellLong = 3,
|
|
}
|
|
#endregion
|
|
|
|
// 시가/고가/종가/저가
|
|
public enum CandlePriceType
|
|
{
|
|
시가 = 1,
|
|
고가 = 2,
|
|
저가 = 3,
|
|
종가 = 4
|
|
}
|
|
|
|
// 캔들 데이터 (1분) (3분) (5분) (10분) (15분) (30분) (1시간) (4시간)
|
|
public enum MCandleTimeType
|
|
{
|
|
[Description("3m")]
|
|
M3 = 3,
|
|
[Description("5m")]
|
|
M5 = 5,
|
|
[Description("1m")]
|
|
M1 = 1,
|
|
[Description("15m")]
|
|
M15 = 15,
|
|
[Description("30m")]
|
|
M30 = 30,
|
|
[Description("1H")]
|
|
H1 = 60,
|
|
[Description("2H")]
|
|
H2 = 120,
|
|
[Description("3H")]
|
|
H3 = 180,
|
|
[Description("4H")]
|
|
H4 = 240,
|
|
[Description("6H")]
|
|
H6 = 360,
|
|
[Description("12H")]
|
|
H12 = 720
|
|
|
|
/*,
|
|
[Description("1D")]
|
|
D1 = 1440,
|
|
[Description("3D")]
|
|
D3 = 4320,
|
|
[Description("1W")]
|
|
W1 = 10000,
|
|
[Description("1M")]
|
|
MT1 = 100000
|
|
*/
|
|
}
|
|
|
|
// 이동평균선 종류
|
|
public enum MovingAverageType
|
|
{
|
|
캔들 = 1,
|
|
거래량 = 2
|
|
}
|
|
|
|
#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/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";
|
|
public static string UpbitURL_Ticks = "https://api.upbit.com/v1/trades/ticks";
|
|
|
|
public static string UpbitURL_Orders = "https://api.upbit.com/v1/orders";
|
|
public static string UpbitURL_Order = "https://api.upbit.com/v1/order";
|
|
public static string UpbitURL_Orderbook = "https://api.upbit.com/v1/orderbook";
|
|
public static string UpbitURL_OrderChace = "https://api.upbit.com/v1/orders/chance";
|
|
#endregion
|
|
|
|
#region Bitget URL
|
|
public static string BitgetURL = "https://api.upbit.com/";
|
|
public static string BitgetURL_MarketInfo_COIN = "https://api.bitget.com/api/v2/spot/public/coins";
|
|
public static string BitgetURL_MarketInfo_FUTURE = "https://api.bitget.com/api/v2/mix/market/tickers?productType=USDT-FUTURES";
|
|
|
|
public static string BitgetURL_MarketCandle_Coin = "https://api.bitget.com/api/v2/spot/market/candles?symbol={0}&granularity={1}in&startTime={2}&endTime={3}&limit={4}";
|
|
public static string BitgetURL_MarketCandle_Future = "https://api.bitget.com/api/v2/mix/market/candles?symbol={0}&granularity={1}&limit={2}&productType={3}";
|
|
|
|
public static string BitgetURL_AccountList_Future = @"https://api.bitget.com/api/v2/mix/account/accounts?productType=USDT-FUTURES";
|
|
public static string BitgetURL_BuySellOrder_Future = @"https://api.bitget.com/api/v2/mix/order/place-order";
|
|
public static string BitgetURL_CancelOrder_Future = @"https://api.bitget.com/api/v2/mix/order/cancel-order";
|
|
public static string BitgetURL_PendingOrders_Future = @"https://api.bitget.com/api/v2/mix/order/orders-pending?productType=usdt-futures";
|
|
public static string BitgetURL_ChangeLeverage_Future = @"https://api.bitget.com/api/v2/mix/account/set-leverage";
|
|
public static string BitgetURL_ChangeMarginMode_Future = @"https://api.bitget.com/api/v2/mix/account/set-margin-mode";
|
|
public static string BitgetURL_ChangePositionMode_Future = @"https://api.bitget.com/api/v2/mix/account/set-position-mode";
|
|
public static string BitgetURL_OrderDetail_Future = @"https://api.bitget.com/api/v2/mix/order/detail";
|
|
public static string BitgetURL_GetTimestamp = @"https://api.bitget.com/api/v2/public/time";
|
|
|
|
#endregion
|
|
}
|
|
}
|