Skip to content

Commit

Permalink
Add price member to api::v2::account_activities::NonTradeActivity
Browse files Browse the repository at this point in the history
It appears that non-trade activities, which the documentation clearly
states are anything but FILLs, can also have a price associated with
them. We have certainly seen that being the case for stock splits,
despite the documentation not making any mention of it.
In order to make this member accessible in a structured way and cutting
down on the need to parse the associated description, this change a
corresponding optional member to the type.
  • Loading branch information
d-e-s-o committed Jul 28, 2022
1 parent 8d08dc7 commit 289ef82
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Unreleased
----------
- Added optional `price` member to
`api::v2::account_activities::NonTradeActivity` type
- Switched to using GitHub Actions as CI provider
- Bumped minimum supported Rust version to `1.57`

Expand Down
5 changes: 5 additions & 0 deletions src/api/v2/account_activities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ pub struct NonTradeActivityImpl<T> {
/// the payment. Not present for other activity types.
#[serde(rename = "qty")]
pub quantity: Option<Num>,
/// The per-share price. Not present on all activities.
#[serde(rename = "price")]
pub price: Option<Num>,
/// For dividend activities, the average amount paid per share. Not
/// present for other activity types.
#[serde(rename = "per_share_amount")]
Expand All @@ -249,6 +252,7 @@ impl<T> NonTradeActivityImpl<T> {
net_amount,
symbol,
quantity,
price,
per_share_amount,
description,
..
Expand All @@ -261,6 +265,7 @@ impl<T> NonTradeActivityImpl<T> {
net_amount,
symbol,
quantity,
price,
per_share_amount,
description,
}
Expand Down

0 comments on commit 289ef82

Please sign in to comment.