Closed ainestal closed 7 years ago
I'm also introducing tests in the source files directly.
Hello! What is your use case ? Because your to_string()
method is just a call to the format! macro. For my usage, I'm already happy with the utils
mod inside each exchanges. Using this module I can retrieve the Pair (get_currency_enum
) or the String (get_currency_string
) according to the rules specified by the exchange (XBT for Kraken, ...)
Hi @hugues31 . I'm using this for 2 main reasons:
to_string()
and from_str()
are very common methods and I think it's good to have them available.Working with strings simplifies doing this second point. Instead of having lots of nested matches is possible just to split on _
. I can create a PR for this second scenario
This is a convenient way to convert to String and from
&str
toPair
andCurrency
.This implementation is in the generic level, transforming the common names that Coinnect uses for Currency and Pair. This may differ from specific names of specific exchanges, i.e: this will convert
"BTC"
toCurrency::BTC
, it will not convert from"XBT"
, as Kraken calls the Bitcoin.This is something I'm doing directly in binaries using the library but I understand it belongs in the library itself.