@@ -206,12 +206,21 @@ pub struct Market {
206206 /// Total contracts traded.
207207 #[ serde( default ) ]
208208 pub volume : Option < i64 > ,
209+ /// Total contracts traded (fixed-point decimal string).
210+ #[ serde( default ) ]
211+ pub volume_fp : Option < String > ,
209212 /// 24-hour trading volume.
210213 #[ serde( default ) ]
211214 pub volume_24h : Option < i64 > ,
215+ /// 24-hour trading volume (fixed-point decimal string).
216+ #[ serde( default ) ]
217+ pub volume_24h_fp : Option < String > ,
212218 /// Contracts outstanding.
213219 #[ serde( default ) ]
214220 pub open_interest : Option < i64 > ,
221+ /// Contracts outstanding (fixed-point decimal string).
222+ #[ serde( default ) ]
223+ pub open_interest_fp : Option < String > ,
215224
216225 /// Notional value per contract in dollars.
217226 #[ serde( default ) ]
@@ -592,6 +601,9 @@ pub struct Trade {
592601 pub price : Option < f64 > ,
593602 /// Contract quantity.
594603 pub count : i64 ,
604+ /// Contract quantity (fixed-point decimal string).
605+ #[ serde( default ) ]
606+ pub count_fp : Option < String > ,
595607 /// Yes side price in cents.
596608 pub yes_price : i64 ,
597609 /// No side price in cents.
@@ -798,9 +810,15 @@ pub struct Candlestick {
798810 /// Trading volume during the period.
799811 #[ serde( default ) ]
800812 pub volume : Option < i64 > ,
813+ /// Trading volume during the period (fixed-point decimal string).
814+ #[ serde( default ) ]
815+ pub volume_fp : Option < String > ,
801816 /// Open interest at end of period.
802817 #[ serde( default ) ]
803818 pub open_interest : Option < i64 > ,
819+ /// Open interest at end of period (fixed-point decimal string).
820+ #[ serde( default ) ]
821+ pub open_interest_fp : Option < String > ,
804822}
805823
806824/// Response from GET /series/{series_ticker}/markets/{ticker}/candlesticks.
@@ -837,6 +855,9 @@ pub struct GetCandlesticksParams {
837855 pub end_ts : i64 ,
838856 /// Candlestick period interval.
839857 pub period_interval : CandlestickPeriod ,
858+ /// Include synthetic candlestick before start_ts for price continuity.
859+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
860+ pub include_latest_before_start : Option < bool > ,
840861}
841862
842863impl GetCandlesticksParams {
@@ -868,15 +889,27 @@ impl GetCandlesticksParams {
868889 start_ts,
869890 end_ts,
870891 period_interval,
892+ include_latest_before_start : None ,
871893 } )
872894 }
873895
896+ /// Include synthetic candlestick before start_ts for price continuity.
897+ #[ must_use]
898+ pub fn include_latest_before_start ( mut self , include : bool ) -> Self {
899+ self . include_latest_before_start = Some ( include) ;
900+ self
901+ }
902+
874903 #[ must_use]
875904 pub fn to_query_string ( & self ) -> String {
876905 let mut qb = QueryBuilder :: new ( ) ;
877906 qb. push ( "start_ts" , self . start_ts ) ;
878907 qb. push ( "end_ts" , self . end_ts ) ;
879908 qb. push ( "period_interval" , self . period_interval . as_minutes ( ) ) ;
909+ qb. push_opt (
910+ "include_latest_before_start" ,
911+ self . include_latest_before_start ,
912+ ) ;
880913 qb. build ( )
881914 }
882915}
@@ -1091,13 +1124,20 @@ mod tests {
10911124 "status": "active",
10921125 "title": "Will Bitcoin reach $50,000?",
10931126 "volume": 1000,
1094- "open_interest": 500
1127+ "volume_fp": "1000.5",
1128+ "volume_24h": 500,
1129+ "volume_24h_fp": "500.25",
1130+ "open_interest": 250,
1131+ "open_interest_fp": "250.125"
10951132 }"# ;
10961133 let market: Market = serde_json:: from_str ( json) . unwrap ( ) ;
10971134 assert_eq ! ( market. ticker, "KXBTC-25JAN10-B50000" ) ;
10981135 assert_eq ! ( market. market_type, MarketType :: Binary ) ;
10991136 assert_eq ! ( market. status, MarketStatus :: Active ) ;
11001137 assert_eq ! ( market. volume, Some ( 1000 ) ) ;
1138+ assert_eq ! ( market. volume_fp, Some ( "1000.5" . to_string( ) ) ) ;
1139+ assert_eq ! ( market. volume_24h_fp, Some ( "500.25" . to_string( ) ) ) ;
1140+ assert_eq ! ( market. open_interest_fp, Some ( "250.125" . to_string( ) ) ) ;
11011141 }
11021142
11031143 #[ test]
@@ -1152,6 +1192,7 @@ mod tests {
11521192 "trade_id": "abc123",
11531193 "ticker": "KXBTC-25JAN10-B50000",
11541194 "count": 10,
1195+ "count_fp": "10.5",
11551196 "yes_price": 50,
11561197 "no_price": 50,
11571198 "taker_side": "yes",
@@ -1160,6 +1201,7 @@ mod tests {
11601201 let trade: Trade = serde_json:: from_str ( json) . unwrap ( ) ;
11611202 assert_eq ! ( trade. trade_id, "abc123" ) ;
11621203 assert_eq ! ( trade. count, 10 ) ;
1204+ assert_eq ! ( trade. count_fp, Some ( "10.5" . to_string( ) ) ) ;
11631205 assert_eq ! ( trade. taker_side, TakerSide :: Yes ) ;
11641206 }
11651207
0 commit comments