Skip to content
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/clob/types/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use bon::Builder;
use chrono::{DateTime, NaiveDate, Utc};
use serde::{Deserialize, Deserializer, Serialize};
use serde_with::{
DefaultOnError, DefaultOnNull, NoneAsEmptyString, TimestampMilliSeconds, TimestampSeconds,
TryFromInto, serde_as,
DefaultOnError, DefaultOnNull, DisplayFromStr, NoneAsEmptyString, TimestampMilliSeconds,
TimestampSeconds, TryFromInto, serde_as,
};
use sha2::{Digest as _, Sha256};
use uuid::Uuid;
Expand Down Expand Up @@ -378,6 +378,10 @@ pub struct TradeResponse {
pub status: TradeStatusType,
#[serde_as(as = "TimestampSeconds<String>")]
pub match_time: DateTime<Utc>,
/// Match time with nanosecond precision (nanoseconds since epoch).
#[serde(default)]
#[serde_as(deserialize_as = "DefaultOnNull<DisplayFromStr>")]
pub match_time_nano: u64,
Comment thread
cursor[bot] marked this conversation as resolved.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry if that wasn't clear earlier, you could have kept the Option<u64> but this works too

#[serde_as(as = "TimestampSeconds<String>")]
pub last_update: DateTime<Utc>,
pub outcome: String,
Expand Down
Loading