Best Of
Re: Help with buy/sell contract
The API isn't easy, but it is relatively complete. People aren't going to spoon-feed you, so you need to read the docs and cross reference the info for yourself. For example, you ask about valid contract types... there is an API call called Contracts For Symbol. You ought to have been able to find that on your own.
I said we wouldn't spoon-feed you, but you seem to need a boost so here is roughly what I do...
- Call Active Symbols to get the list of active symbols.
- Call Contracts For Symbol to see what sort of contracts I can buy for the symbol I am interested in.
- Call Price Proposal to get the current payout level for the contract I am interested in. Setting "subscribe": 1 gives me regular updates.
- Call Buy Contract to open a trade. Note the contract_id from the response.
- Call Price Proposal - Open Contract with "subscribe": 1 in order to receive updates on the status of the trade. Some contracts can be resold before their expiration, others can't. Either way this call is the fastest way of finding out whether the trade has been won - check the responses for exit_tick and compare it to entry_tick.
Another way of finding out whether a contract has been won is to subscribe to the Transactions stream, but there is always a delay between the contract expiry and the resulting payout being added to your account. Sometimes this delay can be several minutes long. The Sell expired contracts call can be used to speed this up when necessary.
@Raunak I assume you are talking about the ask_price of the contract, not the spot price of the underlying market. In which case, your comment isn't relevant, because with basis=stake the ask_price is never going to change. Besides the price you send in the buy request is the maximum you are willing to pay, so sending 1 when the contract only accepts .98 would not be a problem. But maybe I have totally misunderstood your rather cryptic comment.
Maybe someone could write up an API walkthrough explaining (much like I did here) which parts of the API to use, and in what order, in order to place a trade etc.
Re: Error on buy contract in v3
That error is becase you're not authorized correctly.
Do you get this when you send authorize query.
{ "echo_req": { "authorize": "345dfd34sdfs" }, "authorize": { "scopes": [ "read", "admin", "trade", "payments" ], "currency": "USD", "email": "youremail@gmail.com", "balance": "35454.6000", "landing_company_name": "fog", "loginid": "VRTC434553", "fullname": " ", "is_virtual": 1 }, "msg_type": "authorize" }
Regards
Re: API request limits
You can get it by a website_status api call. Please check the call here:
https://developers.binary.com/api/#website_status