polyester/models/
market.rs1use crate::types::{Price, Quantity};
4use serde_json::Value;
5
6#[derive(Debug, Clone, Default)]
8pub struct GetCandlesOpts {
9 pub symbol: Option<String>,
10 pub symbol_id: Option<u32>,
11 pub timeframe: String,
13 pub limit: Option<u32>,
14 pub start: Option<i64>,
16 pub end: Option<i64>,
18 pub include_incomplete: bool,
19 pub page_token: Option<String>,
20}
21
22#[derive(Debug, Clone, Default)]
24pub struct GetTradesOpts {
25 pub symbol: Option<String>,
26 pub symbol_id: Option<u32>,
27 pub limit: Option<u32>,
28 pub start: Option<i64>,
30 pub end: Option<i64>,
32 pub page_token: Option<String>,
33}
34
35#[derive(Debug, Clone, PartialEq)]
37pub struct SpotConfig {
38 pub raw: Value,
39}
40
41#[derive(Debug, Clone, PartialEq, Eq)]
42pub struct Candle {
43 pub ts_sec: i64,
44 pub open: String,
45 pub high: String,
46 pub low: String,
47 pub close: String,
48 pub volume: String,
49 pub symbol_id: u32,
50 pub timeframe: String,
51}
52
53#[derive(Debug, Clone, PartialEq, Eq)]
54pub struct CandlesResult {
55 pub symbol_id: u32,
56 pub timeframe: String,
57 pub candles: Vec<Candle>,
58 pub next_page_token: String,
59}
60
61#[derive(Debug, Clone, PartialEq, Eq)]
62pub struct MarketTrade {
63 pub symbol_id: u32,
64 pub match_id: String,
65 pub price: Option<Price>,
66 pub qty: Option<Quantity>,
67 pub ts_ns: String,
68 pub side: String,
69}
70
71#[derive(Debug, Clone, PartialEq, Eq)]
72pub struct MarketTradesResult {
73 pub trades: Vec<MarketTrade>,
74 pub next_page_token: String,
75}
76
77#[derive(Debug, Clone, PartialEq, Eq)]
78pub struct MarketOverviewEntry {
79 pub symbol_id: u32,
80 pub symbol: String,
81 pub last_price: Option<Price>,
82}
83
84#[derive(Debug, Clone, PartialEq, Eq)]
85pub struct MarketOverviewList {
86 pub markets: Vec<MarketOverviewEntry>,
87 pub next_page_token: String,
88}
89
90#[derive(Debug, Clone, PartialEq, Eq)]
91pub struct OrderbookLevel {
92 pub price: Option<Price>,
93 pub qty: Option<Quantity>,
94}
95
96#[derive(Debug, Clone, PartialEq, Eq)]
97pub struct OrderbookData {
98 pub symbol: String,
99 pub depth: u32,
100 pub book_seq: String,
101 pub bids: Vec<OrderbookLevel>,
102 pub asks: Vec<OrderbookLevel>,
103}