API - Buy Contract
Hi,
I have a technical question in regards to the API for buy contract. In the Buy Contract API, the required JSON schema to pass as shown below.
My questions are:
What is Contract_type?
Can you give me a list valid contract type?
I will only trade on Rise/Fall type, where and what value should I pass in if I wanted to buy a rise binary option?
Regards,
Eng Tang
I am currently registered with a virtual account, but will upgrade to real account.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"title": "Buy a Contract Send",
"description": "Buy a Contract",
"properties": {
"buy": {
"type": "string",
"pattern": "^(?:[\w-]{32,128}|1)$",
"description": "Either the id received from a Price Proposal (proposal) call, or 1 if contract buy parameters are passed in the parameters field",
"required": "1"
},
"price": {
"type": "number",
"description": "Maximum price at which to purchase the contract.",
"required": "1"
},
"parameters": {
"type": "object",
"description": "Optional field, used to pass the parameters for contract buy",
"properties": {
"amount": {
"type": "number",
"description": "Proposed payout or stake value"
},
"basis": {
"description": "Indicate whether amount is 'payout' or 'stake'",
"enum": [
"payout",
"stake"
]
},
"contract_type": {
"type": "string",
"description": "A valid contract-type",
"pattern": "^\w{2,30}$",
"required": "1"
},
"currency": {
"type": "string",
"description": "This can only be the account-holder's currency",
"pattern": "^[A-Z]{3}$",
"required": "1"
},
"date_start": {
"type": "integer",
"description": "For forward-starting contracts, epoch value of the starting time of the contract."
},
"date_expiry": {
"type": "integer",
"description": "Epoch value of the expiry time of the contract. You must either specify date_expiry or duration."
},
"duration": {
"type": "integer",
"description": "Duration quantity"
},
"duration_unit": {
"description": "Duration unit is s(seconds), m(minutes), h(hours), d(days), t(ticks)",
"enum": [
"d",
"m",
"s",
"h",
"t"
]
},
"symbol": {
"type": "string",
"description": "Symbol code",
"pattern": "^\w{2,30}$",
"required": "1"
},
"barrier": {
"type": "string",
"description": "Barrier for the contract (or last digit prediction for digit contracts). Contracts less than 24 hours in duration would need a relative barrier (barriers which need +/-), meaning that the entry spot would be adjusted accordingly with that amount to define a barrier.",
"pattern": "^[+-]?\d+\.?\d$"
},
"barrier2": {
"type": "string",
"pattern": "^[+-]?\d+\.?\d$",
"description": "Low barrier for the contract (for contracts with two barriers). Contracts less than 24 hours in duration would need a relative barrier (barriers which need +/-), meaning that the entry spot would be adjusted accordingly with that amount to define a barrier."
},
"amount_per_point": {
"type": "number",
"description": "[For spread contracts only] Amount per point"
},
"stop_type": {
"description": "[For spread contracts only] Stop type (dollar or point)",
"enum": [
"dollar",
"point"
]
},
"stop_profit": {
"type": "number",
"description": "[For spread contracts only] Stop profit amount"
},
"stop_loss": {
"type": "number",
"description": "[For spread contracts only] Stop loss amount"
}
}
},
"passthrough": {
"type": "object",
"description": "Optional field, used to pass data through the websocket, which may be retrieved via the echo_req output field."
},
"req_id": {
"type": "integer",
"description": "Optional field to map request to response"
}
},
"additionalProperties": false
}
Comments
Hello.
This is the list I have.
`Up/Down
Rise/Fall
"contract_type":"CALL"
"contract_type":"PUT"
Toutch/No Touch
"contract_type":"ONETOUCH"
"contract_type":"NOTOUCH"
In/Out
Ends In/Out
"contract_type":"EXPIRYRANGE"
"contract_type":"EXPIRYMISS
Stays In/Goes Out
contract_type":"RANGE"
"contract_type":"UPORDOWN"
Asians
"contract_type":"ASIANU"
"contract_type":"ASIAND"
Digits
Matches/Differs
"contract_type":"DIGITMATCH"
"contract_type":"DIGITDIFF"
Even/Odd
"contract_type":"DIGITODD"
"contract_type":"DIGITEVEN"
Over/Under
"contract_type":"DIGITOVER"
"contract_type":"DIGITUNDER"
Spreads
"contract_type":"SPREADU"
"contract_type":"SPREADD"`
Regards
Thanks.
Hey! great addition, the Deriv API documentation is complex to decript. Can you also paste how the parameters are passed to the types of contracts they accept. I keep getting a lot of messages like:
ResponseError: Missing required contract parameters
thank you!
Other contract : MULTUP, MULTDOWN, UPORDOWN, EXPIRYRANGE, ONETOUCH, CALLE, LBHIGHLOW, ASIAND, EXPIRYRANGEE, DIGITDIFF, DIGITMATCH, DIGITOVER, PUTE, DIGITUNDER, NOTOUCH, CALL, RANGE, LBFLOATPUT, DIGITODD, PUT, ASIANU, LBFLOATCALL, EXPIRYMISSE, EXPIRYMISS, DIGITEVEN, TICKHIGH, TICKLOW, RESETCALL, RESETPUT, CALLSPREAD, PUTSPREAD, RUNHIGH, RUNLOW, ACCU, VANILLALONGCALL, VANILLALONGPUT
Update 01-2023