api.buyContractParams(parameters, 2500).then( // I am guessing you already know how to place a contract
(response, reject) => {
let contract_id = response.buy.contract_id;
});
this will return the following as a response:
You'll see you have subscribed to a bucket load of information which you can use. In your request you want the contract type, so you can do this:
api.getContractInfo(contract_id).then(function (response) {
console.log(response); // full response as shown above
console.log(response.proposal_open_contract.contract_type); // to show the contract type
})
Hi There,
So, once you have a contract open, you can subscribe to it with:
where
contract_id
is collected from:this will return the following as a response:
You'll see you have subscribed to a bucket load of information which you can use. In your request you want the contract type, so you can do this: