You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NewClient in alpaca/rest.go accepts a ClientOpts struct, where as NewStocksClient in marketdata/stream/client.go accepts a variadic list of stock options.
In the land of dreams and ideas, I'd like an approach where some of the option types, such as credentials, were re-usable across different client types.
@ndewet You are absolutely right, this duality is indeed unfortunate. Honestly, I'm not sure if it's worth the effort to fix this though. That being said, I'll list some suggestions if we / anyone ever wants to pick this up:
This can be fixed in a backward-compatible way by adding new constructors for the non-stream clients, e.g. alpaca.NewClientWithOptions().
The difficulty with using the same option types is that we have 3 packages (alpaca, marketdata and stream). Probably the best way to cope with this would be to define the base option type and any common options (e.g. WithCredentials) in the alpaca package and use them in marketdata and stream.
NewClient
inalpaca/rest.go
accepts aClientOpts
struct, where asNewStocksClient
inmarketdata/stream/client.go
accepts a variadic list of stock options.NewClient
:NewStocksClient
:Please note that
WithCredentials
andAPIKey
+APISecret
are just different enough to cause confusion.I by far prefer the variadic list approach.
The text was updated successfully, but these errors were encountered: