Web API
Request description
URL | Description | Available methods |
---|---|---|
rest/help | View human-readable help | GET |
rest/events | Get last events snapshot | GET/POST |
rest/eventSource | Subscribe to events stream via Server-Sent Events | GET/POST |
rest/addSubscription | Add subscription to the created session | GET/POST |
rest/removeSubscription | Remove subscription from the created session | GET/POST |
Output formats
Format | MIME-type |
---|---|
Raw | plain/text |
JSON | application/json |
XML | application/xml |
Output formats can be specified as MIME type in HTTP Accept header or by adding an extension to the end of the URL (except/help).
Examples
Web
Please try web service demo.
Bash
Request
curl -X GET -H 'Accept: application/json' 'https://tools.dxfeed.com/webservice/rest/events.json?events=Candle&symbols=IBM%7B=d%7D&fromTime=20220406&toTime=20220408&indent'
Response
{ "status" : "OK", "Candle" : { "IBM{=d}" : [ { "eventSymbol" : "IBM{=d}", "eventTime" : 0, "eventFlags" : 0, "index" : 7083644893632921600, "time" : 1649289600000, "sequence" : 0, "count" : 11882, "open" : 128.87, "high" : 129.2499, "low" : 126.73, "close" : 128.55, "volume" : 3538317.0, "vwap" : 128.1087564881558, "bidVolume" : 1460308.0, "askVolume" : 1251437.0, "impVolatility" : 0.3374, "openInterest" : "NaN" }, { "eventSymbol" : "IBM{=d}", "eventTime" : 0, "eventFlags" : 0, "index" : 7084015978807296000, "time" : 1649376000000, "sequence" : 0, "count" : 10439, "open" : 128.01, "high" : 128.78, "low" : 127.27, "close" : 127.73, "volume" : 3143309.0, "vwap" : 127.9737192486647, "bidVolume" : 1539279.0, "askVolume" : 804069.0, "impVolatility" : 0.3419, "openInterest" : "NaN" } ] }
Python
import requests url = 'https://tools.dxfeed.com/webservice/rest/events' headers = {'Accept': 'application/json'} r = requests.get(url, headers=headers)
Trade
Request
curl -X GET -H 'Accept: application/json' 'https://tools.dxfeed.com/webservice/rest/events.json?events=Trade&symbols=AAPL&indent'
Response
{ "status" : "OK", "Trade" : { "AAPL" : { "eventSymbol" : "AAPL", "eventTime" : 0, "time" : 1651521600267, "timeNanoPart" : 0, "sequence" : 1663596, "exchangeCode" : "Q", "price" : 157.96, "change" : 0.31, "size" : 7294971.0, "dayVolume" : 1.22156491E8, "dayTurnover" : 1.9058727E10, "tickDirection" : "ZERO_UP", "extendedTradingHours" : false } }