nautilus_dydx/python/
config.rs1use nautilus_model::identifiers::AccountId;
19use pyo3::prelude::*;
20
21use crate::{
22 common::enums::DydxNetwork,
23 config::{DydxDataClientConfig, DydxExecutionClientConfig},
24};
25
26#[pymethods]
27#[pyo3_stub_gen::derive::gen_stub_pymethods]
28impl DydxDataClientConfig {
29 #[new]
31 #[pyo3(signature = (proxy_url=None, network=None))]
32 fn py_new(proxy_url: Option<String>, network: Option<DydxNetwork>) -> Self {
33 Self {
34 network: network.unwrap_or_default(),
35 proxy_url,
36 ..Self::default()
37 }
38 }
39
40 #[getter]
41 const fn has_proxy_url(&self) -> bool {
42 self.proxy_url.is_some()
43 }
44
45 fn __repr__(&self) -> String {
46 stringify!(DydxDataClientConfig).to_string()
47 }
48}
49
50#[pymethods]
51#[pyo3_stub_gen::derive::gen_stub_pymethods]
52impl DydxExecutionClientConfig {
53 #[new]
55 #[pyo3(signature = (
56 account_id,
57 proxy_url=None,
58 network=None,
59 private_key=None,
60 wallet_address=None,
61 subaccount_number=0,
62 ))]
63 fn py_new(
64 account_id: AccountId,
65 proxy_url: Option<String>,
66 network: Option<DydxNetwork>,
67 private_key: Option<String>,
68 wallet_address: Option<String>,
69 subaccount_number: u32,
70 ) -> Self {
71 Self {
72 account_id,
73 network: network.unwrap_or_default(),
74 private_key,
75 wallet_address,
76 subaccount_number,
77 proxy_url,
78 ..Self::default()
79 }
80 }
81
82 #[getter]
83 const fn has_proxy_url(&self) -> bool {
84 self.proxy_url.is_some()
85 }
86
87 fn __repr__(&self) -> String {
88 stringify!(DydxExecutionClientConfig).to_string()
89 }
90}