wisespace-io / binance-rs

Rust Library for the Binance API
Other
640 stars 290 forks source link

Add get_agg_trades for spot api #131

Closed chipshort closed 2 years ago

chipshort commented 2 years ago

I saw the get_agg_trades call was only implemented for futures, not for spot.

The code is mostly just copy-pasted from the futures api, except for one additional field and the fact that I don't return an enum. Is there a reason to have the Vectors wrapped in an enum with one variant?

wisespace-io commented 2 years ago

@chipshort I think it was due how user would destruct the response and access the vector. How would work with your solution? You did not include an example.

chipshort commented 2 years ago

Just added an example. As you can see, not using the enum avoids matching a second time (as can be seen in the Klines example below mine) If you prefer having it the same way in the library, I can add an enum, but I think there is no practical reason to have it, as you can just directly destructure the result to get the vector.