Closed sebastianbachmann closed 1 year ago
Hey :wave:
Thanks for posting this issue. After a brief look I think your codebase is pointing to a wrong module name(Streamer.Binance.OrderResponse
based on error). The Streamer
application doesn't have the Streamer.Binance.OrderResponse
struct - that struct it's part of the Binance
package/module - could you please double check your aliases as I believe that you are probably doing something like:
alias Streamer.Binance
which now will collide with the Binance
module from the Binance
package. That's my best guess - Elixir gets confused then when you refer to Binance.OrderResponse
thinking that it needs to expand the module name(based on the alias alias Streamer.Binance
that doesn't appear in the book/codebase to avoid this issue) to Streamer.Binance.OrderResponse
instead of looking at the Binance
module.
Please let me know was this correct assumption and clear explanation
Hey đ
i've had some aliases defined - somehow this happens automagically đ¤ - but removed them and ended up with those two
alias Streamer.Binance.TradeEvent
alias Decimal, as: D
as pointed out in the book. But the error message still exists. I've pushed the source code with my current state, and if you don't mind please have a look, if you have some time. Thanks!
I am using the following versions of Elixir and OTP
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]
Elixir 1.15.4 (compiled with Erlang/OTP 26)
Hello again :wave:
Thanks for more info and pushing the code, So after reviewing the changes I realised that you are using version 2(or newer) of the binance
module:
The book is using version 1.x:
Version two was released recently and I didn't update the book to work with it (yet :thinking:). After quick comparison of the source code I can see that the version 1.x contains the Binance.OrderResponse
module:
https://github.com/dvcrn/binance.ex/blob/v1/lib/binance/order_response.ex#L1
Where the version 2.0 moved it to Binance.Structs.OrderResponse
:
https://github.com/dvcrn/binance.ex/blob/master/lib/binance/structs/order_response.ex#L1
Both structs appear to look exactly the same so probably you could update all references through rest of the book to contain .Structs
submodule when referring to data returned from Binance module. Otherwise, most likely it would be easier to downgrade the binance
module version to 1.x in your mix.exs
file.
Please let me know have I got it right this time :slightly_smiling_face:
Hello đ
Yikes, this was totally my fault, sorry đ
I've downgraded to 1.x because updating the references to contain the submodule .Structs
would lead to another error within e.g. the Tuple .order_limit_buy()
{:ok, %Binance.OrderResponse{} = order} =
Binance.order_limit_buy(symbol, quantity, price, ~c"GTC") # there was an error raised i could not solve
Thanks, i appreciate your help đâď¸
No need to be sorry - happens to best of us! :slightly_smiling_face:
Thank you for taking time to read my book and best of luck on your Elixir journey :rocket:
Hello,
i am currently working through the book and i am stuck within chapter 02 Create a naive traing strategy on page 27.
When i am running
iex -S mix
the compiler is complaining aboutI looked into the Binance folder within
deps/binance/lib/binance/structs/order_response.ex
and found theOrderResponse
struct, so i am not really sure what i am missing.Appreciate your help, thanks!