"message": "Unknown contract proposal"
Hello all!
I am trying to make a small piece of software that open trades on Digits. ( Match last digit )
I am doing this:
- Check a proposal:
{ "proposal": 1, "amount": "100", "basis": "payout", "contract_type": "DIGITMATCH", "currency": "USD", "duration": "5", "duration_unit": "t", "symbol": "R_100", "barrier": 1 }
Than i get this as response:
{ "echo_req": { "amount": "100", "barrier": 1, "basis": "payout", "contract_type": "DIGITMATCH", "currency": "USD", "duration": "5", "duration_unit": "t", "proposal": 1, "symbol": "R_100" }, "msg_type": "proposal", "passthrough": {}, "proposal": { "ask_price": "11.00", "date_start": 1473740518, "display_value": "11.00", "id": "fab2c6b0-29d1-2009-427f-3353df38fa1a", "longcode": "Win payout if the last digit of Volatility 100 Index is 1 after 5 ticks.", "payout": "100", "spot": "38239.87", "spot_time": 1473740518 } }
Than i want to buy it using the "id": "fab2c6b0-29d1-2009-427f-3353df38fa1a",
{ "buy": "fab2c6b0-29d1-2009-427f-3353df38fa1a", "price": 100 }
But than i get this response:
{ "echo_req": { "buy": "fab2c6b0-29d1-2009-427f-3353df38fa1a", "price": 100 }, "error": { "code": "InvalidContractProposal", "message": "Unknown contract proposal" }, "msg_type": "buy" }
Why is this?
What can i do? What can i do better?
Many thanks!
Comments
@kevintimmer You are doing it properly as this is the correct sequence but please check if you are missing for example when you send proposal and then buy they should be on same connection i.e no new connection or connection was not lost. If you send proposal and then don't send anything for sometime say 1 minute as you are not sending
subscribe
in proposal then websocket connection automatically closes and if you send buy over new connection then that proposal is lost.Second, please check if you are not sending any forget call for proposal
Hello @kevintimmer,
I am new to binary.com and facing the same issue as you're facing. first if all I would like to inform you that I am using this fields http://vps445297.ovh.net/index.html .
From your request JSON,
i get to know about how to map parameters from binary API to my form.
Thanks for that.
Can you please let me know how further fields from my form will map to fields from binary API?
From your JSON I get to know that
amount = Amount from my form
symbol = Trade Symbol
currency = Currency
duration = Duration
duration_unit = Duration Unit
barrier = Barrier 1 Offset
But how can I map Max Loss, Max Trades?
DIRECT BUY use:
{
"parameters": {
"amount": 1,
"basis": "stake",
"contract_type": "DIGITODD",
"currency": "USD",
"duration": 5,
"duration_unit": "t",
"symbol": "R_10"
},
"price": 1,
"buy": "1"
}
capture websocket on message with (data.proposal_open_contract)