deriv-com / deriv-api

Websocket API for deriv.app
MIT License
53 stars 91 forks source link

Support for trade types such as rise/fall and matches/differs #209

Closed AlvinKimata closed 10 months ago

AlvinKimata commented 11 months ago

Can anyone suggest an approach to incorporate various trade types like "rise/fall" and "matches/differs" using the deriv API library? If you have any ideas, kindly share a code snippet or provide guidance on how to implement these trade types effectively. Your guidance on integrating these trade types would be much appreciated.

JamesK254 commented 10 months ago

you can simply create contract like this: contract_options = { contract_type: "DIGITDIFF", currency: "USD", amount: 2, duration_unit: "t", duration: 5, symbol: "R_10", basis: "stake", barrier: "5", };

then after connecting to the api, use the api variable as follows: await api.contract(contract_options ) const buy = await contract.buy();

this would buy a DIGITDIFF contract with a duration of 5 ticks. barrier being the prediction you can use CALL (rise) and PUT(fall) contract_type

AlvinKimata commented 10 months ago

Thanks a lot @JamesK254 . It worked for me.