binance-exchange / binance-java-api

binance-java-api is a lightweight Java library for the Binance API, supporting synchronous and asynchronous requests, as well as event streaming using WebSockets.
MIT License
834 stars 627 forks source link

Using multi thread to stream OneSymbol in each thread or using one thread to stream many symbols #411

Open naserkaka opened 2 years ago

naserkaka commented 2 years ago

Hi , I just need some tips about best practice. I would like to

  1. stream many different symbols with socket
  2. create a task in the socket that checks if marketprice = myTargetPrice -> send Order to Binance else end task

Which approach is recommended? Approach 1. Using Multi-thread , each thread for streaming each Symbol and rest of the logic Approach 2. Using One single thread that streams all the symbols in one socket and rest of the logic ?