Unknown contract proposal
hi
i'm trying the deriv-api for first time
i tried the example bot it works fine
https://github.com/binary-com/deriv-api/blob/master/examples/a_simple_bot.js
but i want to buy another contract if the first contract is loss
so i've added this
if (status === "lost") { const contract2 = await api.contract({ contract_type: 'CALL', amount: 10, duration: 5, currency:'USD', duration_unit: 't', symbol: 'frxEURJPY', basis: 'stake', }); const buy2 = await contract2.buy(); await contract2.onUpdate().pipe(find(({ is_sold }) => is_sold)).toPromise(); const { profit, status } = contract2; console.log(`You ${status}: ${profit.currency} ${profit.display}`); }
but i get error like this
{ echo_req: { buy: '30927f91-3623-98c1-4244-58ed4862ef16', price: 10, req_id: 12 }, error: { code: 'InvalidContractProposal', message: 'Unknown contract proposal' }, msg_type: 'buy', req_id: 12 }
but when i change any of the paramas in contract it buys the contract but i don't want to change the params
what am i doin wrong here
Comments
@iotleasp Just double checking. It only happens when the second buy is the same contract details as the previous buy?
yes, i thought the 2 contract start time would be the present time which would be different from the first proposal but i get error if i change the params then i won't get any errors
@iotleasp Could you share your full source code here or at a pastebin service so we can reproduce the error and inspect more?