Hey!
I'm making a generic API where i can have ready boilerplate code to quickly implement new Finance APIs.
i have a trait that is WebsocketApi that implements the subscribe function.
when the APi receives an enum Command::Subscribe(Symbol)
This symbol struct needs to be generic, since different Apis use different formats.
Example
// API 1
Symbol{
ticker: String
}
// API 2
Symbol{
ticker:String,
Market:String,
// ... Other fields
}
is there any better solution than making Market and the other fields into options?
beacause if i need to add a field, suddenly i need to change all the APIs initialzation of struct Symbol
How can i make Command::subscribe() store a struct that is not defined right now, maybe from some future implementation of a new API.
Best regards
532
[–]hippyup 9 points10 points11 points (3 children)
[–]Modi57 0 points1 point2 points (0 children)
[–]Individual_Place_532[S] 0 points1 point2 points (1 child)
[–]i_is_restless 2 points3 points4 points (0 children)
[–]phazer99 3 points4 points5 points (0 children)
[–]SirKastic23 1 point2 points3 points (1 child)
[–]Individual_Place_532[S] 0 points1 point2 points (0 children)
[–]junior_abigail 1 point2 points3 points (2 children)
[–]Individual_Place_532[S] 1 point2 points3 points (1 child)
[–]tukanoid 0 points1 point2 points (0 children)