architect_api/symbology/
venue.rs1use derive_more::{AsRef, Deref, Display, From, FromStr};
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5#[derive(
7 AsRef,
8 Debug,
9 Display,
10 Deref,
11 Clone,
12 Hash,
13 PartialEq,
14 Eq,
15 PartialOrd,
16 Ord,
17 From,
18 FromStr,
19 Serialize,
20 Deserialize,
21 JsonSchema,
22)]
23#[repr(transparent)]
24#[from(forward)]
25#[deref(forward)]
26#[serde(transparent)]
27#[cfg_attr(feature = "graphql", derive(juniper::GraphQLScalar))]
28#[cfg_attr(feature = "graphql", graphql(transparent))]
29#[cfg_attr(feature = "postgres", derive(postgres_types::ToSql))]
30#[cfg_attr(feature = "postgres", postgres(transparent))]
31#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
32#[cfg_attr(feature = "sqlx", sqlx(transparent))]
33pub struct MarketdataVenue(String);
34
35impl MarketdataVenue {
36 pub fn new(name: String) -> Self {
37 Self(name)
38 }
39}
40
41impl std::borrow::Borrow<str> for MarketdataVenue {
42 fn borrow(&self) -> &str {
43 &self.0
44 }
45}
46
47impl PartialEq<ExecutionVenue> for MarketdataVenue {
48 fn eq(&self, other: &ExecutionVenue) -> bool {
49 self.0 == other.0
50 }
51}
52
53#[derive(
55 AsRef,
56 Debug,
57 Display,
58 Deref,
59 Clone,
60 Hash,
61 PartialEq,
62 Eq,
63 PartialOrd,
64 Ord,
65 From,
66 FromStr,
67 Serialize,
68 Deserialize,
69 JsonSchema,
70)]
71#[repr(transparent)]
72#[from(forward)]
73#[deref(forward)]
74#[serde(transparent)]
75#[cfg_attr(feature = "graphql", derive(juniper::GraphQLScalar))]
76#[cfg_attr(feature = "graphql", graphql(transparent))]
77#[cfg_attr(feature = "postgres", derive(postgres_types::ToSql))]
78#[cfg_attr(feature = "postgres", postgres(transparent))]
79#[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
80#[cfg_attr(feature = "sqlx", sqlx(transparent))]
81pub struct ExecutionVenue(String);
82
83impl ExecutionVenue {
84 pub fn new(name: String) -> Self {
85 Self(name)
86 }
87}
88
89impl std::borrow::Borrow<str> for ExecutionVenue {
90 fn borrow(&self) -> &str {
91 &self.0
92 }
93}
94
95impl PartialEq<MarketdataVenue> for ExecutionVenue {
96 fn eq(&self, other: &MarketdataVenue) -> bool {
97 self.0 == other.0
98 }
99}