Skip to content

Commit

Permalink
add remark field to PushOrderChanged
Browse files Browse the repository at this point in the history
  • Loading branch information
sunli829 committed Apr 15, 2024
1 parent fc94980 commit a8e331e
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 40 deletions.
4 changes: 4 additions & 0 deletions c/csrc/include/longport.h
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,10 @@ typedef struct lb_push_order_changed_t {
* Last price (maybe null)
*/
const struct lb_decimal_t *last_price;
/**
* Remark message
*/
const char *remark;
} lb_push_order_changed_t;

typedef void (*lb_order_changed_callback_t)(const struct lb_trade_context_t*,
Expand Down
8 changes: 8 additions & 0 deletions c/src/trade_context/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ pub struct CPushOrderChanged {
pub last_share: *const CDecimal,
/// Last price (maybe null)
pub last_price: *const CDecimal,
/// Remark message
pub remark: *const c_char,
}

pub struct CPushOrderChangedOwned {
Expand Down Expand Up @@ -100,6 +102,8 @@ pub struct CPushOrderChangedOwned {
account_no: CString,
last_share: Option<CDecimal>,
last_price: Option<CDecimal>,
/// Remark message
pub remark: CString,
}

impl From<PushOrderChanged> for CPushOrderChangedOwned {
Expand Down Expand Up @@ -129,6 +133,7 @@ impl From<PushOrderChanged> for CPushOrderChangedOwned {
account_no,
last_share,
last_price,
remark,
} = order_changed;
CPushOrderChangedOwned {
side,
Expand All @@ -155,6 +160,7 @@ impl From<PushOrderChanged> for CPushOrderChangedOwned {
account_no: account_no.into(),
last_share: last_share.map(Into::into),
last_price: last_price.map(Into::into),
remark: remark.into(),
}
}
}
Expand Down Expand Up @@ -188,6 +194,7 @@ impl ToFFI for CPushOrderChangedOwned {
account_no,
last_share,
last_price,
remark,
} = self;
CPushOrderChanged {
side: (*side).into(),
Expand Down Expand Up @@ -241,6 +248,7 @@ impl ToFFI for CPushOrderChangedOwned {
.as_ref()
.map(ToFFI::to_ffi_type)
.unwrap_or(std::ptr::null()),
remark: remark.to_ffi_type(),
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions cpp/include/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1417,6 +1417,8 @@ struct PushOrderChanged
std::optional<Decimal> last_share;
/// Last price
std::optional<Decimal> last_price;
/// Remark message
std::string remark;
};

/// Options for get history orders request
Expand Down
1 change: 1 addition & 0 deletions cpp/src/convert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,7 @@ convert(const lb_push_order_changed_t* info)
: std::nullopt,
info->last_price ? std::optional{ Decimal(info->last_price) }
: std::nullopt,
info->remark,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class PushOrderChanged {
private String accountNo;
private BigDecimal lastShare;
private BigDecimal lastPrice;
private String remark;

public OrderSide getSide() {
return side;
Expand Down Expand Up @@ -117,12 +118,16 @@ public String getAccountNo() {
return accountNo;
}

public BigDecimal getLastShare() {
return lastShare;
}

public BigDecimal getLastPrice() {
return lastPrice;
}

public BigDecimal getLastShare() {
return lastShare;
public String getRemark() {
return remark;
}

@Override
Expand All @@ -134,7 +139,8 @@ public String toString() {
+ submittedAt + ", updatedAt=" + updatedAt + ", triggerPrice=" + triggerPrice + ", msg=" + msg
+ ", tag=" + tag + ", triggerStatus=" + triggerStatus + ", triggerAt=" + triggerAt + ", trailingAmount="
+ trailingAmount + ", trailingPercent=" + trailingPercent + ", limitOffset=" + limitOffset
+ ", accountNo=" + accountNo + ", lastShare=" + lastShare + ", lastPrice=" + lastPrice + "]";
+ ", accountNo=" + accountNo + ", lastShare=" + lastShare + ", lastPrice=" + lastPrice + ", remark="
+ remark + "]";
}

}
3 changes: 2 additions & 1 deletion java/src/types/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ impl_java_class!(
limit_offset,
account_no,
last_share,
last_price
last_price,
remark
]
);

Expand Down
4 changes: 3 additions & 1 deletion nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ export class WarrantInfo {
/** Quote change rate */
get changeRate(): Decimal
/** Quote change */
get changeVal(): Decimal
get changeValue(): Decimal
/** Volume */
get volume(): number
/** Turnover */
Expand Down Expand Up @@ -2747,6 +2747,8 @@ export class PushOrderChanged {
get lastShare(): Decimal | null
/** Last price */
get lastPrice(): Decimal | null
/** Remark message */
get remark(): string
}
/** Response for submit order request */
export class SubmitOrderResponse {
Expand Down
2 changes: 2 additions & 0 deletions nodejs/src/trade/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ pub struct PushOrderChanged {
/// Last price
#[js(opt)]
last_price: Option<Decimal>,
/// Remark message
remark: String,
}

/// Response for submit order request
Expand Down
40 changes: 5 additions & 35 deletions python/pysrc/longport/openapi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1439,41 +1439,6 @@ class WarrantStatus:
Normal
"""

class WarrantType:
"""
Warrant type
"""

class Unknown(WarrantType):
"""
Unknown
"""

class Call(WarrantType):
"""
Call
"""

class Put(WarrantType):
"""
Put
"""

class Bull(WarrantType):
"""
Bull
"""

class Bear(WarrantType):
"""
Bear
"""

class Inline(WarrantType):
"""
Inline
"""

class SortOrderType:
"""
Sort order type
Expand Down Expand Up @@ -3674,6 +3639,11 @@ class PushOrderChanged:
Last price
"""

remark: str
"""
Remark message
"""


class TimeInForceType:
"""
Expand Down
2 changes: 2 additions & 0 deletions python/src/trade/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ pub(crate) struct PushOrderChanged {
/// Last price
#[py(opt)]
last_price: Option<PyDecimal>,
/// Remark message
remark: String,
}

/// Response for submit order request
Expand Down
2 changes: 2 additions & 0 deletions rust/src/trade/push_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ pub struct PushOrderChanged {
/// Last price
#[serde(with = "serde_utils::decimal_opt_empty_is_none")]
pub last_price: Option<Decimal>,
/// Remark message
pub remark: String,
}

/// Push event
Expand Down

0 comments on commit a8e331e

Please sign in to comment.