IUpbitClient.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. namespace Application.Abstractions.Crypto;
  2. public interface IUpbitClient
  3. {
  4. // Candle
  5. Task<IReadOnlyList<UpbitCandle>> GetSecondCandlesAsync(string market, int count, CancellationToken ct = default);
  6. Task<IReadOnlyList<UpbitCandle>> GetMinuteCandlesAsync(string market, int unit, int count, CancellationToken ct = default);
  7. Task<IReadOnlyList<UpbitCandle>> GetDayCandlesAsync(string market, int count, CancellationToken ct = default);
  8. Task<IReadOnlyList<UpbitCandle>> GetWeekCandlesAsync(string market, int count, CancellationToken ct = default);
  9. Task<IReadOnlyList<UpbitCandle>> GetMonthCandlesAsync(string market, int count, CancellationToken ct = default);
  10. Task<IReadOnlyList<UpbitCandle>> GetYearCandlesAsync(string market, int count, CancellationToken ct = default);
  11. // Market
  12. Task<IReadOnlyList<UpbitMarket>> GetMarketsAsync(CancellationToken ct = default);
  13. // Ticker (상세)
  14. Task<IReadOnlyList<UpbitTickerDetail>> GetTickersAsync(string[] markets, CancellationToken ct = default);
  15. // Trade (체결)
  16. Task<IReadOnlyList<UpbitTrade>> GetTradesAsync(string market, int count, CancellationToken ct = default);
  17. // Orderbook (호가)
  18. Task<IReadOnlyList<UpbitOrderbook>> GetOrderbookAsync(string[] markets, CancellationToken ct = default);
  19. }
  20. // WebSocket Ticker (SIMPLE 포맷, 기존)
  21. public sealed record UpbitTicker(
  22. string Market,
  23. decimal TradePrice,
  24. string Change,
  25. decimal SignedChangePrice,
  26. decimal SignedChangeRate,
  27. decimal AccTradePrice24h
  28. );
  29. // Candle
  30. public sealed record UpbitCandle(
  31. string Market,
  32. DateTime CandleDateTimeUtc,
  33. decimal OpeningPrice,
  34. decimal HighPrice,
  35. decimal LowPrice,
  36. decimal TradePrice,
  37. long Timestamp,
  38. decimal CandleAccTradePrice,
  39. decimal CandleAccTradeVolume,
  40. string? FirstDayOfPeriod
  41. );
  42. // 마켓 목록
  43. public sealed record UpbitMarket(
  44. string Market,
  45. string KorName,
  46. string EngName,
  47. string? MarketWarning
  48. );
  49. // Ticker 상세 (REST)
  50. public sealed record UpbitTickerDetail(
  51. string Market,
  52. decimal TradePrice,
  53. string Change,
  54. decimal SignedChangePrice,
  55. decimal SignedChangeRate,
  56. decimal OpeningPrice,
  57. decimal HighPrice,
  58. decimal LowPrice,
  59. decimal PrevClosingPrice,
  60. decimal AccTradePrice,
  61. decimal AccTradePrice24h,
  62. decimal AccTradeVolume,
  63. decimal AccTradeVolume24h,
  64. decimal Highest52WeekPrice,
  65. string Highest52WeekDate,
  66. decimal Lowest52WeekPrice,
  67. string Lowest52WeekDate,
  68. long Timestamp
  69. );
  70. // 체결 내역
  71. public sealed record UpbitTrade(
  72. string Market,
  73. string TradeDate,
  74. string TradeTime,
  75. long Timestamp,
  76. decimal TradePrice,
  77. decimal TradeVolume,
  78. decimal PrevClosingPrice,
  79. string AskBid,
  80. long SequentialId
  81. );
  82. // 호가
  83. public sealed record UpbitOrderbook(
  84. string Market,
  85. decimal TotalAskSize,
  86. decimal TotalBidSize,
  87. IReadOnlyList<UpbitOrderbookUnit> OrderbookUnits,
  88. long Timestamp
  89. );
  90. public sealed record UpbitOrderbookUnit(
  91. decimal AskPrice,
  92. decimal BidPrice,
  93. decimal AskSize,
  94. decimal BidSize
  95. );