twelvedata.com
Open in
urlscan Pro
2606:4700:e0::ac40:6d0a
Public Scan
Submitted URL: http://twelvedata.com/
Effective URL: https://twelvedata.com/
Submission: On March 12 via api from US — Scanned from DE
Effective URL: https://twelvedata.com/
Submission: On March 12 via api from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
We’ve just launched a new portal to help you explore stocks, crypto, ETFs, and more data Access * AAPL 0.19% (173.07) * BABA 1.64% (76.09) * BTC/USD -1.23% (71225.40) * ETH/USD -2.22% (3974.36) * EUR/USD 0.06% (1.09) * JPM 0.82% (189.84) * SPX 1.09% (5173.52) * SPY 1.10% (516.89) * TSLA -0.46% (176.95) * USD/JPY 0.01% (147.69) * VIX -9.00% (13.85) * V 0.88% (283.03) * XPT/USD 0.03% (925.10) twelvedata * Products Market Data Stocks US & global coverage Forex Physical currency Crypto Digital currency ETFs Exchange-traded fund Indices Index fund Spreadsheets Excel Automatic refreshes Google Sheets Real-time data and work * Developers Documentation Start integrating Twelve Data’s products and tools Resources * WebSocket * Batch requests * Technical indicators * Request builder Guides * Free trial * Historical data * Extended hours data * FAQs * Support * System status * Company * About Twelve Data * Expertise * Careers * Customers * Education * Brand assets * From the blog * * Pricing * * Sign in FINANCIAL DATA THAT DRIVES YOUR SUCCESS ACCESS STOCKS, FOREX AND OTHER FINANCIAL ASSETS FROM ANYWHERE AT ANY TIME. Start now Contact sales Single platform APIS, WEBSOCKET, SDKS UNIFIED FOR ALL FINANCIAL DATA We bring everything together that is required to build a successful trading system, fintech product, and empower your research. Twelve Data’s products include stock, forex, ETF, indices, fundamentals, various spreadsheets add-ins, and everything in between. We also help to build unique solutions, educate, level-up the business, and much more. Start with market data 1. { 2. "symbol": "JPM", 3. "name": "JPMorgan Chase & Co", 4. "exchange": "NYSE", 5. "currency": "USD", 6. "datetime": "2021-03-26", 7. "open": "154.30", 8. "high": "155.28", 9. "low": "152.92", 10. "close": "153.00", 11. "volume": "9,283,955", 12. "previous_close": "152.55", 13. "change": "0.45", 14. "average_volume": "18,613,062 15. } 16. Designed for developers THE MOST POWERFUL AND EASY-TO-USE APIS We understand how tedious it is to think about different formats and integration barriers. Our APIs share easy to understand logic across all endpoints. WebSockets share the same structure, so you get 2 in 1. Read the docs TOOLS FOR YOUR STACK We provide you with SDKs for the most popular languages. See libraries WEBSOCKET Connect to a real time stream of ultra low latency data. Explore docs API WebSocket 1. from twelvedata import TDClient 2. 3. td = TDClient(apikey="YOUR_API_KEY_HERE") 4. 5. ts = td.time_series( 6. symbol="AAPL", 7. interval="1min", 8. outputsize=12, 9. ) 10. 11. print(ts.as_json()) 12. 1. #include <cjson/cJSON.h> // https://github.com/DaveGamble/cJSON 2. #include <curl/curl.h> 3. #include <iostream> 4. #include <memory> 5. 6. const char* REQUEST_URL = "https://api.twelvedata.com/time_series?symbol=AAPL&interval=1min&outputsize=12&apikey=YOUR_API_KEY_HERE"; 7. 8. // Take response data and write into the string 9. std::size_t write_callback(const char* data, std::size_t size, std::size_t count, std::string* out) { 10. const std::size_t result = size * count; 11. out->append(data, result); 12. 13. return result; 14. } 15. 16. int main() { 17. std::unique_ptr<std::string> responseData(new std::string()); 18. cJSON* json = nullptr; 19. CURL* curl = curl_easy_init(); 20. 21. curl_easy_setopt(curl, CURLOPT_URL, REQUEST_URL); 22. curl_easy_setopt(curl, CURLOPT_HTTPGET, 1); 23. curl_easy_setopt(curl, CURLOPT_WRITEDATA, responseData.get()); 24. curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); 25. curl_easy_perform(curl); 26. 27. json = cJSON_Parse(responseData->c_str()); 28. cJSON* metaField = cJSON_GetObjectItem(json, "meta"); 29. cJSON* valuesField = cJSON_GetObjectItem(json, "values"); 30. cJSON* symbolField = cJSON_GetObjectItem(metaField, "symbol"); 31. cJSON* closeField = cJSON_GetObjectItem(cJSON_GetArrayItem(valuesField, 0), "close"); 32. 33. std::cout << "Received symbol: " << cJSON_GetStringValue(symbolField) << ", "; 34. std::cout << "close: " << cJSON_GetStringValue(closeField) << std::endl; 35. 36. cJSON_Delete(json); 37. curl_easy_cleanup(curl); 38. 39. return 0; 40. } 41. 1. using System; 2. using System.Collections.Generic; 3. using System.Net; 4. using System.Text.Json; 5. 6. namespace TwelveData 7. { 8. public class TimeSeries 9. { 10. public Dictionary<string, string> meta { get; set; } 11. public IList<Dictionary<string, string>> values { get; set; } 12. public string status { get; set; } 13. } 14. 15. class Prices 16. { 17. static void Main(string[] args) 18. { 19. using WebClient wc = new WebClient(); 20. var response = wc.DownloadString("https://api.twelvedata.com/time_series?symbol=AAPL&interval=1min&outputsize=12&apikey=YOUR_API_KEY_HERE"); 21. var timeSeries = JsonSerializer.Deserialize<TimeSeries>(response); 22. if (timeSeries.status == "ok") 23. { 24. Console.WriteLine("Received symbol: " + timeSeries.meta["symbol"] + ", close: " + timeSeries.values[0]["close"]); 25. } 26. } 27. } 28. } 29. 1. import org.json.simple.parser.JSONParser; 2. import org.json.simple.JSONArray; 3. import org.json.simple.JSONObject; 4. 5. import java.util.Scanner; 6. import java.net.HttpURLConnection; 7. import java.net.URL; 8. 9. public class Main { 10. private static final String REQUEST_URL = "https://api.twelvedata.com/time_series?symbol=AAPL&interval=1min&outputsize=12&apikey=YOUR_API_KEY_HERE"; 11. 12. public static void main(String[] args) throws Exception { 13. URL requestURL = new URL(REQUEST_URL); 14. HttpURLConnection connection = (HttpURLConnection)requestURL.openConnection(); 15. StringBuffer responseData = new StringBuffer(); 16. JSONParser parser = new JSONParser(); 17. 18. connection.setRequestMethod("GET"); 19. connection.setRequestProperty("User-Agent", "twelve_java/1.0"); 20. connection.connect(); 21. 22. if (connection.getResponseCode() != 200) { 23. throw new RuntimeException("Request failed. Error: " + connection.getResponseMessage()); 24. } 25. 26. Scanner scanner = new Scanner(requestURL.openStream()); 27. while (scanner.hasNextLine()) { 28. responseData.append(scanner.nextLine()); 29. } 30. 31. JSONObject json = (JSONObject) parser.parse(responseData.toString()); 32. JSONObject meta = (JSONObject) json.get("meta"); 33. JSONArray values = (JSONArray) json.get("values"); 34. 35. connection.disconnect(); 36. } 37. } 38. 1. # install.packages("RcppSimdJson") 2. 3. apikey <- "YOUR_API_KEY_HERE" 4. qry <- paste0( 5. "https://api.twelvedata.com/time_series?", 6. "symbol=AAPL&interval=1min&outputsize=12", 7. "&apikey=", apikey) 8. res <- RcppSimdJson::fload(qry) 9. res 10. 1. # pip install twelvedata[websocket] 2. 3. from twelvedata import TDClient 4. 5. def on_event(e): 6. print(e) 7. 8. td = TDClient(apikey="YOUR_API_KEY_HERE") 9. ws = td.websocket(symbols="AAPL", on_event=on_event) 10. ws.connect() 11. ws.keep_alive() 12. 1. #include <websocketpp/config/asio_client.hpp> 2. #include <websocketpp/client.hpp> 3. #include <cjson/cJSON.h> 4. 5. #include <iostream> 6. #include <iomanip> 7. #include <ctime> 8. 9. namespace wlib = websocketpp::lib; 10. namespace ssl = boost::asio::ssl; 11. 12. typedef websocketpp::client<websocketpp::config::asio_tls_client> wclient; 13. typedef wlib::shared_ptr<wlib::asio::ssl::context> context_ptr; 14. 15. const char* ENDPOINT = "wss://ws.twelvedata.com/v1/quotes/price?apikey=YOUR_API_KEY_HERE"; 16. 17. const char* SUBSCRIBE_ACTION = "{"\ 18. "\"action\": \"subscribe\"," \ 19. "\"params\": {" \ 20. "\"symbols\": \"AAPL\"" \ 21. "}" \ 22. "}"; 23. 24. int main() { 25. wclient::connection_ptr connection; 26. wlib::error_code error_code; 27. wclient client; 28. 29. client.set_access_channels(websocketpp::log::alevel::all); 30. client.clear_access_channels(websocketpp::log::alevel::frame_payload); 31. client.set_error_channels(websocketpp::log::elevel::all); 32. 33. // Initialize Boost.ASIO 34. client.init_asio(); 35. 36. // Set TLS initialize handler 37. client.set_tls_init_handler(wlib::bind([](auto* hostname, auto hdl) { 38. context_ptr context = wlib::make_shared<ssl::context>(ssl::context::sslv23); 39. context->set_verify_mode(ssl::verify_none); 40. 41. return context; 42. }, ENDPOINT, websocketpp::lib::placeholders::_1)); 43. 44. // Is called after the WebSocket handshake is complete 45. client.set_open_handler([&client](auto hdl) { 46. // Send subscribe action to stream 47. client.send(hdl, SUBSCRIBE_ACTION, websocketpp::frame::opcode::text); 48. }); 49. 50. // Receive and handle messages from server 51. client.set_message_handler([](auto hdl, wclient::message_ptr message) { 52. cJSON* json = cJSON_Parse(message->get_payload().c_str()); 53. 54. if (json == nullptr) { 55. std::cout << "received invalid JSON: " << std::endl << message->get_payload() << std::endl; 56. return; 57. } 58. 59. // Get event type 60. cJSON* eventTypeField = cJSON_GetObjectItem(json, "event"); 61. if (eventTypeField == nullptr) { 62. std::cout << "unknown JSON structure" << std::endl; 63. return; 64. } 65. 66. // Extract string from event type 67. const char* eventType = cJSON_GetStringValue(eventTypeField); 68. if (strcmp(eventType, "subscribe-status") == 0) { 69. cJSON* statusField = cJSON_GetObjectItem(json, "status"); 70. const char* status = cJSON_GetStringValue(statusField); 71. 72. if (strcmp(status, "ok") != 0) { 73. std::cout << "Failed subscribe to stream" << std::endl; 74. return; 75. } 76. 77. cJSON* successField = cJSON_GetObjectItem(json, "success"); 78. cJSON* failsField = cJSON_GetObjectItem(json, "fails"); 79. 80. // Iterate over the symbols that were successfully subscribed 81. for (int idx = 0; idx < cJSON_GetArraySize(successField); idx++) { 82. cJSON* item = cJSON_GetArrayItem(successField, idx); 83. cJSON* symbolField = cJSON_GetObjectItem(item, "symbol"); 84. const char* symbol = cJSON_GetStringValue(symbolField); 85. 86. std::cout << "Success subscribed to `"<< symbol << "` " << "symbol." << std::endl; 87. } 88. 89. // If we're unable to subscribe to some symbols 90. for (int idx = 0; 0 < cJSON_GetArraySize(failsField); idx++) { 91. cJSON* item = cJSON_GetArrayItem(failsField, idx); 92. cJSON* symbolField = cJSON_GetObjectItem(item, "symbol"); 93. const char* symbol = cJSON_GetStringValue(symbolField); 94. 95. std::cout << "Failed to subscribe on `"<< symbol << "` " << "symbol." << std::endl; 96. } 97. 98. return; 99. } 100. 101. if (strcmp(eventType, "price") == 0) { 102. cJSON* timestampField = cJSON_GetObjectItem(json, "timestamp"); 103. cJSON* currencyField = cJSON_GetObjectItem(json, "currency"); 104. cJSON* symbolField = cJSON_GetObjectItem(json, "symbol"); 105. cJSON* priceField = cJSON_GetObjectItem(json, "price"); 106. time_t time = timestampField->valueint; 107. 108. std::cout << "[" << std::put_time(gmtime(&time), "%I:%M:%S %p") << "]: "; 109. std::cout << "The symbol `" << cJSON_GetStringValue(symbolField) << "` "; 110. std::cout << "has changed price to " << priceField->valuedouble << " "; 111. 112. if (currencyField != nullptr) { 113. std::cout << "(" << cJSON_GetStringValue(currencyField) << ")" << std::endl; 114. } else { 115. std::cout << std::endl; 116. } 117. 118. return; 119. } 120. 121. // Free memory of JSON structure 122. cJSON_Delete(json); 123. }); 124. 125. // New connection to WebSocket endpoint 126. connection = client.get_connection(ENDPOINT, error_code); 127. if (error_code) { 128. std::cout << "Failed connection. Message: " << error_code.message() << std::endl; 129. return -1; 130. } 131. 132. // Connect to websocket endpoint 133. client.connect(connection); 134. client.run(); 135. } 136. 1. using System; 2. using WebSocket4Net; //https://github.com/kerryjiang/WebSocket4Net 3. 4. namespace TwelveData 5. { 6. class TDWebSocket 7. { 8. WebSocket ws = new WebSocket("wss://ws.twelvedata.com/v1/quotes/price?apikey=YOUR_API_KEY_HERE"); 9. 10. static void Main() 11. { 12. new TDWebSocket().Init(); 13. } 14. 15. public void Init() 16. { 17. ws.Opened += OnOpen; 18. ws.Closed += OnClose; 19. ws.Error += OnError; 20. ws.MessageReceived += OnEvent; 21. 22. ws.Open(); 23. Console.ReadLine(); 24. } 25. 26. private void OnOpen(object sender, EventArgs e) 27. { 28. Console.WriteLine("TDWebSocket opened!"); 29. ws.Send("{\"action\": \"subscribe\", \"params\":{\"symbols\": \"AAPL\"}}"); 30. } 31. 32. private void OnClose(object sender, EventArgs e) 33. { 34. Console.WriteLine("TDWebSocket closed"); 35. } 36. 37. private void OnError(object sender, SuperSocket.ClientEngine.ErrorEventArgs e) 38. { 39. Console.WriteLine("TDWebSocket ERROR: " + e.Exception.Message); 40. } 41. 42. private void OnEvent(object sender, MessageReceivedEventArgs e) 43. { 44. Console.WriteLine(e.Message); 45. } 46. } 47. } 48. 1. import org.java_websocket.handshake.ServerHandshake; 2. import org.java_websocket.client.WebSocketClient; 3. 4. import org.json.simple.parser.ParseException; 5. import org.json.simple.parser.JSONParser; 6. import org.json.simple.JSONObject; 7. 8. import java.net.URI; 9. 10. public class Main { 11. private static final String ENDPOINT = "wss://ws.twelvedata.com/v1/quotes/price?apikey=YOUR_API_KEY_HERE"; 12. 13. public static void main(String[] args) throws Exception { 14. WebSocketClient client = new WebSocketClient(new URI(ENDPOINT)) { 15. @Override 16. public void onOpen(ServerHandshake handshake) { 17. System.out.println("TDWebSocket opened!"); 18. send("{\"action\": \"subscribe\", \"params\":{\"symbols\": \"AAPL\"}}"); 19. } 20. 21. @Override 22. public void onMessage(String message) { 23. JSONParser parser = new JSONParser(); 24. try { 25. JSONObject json = (JSONObject) parser.parse(message); 26. System.out.println(json); 27. } catch(ParseException e) { 28. e.printStackTrace(); 29. } 30. } 31. 32. @Override 33. public void onClose(int status, String reason, boolean remote) { 34. System.out.println("TDWebSocket closed."); 35. this.close(); 36. } 37. 38. @Override 39. public void onError(Exception e) { 40. e.printStackTrace(); 41. } 42. }; 43. 44. client.connectBlocking(); 45. } 46. } 47. 1. # install.packages("websocket") 2. 3. library(websocket) 4. 5. ws <- WebSocket$new("wss://ws.twelvedata.com/v1/quotes/price?apikey=YOUR_API_KEY_HERE") 6. ws$onOpen(function(event) { 7. cat("TDWebSocket opened!\n") 8. }) 9. ws$onClose(function(event) { 10. cat("TDWebSocket closed with code ", event$code, 11. " and reason ", event$reason, "\n", sep = "") 12. }) 13. ws$onError(function(event) { 14. cat("TDWebSocket ERROR: ", event$message, "\n") 15. }) 16. ws$onMessage(function(event) { 17. cat("Received event:", event$data, "\n") 18. }) 19. 20. ws$send('{"action": "subscribe", "params":{"symbols": "AAPL"}}') 21. Python C++ C# Java R Why Twelve Data A TECHNOLOGY-FIRST APPROACH TOGETHER WITH EXCEPTIONAL SERVICE. DATA COVERAGE We support around 100 000 symbols across a different range of assets available from all over the world. FAST MOVING Every day, from year to year we release hundreds of new features to make sure that you stay ahead of the industry. RELIABILITY Our system has 99.95% SLA. Twelve Data tends to raise the standards for quality and uptime to the next level. LATENCY Real time data streaming via WebSockets has ultra low latency at only ~170 ms on average for all instruments. Think globally MORE THAN DATA PROVIDER For those individuals and companies who want to challenge the world, Twelve Data makes it possible to achieve their goals. Our decentalized team is located across the world and helps to make next big step. 700М+ API requests performed per day, peaking 1,000,000 per minute. 250+ Exchanges are supported, across the world. 80k+ Different financial assets and many more to come. 90+ Countries from where data comes from. Show all Show all READY TO GET STARTED? Explore Market Data, or create an account and start working with the data. You can also leave us a note and we will prepare custom plan for your needs. Start now Contact sales SIMPLE PRICING Pay for what you need. No hidden or implicit fees. Pricing BEGIN WITH API Integrate Twelve Data in as little as 5 minutes. Docs twelvedata Copyright © 2024 Twelve Data Pte. Ltd. All rights reserved. PRODUCTS * Stock * Forex (FX) * Crypto * ETF * Indices * Excel * Google Sheets * Pricing DEVELOPERS * API documentation * WebSocket documentation COMPANY * About * Customers * Education * Expertise * Careers * Brand assets * Blog * News RESOURCES * Support * Contact * Request builder * Privacy policy * Terms of use * Sitemap * All * Stocks * Forex * Crypto * Indices * ETFs * Mutual Funds * Commodities Apple Inc AAPL Common stock NASDAQ Tesla Inc TSLA Common stock NASDAQ Public Joint-Stock Company Territorial Generation Company No.2 TGKB Common stock MOEX Huatai-Pinebridge Fund Management Co Ltd - CSI 2000 Index ETF 563300 Common stock SSE ChinaAMC China 50 ETF 510050 Common stock SSE E Fund ChiNext ETF 159915 Common stock SZSE Synergia Energy Ltd SYN Common stock LSE CoroWare, Inc. COWI Common stock OTC Clover Power Public Company Limited CV Common stock SET Yes Bank Limited YESBANK Common stock NSE Zorlu Enerji Elektrik Üretim A.S. ZOREN Common stock BIST Fidelity 500 Index Fund FXAIX Mutual fund Bosera CM Shekou Industrial Park REIT 0P0001MJE3 Mutual fund TR Property Investment Trust TRPIF Mutual fund Baillie Gifford Shin Nippon Ord SNPVF Mutual fund Premier ETF IDX30 XIIT Mutual fund Alkhabeer Capital - Diversified Income ETF 4700 Mutual fund Fidelity Asian Values PLC FAV Mutual fund Danske Invest Mix Obligationer DKIMOB Mutual fund Thornburg Income Builder Opportunities Trust Common Stock XTBLX Mutual fund Mirae Asset Asia Pacific Real Estate 1 Investment Company 094800 Mutual fund UBS Property Direct Residential Fund DRPF Mutual fund Opportunita Italia - Real Estate Fund QFOPI Mutual fund US Dollar / Euro USD/EUR Forex Aggregate US Dollar / Chinese Yuan USD/CNY Forex Aggregate Euro / Serbian Dinar EUR/RSD Forex Aggregate Canadian Dollar / US Dollar CAD/USD Forex Aggregate Turkish Lira / Euro TRY/EUR Forex Aggregate Swiss Franc / UAE Dirham CHF/AED Forex Aggregate Korean Won / Chinese Yuan KRW/CNY Forex Aggregate British Pound / Mauritian Rupee GBP/MUR Forex Aggregate South African / Rand Kenyan Shilling ZAR/KES Forex Aggregate Israeli Shekel / Venezuelan Bolivar ILS/VEF Forex Aggregate Bitcoin US Dollar BTC/USD Crypto Coinbase pro Ethereum US Dollar ETH/USD Crypto Huobi Ethereum Bitcoin ETH/BTC Crypto Huobi Bitcoin Polish Zloty BTC/PLN Crypto BitBay Ethereum Euro ETH/EUR Crypto Coinbase pro Komodo Ethereum KMD/ETH Crypto Binance Akash Network Ethereum AKT/ETH Crypto Gate.io Frax Share Bitcoin FXS/BTC Crypto Binance Bitcoin Ethereum BTC/ETH Crypto Synthetic Bitcoin Japanese Yen BTC/JPY Crypto QUOINE SPDR S&P 500 ETF Trust SPY ETF NYSE Yuanta Daily Taiwan 50 Bear -1X ETF 00632R ETF TWSE Direxion Daily Semiconductor Bear 3X Shares SOXS ETF NYSE ProShares UltraPro Short QQQ SQQQ ETF NASDAQ NEXT FUNDS Nikkei 225 Leveraged Index Exchange Traded Fund 1570 ETF JPX Mirae Asset Global Invest MAHKTECH ETF NSE BetaPro Natural Gas 2x Daily Bull ETF HNU ETF TSX ETFS Ultra Short Nasdaq 100 Hedge Fund SNAS ETF CXA CPSE ETF CPSEETF ETF NSE GraniteShares 1.5x COIN Daily ETF CONL ETF NASDAQ S&P 500 SPX Index NASDAQ 100 NDX Index Oslo Bors Benchmark Index_GI OSEBX Index S&P 500 GSPC Index Russell 2000 RUT Index OBX Total Return Index OBX Index HANG SENG INDEX HSI Index Tadawul All Shares Index TASI Index IPC MEXICO MXX Index FTSE/JSE Top 40 Index JTOPI Index Gold Spot US Dollar XAU/USD Commodity Aggregate Gold Spot Euro XAU/EUR Commodity Aggregate Gold Spot Singapore Dollar XAU/SGD Commodity Aggregate Copper Pound US Dollar XG/USD Commodity Aggregate Silver Spot Australian Dollar XAG/AUD Commodity Aggregate Brent Spot US Dollar XBR/USD Commodity Aggregate Gram Silver Euro XAGG/EUR Commodity Aggregate Platinum Spot US Dollar XPT/USD Commodity Aggregate Silver Spot Euro XAG/EUR Commodity Aggregate Silver Spot Turkish Lira XAG/TRY Commodity Aggregate AAPL not found in Forex 3 matching results in other markets Check out Press / to search