Skip to main content

ids_apis/
kdo.v1.order_log.rs

1// @generated
2// This file is @generated by prost-build.
3/// 주문 로그
4#[allow(clippy::derive_partial_eq_without_eq)]
5#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct OrderLog {
7    /// 로그 고유 ID (DB에서 자동 생성)
8    #[prost(int64, tag="1")]
9    pub id: i64,
10    /// 주문 ID (거래소에서 받은 ID)
11    #[prost(uint64, tag="2")]
12    pub order_id: u64,
13    /// 원본 주문 ID (수정/취소의 경우)
14    /// Option<u64>는 optional uint64로 매핑
15    #[prost(uint64, optional, tag="3")]
16    pub original_order_id: ::core::option::Option<u64>,
17    /// 펀드 코드
18    #[prost(string, tag="4")]
19    pub fund_code: ::prost::alloc::string::String,
20    /// 심볼
21    #[prost(string, tag="5")]
22    pub symbol: ::prost::alloc::string::String,
23    /// 로그 타입
24    #[prost(enumeration="OrderLogType", tag="6")]
25    pub log_type: i32,
26    /// 주문 방향 (매수/매도)
27    #[prost(enumeration="super::common::OrderSide", tag="7")]
28    pub side: i32,
29    /// 주문 타입 (신규/정정/취소)
30    #[prost(enumeration="OrderType", tag="8")]
31    pub order_type: i32,
32    /// 주문 가격 (Price)
33    /// 정확도 유지를 위해 string 또는 고정 소수점(fixed64 등)을 사용할 수 있으나,
34    /// 여기서는 간단하게 string으로 가정
35    #[prost(string, tag="9")]
36    pub price: ::prost::alloc::string::String,
37    /// 주문 수량 (Quantity)
38    /// 정확도 유지를 위해 string 또는 고정 소수점(fixed64 등)을 사용할 수 있으나,
39    /// 여기서는 간단하게 string으로 가정
40    #[prost(string, tag="10")]
41    pub quantity: ::prost::alloc::string::String,
42    /// 체결 가격 (Filled 로그의 경우) (FilledPrice)
43    #[prost(string, optional, tag="11")]
44    pub filled_price: ::core::option::Option<::prost::alloc::string::String>,
45    /// 체결 수량 (Filled 로그의 경우) (FilledQuantity)
46    #[prost(string, optional, tag="12")]
47    pub filled_quantity: ::core::option::Option<::prost::alloc::string::String>,
48    /// 체결 금액 (계산값) (FilledAmount)
49    #[prost(string, optional, tag="13")]
50    pub filled_amount: ::core::option::Option<::prost::alloc::string::String>,
51    /// 거부/취소 코드
52    #[prost(string, optional, tag="14")]
53    pub rejection_code: ::core::option::Option<::prost::alloc::string::String>,
54    /// 에러 메시지 (MeritzRejected의 경우)
55    #[prost(string, optional, tag="15")]
56    pub error_message: ::core::option::Option<::prost::alloc::string::String>,
57    /// 거래소 시각 (KST, HHMMSSuuuuuu)
58    #[prost(uint64, tag="16")]
59    pub exchange_time: u64,
60    /// 이벤트 수신 시각 (시스템 시각, 마이크로초)
61    /// Rust Timestamp 타입을 u64로 가정
62    #[prost(uint64, tag="17")]
63    pub receive_time: u64,
64    /// DB 삽입 시각
65    /// Rust의 DateTime<Utc> 타입을 Google의 Timestamp 메시지로 매핑
66    #[prost(message, optional, tag="18")]
67    pub created_at: ::core::option::Option<super::super::super::google::protobuf::Timestamp>,
68    /// 시장 구분
69    #[prost(enumeration="super::common::MarketType", tag="19")]
70    pub market_type: i32,
71    /// 거래일 (YYYYMMDD)
72    #[prost(uint32, tag="20")]
73    pub date: u32,
74    /// 사용자 영역 (JSON: QuoteContext 또는 HedgeContext)
75    #[prost(string, optional, tag="21")]
76    pub user_area: ::core::option::Option<::prost::alloc::string::String>,
77}
78#[allow(clippy::derive_partial_eq_without_eq)]
79#[derive(Clone, Copy, PartialEq, ::prost::Message)]
80pub struct OrderLogFillStatistics {
81    /// 총 체결 건수
82    #[prost(int64, tag="1")]
83    pub total_fills: i64,
84    /// 총 체결 수량
85    #[prost(int64, tag="2")]
86    pub total_quantity: i64,
87    /// 총 체결 금액
88    #[prost(int64, tag="3")]
89    pub total_amount: i64,
90    /// 매수 체결 건수
91    #[prost(int64, tag="4")]
92    pub buy_count: i64,
93    /// 매도 체결 건수
94    #[prost(int64, tag="5")]
95    pub sell_count: i64,
96}
97// ========== Request/Response Messages ==========
98
99/// ListOrderLogs 요청
100#[allow(clippy::derive_partial_eq_without_eq)]
101#[derive(Clone, PartialEq, ::prost::Message)]
102pub struct ListOrderLogsRequest {
103    /// 페이지 크기 (optional)
104    #[prost(uint32, optional, tag="1")]
105    pub page_size: ::core::option::Option<u32>,
106    /// 페이지 토큰 (optional, for pagination)
107    #[prost(string, optional, tag="2")]
108    pub page_token: ::core::option::Option<::prost::alloc::string::String>,
109    /// Available Sequence and Operator
110    /// * fund_code
111    ///    * `equal`, `contains`
112    /// * symbol
113    ///    * `equal`, `contains
114    /// * log_type
115    ///    * `equal`
116    /// * side
117    ///    * `equal`
118    /// * order_type
119    ///    * `equal`
120    ///
121    /// Examples
122    /// * filter=fund_code="0159"
123    /// * filter=symbol:"7526"
124    /// * filter=log_type=FILLED
125    /// * filter=side=BUY
126    /// * filter=order_type=AMEND
127    /// * filter=market_type=KOSPI
128    #[prost(string, tag="3")]
129    pub filter: ::prost::alloc::string::String,
130    /// 오더링 조건. (optional, AIP-132)
131    ///
132    /// Supported Fields
133    /// * "order_id", "exchange_time", "receive_time", "date"
134    ///
135    /// Examples
136    /// * order_by=order_id desc
137    #[prost(string, tag="4")]
138    pub order_by: ::prost::alloc::string::String,
139}
140/// ListOrderLogs 응답
141#[allow(clippy::derive_partial_eq_without_eq)]
142#[derive(Clone, PartialEq, ::prost::Message)]
143pub struct ListOrderLogsResponse {
144    /// 펀드 목록
145    #[prost(message, repeated, tag="1")]
146    pub order_logs: ::prost::alloc::vec::Vec<OrderLog>,
147    /// 다음 페이지 토큰
148    #[prost(string, tag="2")]
149    pub next_page_token: ::prost::alloc::string::String,
150}
151#[allow(clippy::derive_partial_eq_without_eq)]
152#[derive(Clone, PartialEq, ::prost::Message)]
153pub struct GetOrderLogStatisticsRequest {
154    /// AIP 스타일 문자열 필터. GetOrderLogStatistics 및 StreamOrderLogStatistics 공용.
155    ///
156    /// Available Fields and Operators
157    /// * fund_code
158    ///    * `equal`, `contains`
159    /// * symbol
160    ///    * `equal`, `contains`
161    /// * exchange_time
162    ///    * 날짜/시각 범위 필터. ISO 8601 (RFC3339) 값, 연산자 `>`, `>=`, `<`, `<=` 지원.
163    ///    * 미지정(날짜 범위 생략) 시 서버가 당일(KST 00:00~)로 자동 필터한다.
164    ///
165    /// Examples
166    /// * filter=fund_code="0159"
167    /// * filter=symbol:"7526"
168    /// * filter=exchange_time>="2026-06-02T00:00:00Z" AND exchange_time<"2026-06-03T00:00:00Z"
169    /// * filter=fund_code="0159" AND exchange_time>="2026-06-02T00:00:00Z" AND exchange_time<"2026-06-03T00:00:00Z"
170    #[prost(string, tag="1")]
171    pub filter: ::prost::alloc::string::String,
172}
173#[allow(clippy::derive_partial_eq_without_eq)]
174#[derive(Clone, Copy, PartialEq, ::prost::Message)]
175pub struct GetOrderChainRequest {
176    #[prost(uint64, tag="1")]
177    pub order_id: u64,
178    /// YYYYMMDD, 미지정 시 오늘 날짜
179    #[prost(uint32, optional, tag="2")]
180    pub date: ::core::option::Option<u32>,
181}
182#[allow(clippy::derive_partial_eq_without_eq)]
183#[derive(Clone, PartialEq, ::prost::Message)]
184pub struct GetOrderChainResponse {
185    #[prost(message, repeated, tag="1")]
186    pub order_logs: ::prost::alloc::vec::Vec<OrderLog>,
187}
188/// GetHedgePairDetail 요청
189#[allow(clippy::derive_partial_eq_without_eq)]
190#[derive(Clone, Copy, PartialEq, ::prost::Message)]
191pub struct GetHedgePairDetailRequest {
192    /// 주문 ID (hedge 또는 quote order)
193    #[prost(uint64, tag="1")]
194    pub order_id: u64,
195    /// 날짜 (YYYYMMDD, optional - 미지정 시 당일)
196    #[prost(uint32, optional, tag="2")]
197    pub date: ::core::option::Option<u32>,
198}
199/// StreamHedgePairDetail 요청
200#[allow(clippy::derive_partial_eq_without_eq)]
201#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct StreamHedgePairDetailRequest {
203    /// 감시할 ETF 심볼
204    #[prost(string, tag="1")]
205    pub symbol: ::prost::alloc::string::String,
206    /// 펀드 필터
207    #[prost(string, optional, tag="2")]
208    pub fund_code: ::core::option::Option<::prost::alloc::string::String>,
209    /// 선물 LP 헷지 ETF 필터
210    #[prost(string, optional, tag="3")]
211    pub hedge_symbol: ::core::option::Option<::prost::alloc::string::String>,
212    /// Quote 방향 필터 (optional - 미지정 시 양방향 모두)
213    #[prost(enumeration="super::common::OrderSide", optional, tag="4")]
214    pub quote_side: ::core::option::Option<i32>,
215    /// 재연결 시 끊긴 시점 이후만 받고 싶을 때 (마이크로초)
216    #[prost(uint64, optional, tag="5")]
217    pub since_hedge_exchange_time_us: ::core::option::Option<u64>,
218}
219/// 헷지 쌍 상세 정보
220#[allow(clippy::derive_partial_eq_without_eq)]
221#[derive(Clone, PartialEq, ::prost::Message)]
222pub struct HedgePairDetail {
223    /// Quote(원주문) 주문 ID
224    #[prost(uint64, tag="1")]
225    pub quote_order_id: u64,
226    /// ETF 심볼
227    #[prost(string, tag="2")]
228    pub quote_symbol: ::prost::alloc::string::String,
229    /// ETF 방향 (매수/매도)
230    #[prost(enumeration="super::common::OrderSide", tag="3")]
231    pub quote_side: i32,
232    /// ETF 체결 수량
233    #[prost(int64, tag="4")]
234    pub quote_filled_quantity: i64,
235    /// ETF 평균 체결 가격
236    #[prost(double, tag="5")]
237    pub quote_avg_price: f64,
238    /// Hedge 심볼 (선물)
239    #[prost(string, tag="6")]
240    pub hedge_symbol: ::prost::alloc::string::String,
241    /// Hedge 체결 수량
242    #[prost(int64, tag="7")]
243    pub hedge_filled_quantity: i64,
244    /// Hedge 평균 체결 가격
245    #[prost(double, tag="8")]
246    pub hedge_avg_price: f64,
247    /// 스프레드 (선물가격 * 100 - ETF가격)
248    #[prost(double, tag="9")]
249    pub spread: f64,
250    /// 펀드 코드
251    #[prost(string, tag="10")]
252    pub fund_code: ::prost::alloc::string::String,
253    /// 날짜 (YYYYMMDD)
254    #[prost(uint32, tag="11")]
255    pub date: u32,
256    /// 마지막 Hedge 거래소 시각 (마이크로초)
257    #[prost(uint64, tag="12")]
258    pub hedge_exchange_time: u64,
259}
260/// 한쪽 방향(매수 또는 매도)의 체결 집계
261#[allow(clippy::derive_partial_eq_without_eq)]
262#[derive(Clone, Copy, PartialEq, ::prost::Message)]
263pub struct SideFillSummary {
264    /// 체결 건수
265    #[prost(uint64, tag="1")]
266    pub fill_count: u64,
267    /// 누적 체결 수량
268    #[prost(int64, tag="2")]
269    pub filled_quantity: i64,
270    /// 평균 체결 가격 (금액/수량)
271    #[prost(double, tag="3")]
272    pub avg_price: f64,
273    /// 체결 금액 합 (filled_price*filled_quantity 합)
274    #[prost(double, tag="4")]
275    pub amount: f64,
276    /// 마지막 체결 거래소 시각 (마이크로초)
277    #[prost(uint64, tag="5")]
278    pub last_exchange_time: u64,
279}
280/// 한 다리(원주문 또는 헷지)의 fund+symbol 단위 집계
281#[allow(clippy::derive_partial_eq_without_eq)]
282#[derive(Clone, PartialEq, ::prost::Message)]
283pub struct LegFillSummary {
284    #[prost(string, tag="1")]
285    pub fund_code: ::prost::alloc::string::String,
286    #[prost(string, tag="2")]
287    pub symbol: ::prost::alloc::string::String,
288    /// 매수 집계
289    #[prost(message, optional, tag="3")]
290    pub bid: ::core::option::Option<SideFillSummary>,
291    /// 매도 집계
292    #[prost(message, optional, tag="4")]
293    pub ask: ::core::option::Option<SideFillSummary>,
294}
295/// 원주문/헷지 두 다리를 페어로 묶은 스냅샷 (stream 의 각 틱마다 emit)
296#[allow(clippy::derive_partial_eq_without_eq)]
297#[derive(Clone, PartialEq, ::prost::Message)]
298pub struct PairFillSummary {
299    /// 원주문 다리 (ETF)
300    #[prost(message, optional, tag="1")]
301    pub quote: ::core::option::Option<LegFillSummary>,
302    /// 헷지 다리 (선물)
303    #[prost(message, optional, tag="2")]
304    pub hedge: ::core::option::Option<LegFillSummary>,
305    /// YYYYMMDD
306    #[prost(uint32, tag="3")]
307    pub date: u32,
308}
309/// StreamPairFillSummary 요청
310#[allow(clippy::derive_partial_eq_without_eq)]
311#[derive(Clone, PartialEq, ::prost::Message)]
312pub struct StreamPairFillSummaryRequest {
313    /// 원주문 펀드 코드
314    #[prost(string, tag="1")]
315    pub quote_fund_code: ::prost::alloc::string::String,
316    /// 원주문 심볼 (ETF)
317    #[prost(string, tag="2")]
318    pub quote_symbol: ::prost::alloc::string::String,
319    /// 헷지 펀드 코드
320    #[prost(string, tag="3")]
321    pub hedge_fund_code: ::prost::alloc::string::String,
322    /// 헷지 심볼 (선물)
323    #[prost(string, tag="4")]
324    pub hedge_symbol: ::prost::alloc::string::String,
325    /// 날짜(YYYYMMDD). 미지정 시 서버가 당일로 처리
326    #[prost(uint32, optional, tag="5")]
327    pub date: ::core::option::Option<u32>,
328}
329/// ListHedgePairDetails 요청
330#[allow(clippy::derive_partial_eq_without_eq)]
331#[derive(Clone, PartialEq, ::prost::Message)]
332pub struct ListHedgePairDetailsRequest {
333    /// 감시할 ETF/quote 심볼 (필수)
334    #[prost(string, tag="1")]
335    pub symbol: ::prost::alloc::string::String,
336    /// 펀드 필터
337    #[prost(string, optional, tag="2")]
338    pub fund_code: ::core::option::Option<::prost::alloc::string::String>,
339    /// 선물 LP의 헷지 ETF 필터 (hedge_symbol 매칭)
340    #[prost(string, optional, tag="3")]
341    pub hedge_symbol: ::core::option::Option<::prost::alloc::string::String>,
342    /// Quote 방향 필터
343    #[prost(enumeration="super::common::OrderSide", optional, tag="4")]
344    pub quote_side: ::core::option::Option<i32>,
345    /// 날짜 필터 (YYYYMMDD). 당일만 조회할 때 사용
346    #[prost(uint32, optional, tag="5")]
347    pub date: ::core::option::Option<u32>,
348    /// 이 시각 이후의 결과만 (resume용, 마이크로초)
349    #[prost(uint64, optional, tag="6")]
350    pub since_hedge_exchange_time_us: ::core::option::Option<u64>,
351    /// 페이지 크기 (기본 200, 최대 1000)
352    #[prost(int32, tag="7")]
353    pub page_size: i32,
354    /// 페이지 토큰
355    #[prost(string, tag="8")]
356    pub page_token: ::prost::alloc::string::String,
357}
358/// ListHedgePairDetails 응답
359#[allow(clippy::derive_partial_eq_without_eq)]
360#[derive(Clone, PartialEq, ::prost::Message)]
361pub struct ListHedgePairDetailsResponse {
362    #[prost(message, repeated, tag="1")]
363    pub details: ::prost::alloc::vec::Vec<HedgePairDetail>,
364    #[prost(string, tag="2")]
365    pub next_page_token: ::prost::alloc::string::String,
366}
367/// 주문 로그 타입
368///
369/// Rust의 SCREAMING_SNAKE_CASE를 반영하여 정의
370/// 주석은 Rust 코드의 내용을 번역했습니다.
371#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
372#[repr(i32)]
373pub enum OrderLogType {
374    /// 알 수 없는 값 (기본값)
375    Unspecified = 0,
376    /// 접수 확인
377    Received = 1,
378    /// 거래소 거부
379    Rejected = 2,
380    /// 메리츠 내부 거부
381    MeritzRejected = 3,
382    /// 체결
383    Filled = 4,
384    /// 자동 취소
385    AutoCancelled = 5,
386}
387impl OrderLogType {
388    /// String value of the enum field names used in the ProtoBuf definition.
389    ///
390    /// The values are not transformed in any way and thus are considered stable
391    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
392    pub fn as_str_name(&self) -> &'static str {
393        match self {
394            OrderLogType::Unspecified => "ORDER_LOG_TYPE_UNSPECIFIED",
395            OrderLogType::Received => "RECEIVED",
396            OrderLogType::Rejected => "REJECTED",
397            OrderLogType::MeritzRejected => "MERITZ_REJECTED",
398            OrderLogType::Filled => "FILLED",
399            OrderLogType::AutoCancelled => "AUTO_CANCELLED",
400        }
401    }
402    /// Creates an enum from field names used in the ProtoBuf definition.
403    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
404        match value {
405            "ORDER_LOG_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
406            "RECEIVED" => Some(Self::Received),
407            "REJECTED" => Some(Self::Rejected),
408            "MERITZ_REJECTED" => Some(Self::MeritzRejected),
409            "FILLED" => Some(Self::Filled),
410            "AUTO_CANCELLED" => Some(Self::AutoCancelled),
411            _ => None,
412        }
413    }
414}
415/// 주문 타입 (신규/정정/취소)
416/// Rust 코드에는 정의되지 않았지만, OrderLog에 사용되므로 정의 가정
417#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
418#[repr(i32)]
419pub enum OrderType {
420    Unspecified = 0,
421    /// 신규
422    New = 1,
423    /// 정정
424    Amend = 2,
425    /// 취소
426    Cancel = 3,
427}
428impl OrderType {
429    /// String value of the enum field names used in the ProtoBuf definition.
430    ///
431    /// The values are not transformed in any way and thus are considered stable
432    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
433    pub fn as_str_name(&self) -> &'static str {
434        match self {
435            OrderType::Unspecified => "ORDER_TYPE_UNSPECIFIED",
436            OrderType::New => "NEW",
437            OrderType::Amend => "AMEND",
438            OrderType::Cancel => "CANCEL",
439        }
440    }
441    /// Creates an enum from field names used in the ProtoBuf definition.
442    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
443        match value {
444            "ORDER_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
445            "NEW" => Some(Self::New),
446            "AMEND" => Some(Self::Amend),
447            "CANCEL" => Some(Self::Cancel),
448            _ => None,
449        }
450    }
451}
452include!("kdo.v1.order_log.tonic.rs");
453include!("kdo.v1.order_log.serde.rs");
454// @@protoc_insertion_point(module)