pub struct AccountActivity {
pub key: String,
pub seq: Option<i64>,
pub account_number: Option<String>,
pub message_type: Option<String>,
pub message_data: Option<String>,
pub extra: HashMap<String, Value>,
}Expand description
An ACCT_ACTIVITY order event. message_data is JSON serialized
into a string for order events and plain text for errors; see
AccountActivity::message for the parsed form.
Fields§
§key: StringThe subscription key (field 0).
seq: Option<i64>§account_number: Option<String>§message_type: Option<String>OrderCreated, OrderAccepted, OrderFillCompleted, …
message_data: Option<String>§extra: HashMap<String, Value>Fields the table does not describe, by wire key.
Implementations§
Source§impl AccountActivity
impl AccountActivity
Sourcepub fn from_content(content: &DataContent) -> Result<Self, Error>
pub fn from_content(content: &DataContent) -> Result<Self, Error>
Decode a content item using AcctActivityFields::FIELDS.
Source§impl AccountActivity
impl AccountActivity
Sourcepub fn message(&self) -> Option<Map<String, Value>>
pub fn message(&self) -> Option<Map<String, Value>>
message_data parsed as the JSON object an order event carries, or
None when it is absent or plain text (subscription errors).
use rustyschwab_types::streaming::AccountActivity;
let event = AccountActivity {
message_type: Some("OrderCreated".into()),
message_data: Some(r#"{"SchwabOrderID":"1003811730601"}"#.into()),
..Default::default()
};
assert_eq!(event.message().unwrap()["SchwabOrderID"], "1003811730601");
let rejected = AccountActivity {
message_data: Some("Subscription rejected: bad key".into()),
..Default::default()
};
assert!(rejected.message().is_none());Trait Implementations§
Source§impl Clone for AccountActivity
impl Clone for AccountActivity
Source§impl Debug for AccountActivity
impl Debug for AccountActivity
Source§impl Default for AccountActivity
impl Default for AccountActivity
Source§impl<'de> Deserialize<'de> for AccountActivity
impl<'de> Deserialize<'de> for AccountActivity
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for AccountActivity
Available on crate feature schemars only.
impl JsonSchema for AccountActivity
Available on crate feature
schemars only.Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for AccountActivity
impl PartialEq for AccountActivity
Source§impl Serialize for AccountActivity
impl Serialize for AccountActivity
impl StructuralPartialEq for AccountActivity
Auto Trait Implementations§
impl Freeze for AccountActivity
impl RefUnwindSafe for AccountActivity
impl Send for AccountActivity
impl Sync for AccountActivity
impl Unpin for AccountActivity
impl UnsafeUnpin for AccountActivity
impl UnwindSafe for AccountActivity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more