1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
* Ethereal Exchange API
*
* Ethereal HTTP API for real-time trading, order management, and market data access.
*
* The version of the OpenAPI document: 0.1.0
*
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProductDto {
/// Id representing the registered product
#[serde(rename = "id")]
pub id: uuid::Uuid,
/// Product ticker based on the base quote token
#[serde(rename = "ticker")]
pub ticker: String,
/// Product display ticker based on the base quote token
#[serde(rename = "displayTicker")]
pub display_ticker: String,
/// Address of the base token (non-checksummed; zero address if virtual)
#[serde(rename = "baseTokenAddress")]
pub base_token_address: String,
/// Address of quote token (non-checksummed)
#[serde(rename = "quoteTokenAddress")]
pub quote_token_address: String,
/// Name of the base token (e.g. BTC in BTCUSD)
#[serde(rename = "baseTokenName")]
pub base_token_name: String,
/// Name of the quote token (e.g. USD in BTCUSD)
#[serde(rename = "quoteTokenName")]
pub quote_token_name: String,
#[serde(rename = "engineType")]
pub engine_type: models::EngineType,
/// The productId generated onchain after registering for the first time
#[serde(rename = "onchainId")]
pub onchain_id: i32,
/// Block number this product was registered on
#[serde(rename = "blockNumber")]
pub block_number: String,
/// Cumulative funding in USD of the product (precision: 9)
#[serde(rename = "cumulativeFundingUsd")]
pub cumulative_funding_usd: String,
/// Product creation timestamp (ms since Unix Epoch)
#[serde(rename = "createdAt")]
pub created_at: f64,
/// Unix timestamp when funding was last updated
#[serde(rename = "fundingUpdatedAt", skip_serializing_if = "Option::is_none")]
pub funding_updated_at: Option<f64>,
/// The minimum order quantity in native units expressed as a decimal (precision: 9)
#[serde(rename = "minQuantity")]
pub min_quantity: String,
/// Quantity must be divisible by the lotSize in expressed as a decimal (precision: 9)
#[serde(rename = "lotSize")]
pub lot_size: String,
/// Minimum price increment (tickSize) expressed as a decimal (precision: 9)
#[serde(rename = "tickSize")]
pub tick_size: String,
/// Fee charged to the maker on order trades expressed as a decimal (precision: 9)
#[serde(rename = "makerFee")]
pub maker_fee: String,
/// Fee charged to the taker on order trades expressed as a decimal (precision: 9)
#[serde(rename = "takerFee")]
pub taker_fee: String,
/// Max quantity per order in native units expressed as a decimal (precision: 9)
#[serde(rename = "maxQuantity")]
pub max_quantity: String,
/// Min price in USD expressed as a decimal (precision: 9)
#[serde(rename = "minPrice")]
pub min_price: String,
/// Max price in USD expressed as a decimal (precision: 9)
#[serde(rename = "maxPrice")]
pub max_price: String,
/// 24h volume in base token native units expressed as a decimal (precision: 9)
#[serde(rename = "volume24h")]
pub volume24h: String,
/// Maximum leverage allowed for the product
#[serde(rename = "maxLeverage")]
pub max_leverage: f64,
/// Pyth price feed id
#[serde(rename = "pythFeedId")]
pub pyth_feed_id: f64,
/// Last computed hourly funding rate expressed as a decimal (precision: 9)
#[serde(rename = "fundingRate1h")]
pub funding_rate1h: String,
/// OI of both sides in native units expressed as a decimal (precision: 9)
#[serde(rename = "openInterest")]
pub open_interest: String,
/// Max OI of one side in USD expressed as a decimal (precision: 9)
#[serde(rename = "maxOpenInterestUsd")]
pub max_open_interest_usd: String,
/// Max position notional value, in USD expressed as a decimal (precision: 9)
#[serde(rename = "maxPositionNotionalUsd")]
pub max_position_notional_usd: String,
}
impl ProductDto {
pub fn new(
id: uuid::Uuid,
ticker: String,
display_ticker: String,
base_token_address: String,
quote_token_address: String,
base_token_name: String,
quote_token_name: String,
engine_type: models::EngineType,
onchain_id: i32,
block_number: String,
cumulative_funding_usd: String,
created_at: f64,
min_quantity: String,
lot_size: String,
tick_size: String,
maker_fee: String,
taker_fee: String,
max_quantity: String,
min_price: String,
max_price: String,
volume24h: String,
max_leverage: f64,
pyth_feed_id: f64,
funding_rate1h: String,
open_interest: String,
max_open_interest_usd: String,
max_position_notional_usd: String,
) -> ProductDto {
ProductDto {
id,
ticker,
display_ticker,
base_token_address,
quote_token_address,
base_token_name,
quote_token_name,
engine_type,
onchain_id,
block_number,
cumulative_funding_usd,
created_at,
funding_updated_at: None,
min_quantity,
lot_size,
tick_size,
maker_fee,
taker_fee,
max_quantity,
min_price,
max_price,
volume24h,
max_leverage,
pyth_feed_id,
funding_rate1h,
open_interest,
max_open_interest_usd,
max_position_notional_usd,
}
}
}