rodrigo-brito / ninjabot

A fast trading bot platform for cryptocurrency in Go (Binance)
https://rodrigo-brito.github.io/ninjabot/
MIT License
1.4k stars 175 forks source link

Update orders status with user data stream #131

Open rodrigo-brito opened 2 years ago

rodrigo-brito commented 2 years ago

In the discussion https://github.com/rodrigo-brito/ninjabot/discussions/130, @davidxiao suggest to use Binance user stream instead of orders polling.

When we have orders with status PENDNG, the bot will poll from Binance the order status each second. It can be replaced by a stream that receive updates from Binance.

We found the logic here: https://github.com/rodrigo-brito/ninjabot/blob/1a3585bedbaf66ba35e9377635877aa688e5a1e0/order/controller.go#L278-L287

davidxiao commented 2 years ago

hi, @rodrigo-brito ,

to confirm:

use Binance user stream as alternative? or replace polling with Binance user stream?

just in case there are any scenarios beyond my thoughts where polling is better, so keep polling is necessary,

rodrigo-brito commented 2 years ago

I think we can replace it.

davidxiao commented 2 years ago

sorry, i can not work on this because i am busy with my other staff, considering it's only improvement and not urgent, so maybe close it,