Skip to content

Commit bfffe23

Browse files
committed
use humantime for interval serde
1 parent 0e9475e commit bfffe23

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lazer/sdk/rust/protocol/src/jrpc.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ pub enum UpdateParams {
4040
FundingRateUpdate {
4141
price: Option<Price>,
4242
rate: Rate,
43+
#[serde(default = "default_funding_rate_interval", with = "humantime_serde")]
4344
funding_rate_interval: Option<Duration>,
4445
},
4546
}
4647

48+
fn default_funding_rate_interval() -> Option<Duration> {
49+
None
50+
}
51+
4752
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq)]
4853
pub struct Filter {
4954
pub name: Option<String>,
@@ -278,10 +283,7 @@ mod tests {
278283
"type": "funding_rate",
279284
"price": 1234567890,
280285
"rate": 1234567891,
281-
"funding_rate_interval": {
282-
"secs": 28800,
283-
"nanos": 0
284-
}
286+
"funding_rate_interval": "8h"
285287
}
286288
},
287289
"id": 1

0 commit comments

Comments
 (0)