How to receive stream of open contracts in the Binary API?

Hi.
I created a Bot recently and I am making small adjustments, so I would like to know how it is possible to stream information from an open contract.
I know it is possible using the "subscribe" option at the time of Buy, but what if the websocket disconnects?
Is it possible to reconnect the open contract stream?
I'm using javascript.
I appreciate the collaboration.

Tagged:

Comments

  • Thank you very much @michael_mueller
  • Good morning everyone.

    Sorry for continuing this topic but the solution to the problem did not work.

    Let me explain, the last answer was correct and I am grateful, however what is happening and that the stream (proposal_open_contract) is stopping transmitting one or the other contract after a while with the Bot on, and the Bot depends on the result of the contract to continue, so I used the stream (ohlc) that I check is not crashing and created an alternative to see the result of the contract.

    Now comes the problem that I noticed only today, (proposal_open_contract) only looks at open contracts and I need the result after the contract has already closed. Ex: LOST, WON

    Is there an API query to find out the result of an expired contract?

    Does anyone have any better ideas for the problem of locking the stream (proposal_open_contract)?

    I've done a loop with (setInterval ()) and consulted the contract without (subscribe: 1) and it worked, but this bot runs 72 simultaneous markets and this causes excessive calls and the stream starts to respond with errors.

  • If you want to view the result of an expired contract you can use the same API Call but specify the contract_id

    {
      "proposal_open_contract": 1,
      "contract_id": 102875294068,
    }
    
  • @michael_mueller said:
    If you want to view the result of an expired contract you can use the same API Call but specify the contract_id

    {
      "proposal_open_contract": 1,
      "contract_id": 102875294068,
    }
    

    Hello good Morning.
    Thank you very much for the suggestion, I will improve my script because I was already asking for the contract id at the time of opening. Now it's easier.

  • Hello good Morning.
    With that I conclude and solve this problem

Sign In or Register to comment.