Skip to main content

ctrader_rs/
asset.rs

1///
2///
3///
4///
5///
6///
7///
8///
9///
10///
11///
12///
13///
14///
15///
16use crate::payload;
17use crate::proto::common::*;
18use crate::{client::Client, error::Error};
19
20impl Client {
21    /// List all assets for the given account.
22    ///
23    ///
24    ///
25    ///
26    ///
27    ///
28    ///
29    ///
30    ///
31    ///
32    /// Mirrors `ProtoOASymbolsListReq`.
33    pub async fn asset_list(
34        &self,
35        ctid_trader_account_id: i64,
36    ) -> Result<ProtoOaSymbolsListRes, Error> {
37        let req = ProtoOaAssetListReq {
38            ctid_trader_account_id,
39            payload_type: Some(payload::OA_ASSET_LIST_REQ as i32),
40        };
41
42        self.command(payload::OA_ASSET_LIST_REQ, req, payload::OA_ASSET_LIST_RES)
43            .await
44    }
45
46    /// List all symbols for the given account.
47    ///
48    ///
49    ///
50    ///
51    ///
52    ///
53    ///
54    ///
55    ///
56    ///
57    /// Mirrors `ProtoOASymbolsListReq`.
58    pub async fn asset_class_list(
59        &self,
60        ctid_trader_account_id: i64,
61    ) -> Result<ProtoOaAssetClassListRes, Error> {
62        let req = ProtoOaAssetClassListReq {
63            ctid_trader_account_id,
64            payload_type: Some(payload::OA_ASSET_CLASS_LIST_REQ as i32),
65        };
66
67        self.command(
68            payload::OA_ASSET_CLASS_LIST_REQ,
69            req,
70            payload::OA_ASSET_CLASS_LIST_RES,
71        )
72        .await
73    }
74}
75
76#[cfg(test)]
77mod tests {
78
79    #[async_std::test]
80    async fn test() {}
81}