CINXE.COM
TradingEconomics.com | Careers
<!doctype html> <html > <head id="ctl00_Head1"><meta charset="utf-8" /><title> TradingEconomics.com | Careers </title><meta id="metaDesc" name="description" content=" Trading Economics is a fast growing company which welcomes candidates from all over the world to apply for internships and full time positions. " /><meta id="metaKeyword" name="keywords" content="Trading Economics, Careers, Jobs" /><meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,maximum-scale=1" /><meta name="theme-color" content="#333333" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css" integrity="sha512-SbiR/eusphKoMVVXysTKG/7VseWii+Y3FdHrt0EpKgpToZeemhqHeZeLWLhJutz/2ut2Vw1uQEj2MbRF+TVBUA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.10.2/font/bootstrap-icons.min.css" integrity="sha512-YFENbnqHbCRmJt5d+9lHimyEMt8LKSNTMLSaHjvsclnZGICeY/0KYEeiHwD1Ux4Tcao0h60tdcMv+0GljvWyHg==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link href="//d3fy651gv2fhd3.cloudfront.net/stylesheet.min.css?v=20241101b" rel="stylesheet" /> <script type="text/javascript">var TEChartSettings = {}; var TESymbol = ''; var TECountry = ''; var TECategory = ''; var TEFrequency = ''; var TELanguage = ''; var TELastUpdate = '20241031000000'; var TEChartVersion = ''; var symbol = ''; var symbolType = ''; var hasCalendar = false; var isLoggedIn = false; var TEAlertsName = ''; var TEChartsDatasource = 'https://d3ii0wo49og5mi.cloudfront.net'; var IsMobile = false; var TEChartsMeta = ''; var TEForecast = []; var TEAuthorization = ''; var TESecurify = ''; var TESecurifyUrl = ''; var TEType = ''; var TEChartUrl = '/careers.aspx'; var TEComparable = 0; var isAlertsLoaded = false; var IsDarkMode = false; var isPakoLoaded = false; var TEChartsToken = '20240229:nazare'; var TEObfuscationkey = 'tradingeconomics-charts-core-api-key'; var isCopyright = false;</script> <script type="text/javascript">var DEBUG = false;if (window.location.host.indexOf('localhost') > -1) DEBUG = true;else if (window.location.href.indexOf('debug') > -1) DEBUG = true;if (!DEBUG) {if (!window.console) window.console = {};var methods = ["log", "debug", "info"];for (var i = 0; i < methods.length; i++) {console[methods[i]] = function () { };}}</script> <link rel="icon" href="//d3fy651gv2fhd3.cloudfront.net/favicon.ico" /><link rel="canonical" href="https://tradingeconomics.com/careers.aspx" /></head> <body > <script>IsDarkMode=false;</script> <form method="post" action="./careers.aspx" id="aspnetForm"> <div class="aspNetHidden"> <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="XZj+HbcVXPBfR2H+yswOJOx4ToWPAUjxZUxDsw+7G8iHEuENlw52l+vHIlgOf27coZ1xMTfDZcEJMbUkmnM7qC64gLo=" /> </div> <div class="aspNetHidden"> <input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="796F993D" /> </div> <nav id="ctl00_NavigationUC1_ctl00_menu" class="navbar navbar-dark fixed-top" role="navigation"> <div class="container"> <div class="navbar-header navbar-header-search" id="searchMobileHeader"> <div class="d-flex justify-content-between"> <a class="navbar-brand" style="width: 100%"> <input type="text" placeholder="Search" id="thisIstheTinySearchBoxIdTag" autocomplete="off" class="nav-search-input-class navbar-search-2" /> </a> <ul id="thisIstheTinySearchResultsIdTag" class="dropdown-menu navbar-search-1"> <li> <div class="container-fluid"> <div id="dpSearch-resultCnt-tiny" class="dpTaResult"> </div> </div> </li> </ul> <div class="navbar-mobile-close-search"> <a noref class="navbar-mobile-item" id="thisIsTheTinyRemoveId"><i class="bi bi-x-lg"></i></a> </div> </div> </div> <div class="navbar-header navbar-collapse float-end" id="mainHeader"> <div class="d-flex"> <button type="button" class="navbar-toggler" data-bs-toggle="offcanvas" data-bs-target="#tesidemenu" aria-controls="tesidemenuoptions"> <span class="navbar-toggler-icon"></span> </button> <div class="logo-banner d-flex justify-content-between float-right"> <a class="navbar-brand" href="/"> <svg width="129" height="35" version="1.1" viewBox="0 0 34.131 9.2604" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" aria-label = "Trading Economics logo"> <g fill="#858585" stroke="#858585" stroke-width=".1" ><path d="m1.3315 8.5517v-3.7879h2.8086v0.64079h-2.0438v0.83974h1.9017v0.6382h-1.9017v1.0309h2.1162v0.6382z"/><path d="m7.2846 7.1591 0.74156 0.23513q-0.17053 0.62012-0.56844 0.92242-0.39532 0.29972-1.0051 0.29972-0.75448 0-1.2402-0.51418-0.48576-0.51676-0.48576-1.4108 0-0.94568 0.48834-1.4676 0.48834-0.52452 1.2842-0.52452 0.69505 0 1.1291 0.41083 0.25838 0.24288 0.38757 0.69763l-0.75706 0.18087q-0.067179-0.29456-0.28164-0.46509-0.21187-0.17053-0.51676-0.17053-0.42116 0-0.68471 0.30231-0.26097 0.30231-0.26097 0.97927 0 0.7183 0.25838 1.0232 0.25838 0.30489 0.67179 0.30489 0.30489 0 0.52452-0.19379 0.21962-0.19379 0.31523-0.60978z"/><path d="m8.5275 6.681q0-0.57878 0.17312-0.97152 0.12919-0.28939 0.3514-0.51935 0.22479-0.22996 0.49093-0.34106 0.35398-0.14986 0.81649-0.14986 0.83716 0 1.3384 0.51935 0.50385 0.51935 0.50385 1.4444 0 0.91726-0.49868 1.4366-0.49868 0.51676-1.3333 0.51676-0.84491 0-1.3436-0.51418-0.49868-0.51676-0.49868-1.4211zm0.78807-0.025838q0 0.64337 0.29714 0.97669 0.29714 0.33073 0.75448 0.33073 0.45734 0 0.74931-0.32815 0.29456-0.33073 0.29456-0.9896 0-0.65112-0.2868-0.97152-0.28422-0.32039-0.75706-0.32039-0.47284 0-0.76223 0.32556-0.28939 0.32298-0.28939 0.97669z"/><path d="m12.806 8.5517v-3.7879h0.74414l1.5503 2.5296v-2.5296h0.71055v3.7879h-0.7674l-1.527-2.4701v2.4701z"/><path d="m16.465 6.681q0-0.57878 0.17312-0.97152 0.12919-0.28939 0.3514-0.51935 0.22479-0.22996 0.49093-0.34106 0.35398-0.14986 0.81649-0.14986 0.83716 0 1.3384 0.51935 0.50384 0.51935 0.50384 1.4444 0 0.91726-0.49868 1.4366-0.49868 0.51676-1.3333 0.51676-0.84491 0-1.3436-0.51418-0.49868-0.51676-0.49868-1.4211zm0.78807-0.025838q0 0.64337 0.29714 0.97669 0.29714 0.33073 0.75448 0.33073t0.74931-0.32815q0.29456-0.33073 0.29456-0.9896 0-0.65112-0.2868-0.97152-0.28422-0.32039-0.75706-0.32039t-0.76223 0.32556q-0.28939 0.32298-0.28939 0.97669z"/><path d="m20.726 8.5517v-3.7879h1.1446l0.6873 2.5838 0.67955-2.5838h1.1472v3.7879h-0.71055v-2.9817l-0.75189 2.9817h-0.73639l-0.74931-2.9817v2.9817z"/><path d="m25.121 8.5517v-3.7879h0.76481v3.7879z"/><path d="m29.038 7.1591 0.74156 0.23513q-0.17053 0.62012-0.56844 0.92242-0.39532 0.29972-1.0051 0.29972-0.75448 0-1.2402-0.51418-0.48576-0.51676-0.48576-1.4108 0-0.94568 0.48834-1.4676 0.48834-0.52452 1.2842-0.52452 0.69505 0 1.1291 0.41083 0.25838 0.24288 0.38757 0.69763l-0.75706 0.18087q-0.06718-0.29456-0.28164-0.46509-0.21187-0.17053-0.51676-0.17053-0.42116 0-0.68471 0.30231-0.26097 0.30231-0.26097 0.97927 0 0.7183 0.25838 1.0232 0.25838 0.30489 0.67179 0.30489 0.30489 0 0.52452-0.19379 0.21962-0.19379 0.31523-0.60978z"/><path d="m30.242 7.3193 0.74414-0.072347q0.06718 0.37465 0.2713 0.55035 0.2067 0.1757 0.55552 0.1757 0.36949 0 0.55552-0.15503 0.18862-0.15761 0.18862-0.3669 0-0.13436-0.0801-0.22738-0.077514-0.095602-0.27388-0.16536-0.13436-0.046509-0.61237-0.16536-0.61495-0.15245-0.863-0.37465-0.34882-0.31264-0.34882-0.76223 0-0.28939 0.16278-0.54002 0.16536-0.25321 0.47284-0.38499 0.31006-0.13178 0.74672-0.13178 0.71314 0 1.0723 0.31264 0.36174 0.31264 0.37982 0.83457l-0.76481 0.03359q-0.04909-0.29197-0.21187-0.41858-0.1602-0.12919-0.48317-0.12919-0.33331 0-0.52193 0.13694-0.12144 0.08785-0.12144 0.23513 0 0.13436 0.11369 0.22996 0.14469 0.12144 0.7028 0.25321t0.82424 0.27389q0.26872 0.13953 0.41858 0.38499 0.15244 0.24288 0.15244 0.60203 0 0.32556-0.18087 0.60978-0.18087 0.28422-0.5116 0.42375-0.33073 0.13694-0.82424 0.13694-0.7183 0-1.1033-0.33073-0.38499-0.33331-0.45992-0.96893z"/></g> <g fill="#ddd" stroke="#ddd" stroke-width=".1" ><path d="m1.4629 4.2437v-2.8324h-1.0116v-0.57671h2.7091v0.57671h-1.0092v2.8324z"/><path d="m3.607 4.2437v-3.4091h1.4487q0.54648 0 0.79297 0.093018 0.24882 0.090692 0.39765 0.32556 0.14883 0.23487 0.14883 0.53718 0 0.3837-0.22557 0.63484-0.22557 0.24882-0.67438 0.31393 0.22324 0.13022 0.36742 0.28603 0.1465 0.1558 0.393 0.55345l0.41625 0.66508h-0.82321l-0.49764-0.74182q-0.2651-0.39765-0.36277-0.49997-0.097668-0.10464-0.20696-0.14185-0.1093-0.039532-0.34649-0.039532h-0.13953v1.4232zm0.68833-1.9673h0.50927q0.49532 0 0.61857-0.041858t0.19301-0.14418q0.069763-0.10232 0.069763-0.2558 0-0.17208-0.093018-0.27673-0.090692-0.10697-0.25812-0.13488-0.083716-0.011627-0.50229-0.011627h-0.53718z"/><path d="m10.118 4.2437h-0.74879l-0.29766-0.77437h-1.3627l-0.28138 0.77437h-0.73019l1.3278-3.4091h0.72786zm-1.2674-1.3488-0.46974-1.265-0.46044 1.265z"/><path d="m10.481 0.8346h1.2581q0.42556 0 0.6488 0.065112 0.29998 0.088367 0.51392 0.31393 0.21394 0.22557 0.32556 0.55345 0.11162 0.32556 0.11162 0.8046 0 0.4209-0.10464 0.72554-0.1279 0.37207-0.36509 0.60229-0.17906 0.17441-0.48369 0.27208-0.22789 0.072089-0.60926 0.072089h-1.2953zm0.68833 0.57671v2.258h0.51392q0.28835 0 0.41625-0.032556 0.16743-0.041858 0.27673-0.14185 0.11162-0.099994 0.18138-0.32789 0.06976-0.23022 0.06976-0.62554t-0.06976-0.60694-0.19534-0.33021q-0.12557-0.1186-0.31858-0.16046-0.14418-0.032556-0.56508-0.032556z"/><path d="m13.902 4.2437v-3.4091h0.68833v3.4091z"/><path d="m15.253 4.2437v-3.4091h0.66973l1.3953 2.2766v-2.2766h0.6395v3.4091h-0.69066l-1.3743-2.2231v2.2231z"/><path d="m20.271 2.9903v-0.57438h1.4836v1.3581q-0.21627 0.20929-0.62787 0.36974-0.40928 0.15813-0.83018 0.15813-0.53485 0-0.9325-0.22324-0.39765-0.22557-0.59764-0.64182-0.19999-0.41858-0.19999-0.90925 0-0.53253 0.22324-0.94645 0.22324-0.41393 0.65345-0.63484 0.32789-0.16976 0.81623-0.16976 0.63484 0 0.99064 0.26743 0.35812 0.2651 0.46044 0.73484l-0.68368 0.1279q-0.072088-0.25115-0.27208-0.39532-0.19766-0.1465-0.49532-0.1465-0.45114 0-0.71856 0.28603-0.2651 0.28603-0.2651 0.84879 0 0.60694 0.26975 0.91157 0.26975 0.30231 0.70693 0.30231 0.21627 0 0.43253-0.083716 0.21859-0.086041 0.3744-0.20696v-0.43253z"/></g> </svg> </a> <div class="d-flex align-items-center nav-options"> <div class="d-flex align-items-center nav-entry-link-group"> <a class="nav-entry-link d-none d-md-block" href="/calendar"><span>Calendar</span></a> <a class="nav-entry-link d-none d-md-block" href="/stream"><span>News</span></a> <div class="dropdown"> <a href="#" class="dropdown d-flex nav-entry-link d-none d-md-block" data-bs-toggle="dropdown"><span>Markets</span></a> <ul class="dropdown-menu nav-dropdown-menu"> <li class='dropdown-item nav-dropdown-item'><a href="/commodities">Commodities</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/currencies">Currencies</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/stocks">Stocks</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/bonds">Bonds</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/crypto">Crypto</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/earnings">Earnings</a></li> </ul> </div> <a class="nav-entry-link d-none d-lg-block" href="/indicators"><span>Indicators</span></a> <a class="nav-entry-link d-none d-xl-block" href="/countries"><span >Countries</span></a> <div class="dropdown"> <a href="#" class="dropdown d-flex nav-entry-link d-none d-md-block" data-bs-toggle="dropdown"><span>Forecasts</span></a> <ul class="dropdown-menu nav-dropdown-menu"> <li class='dropdown-item nav-dropdown-item'><a href="/forecast/commodity">Commodities</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/forecast/currency">Currencies</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/forecast/stock-market">Stocks</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/forecast/government-bond-10y">Bonds</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/forecast/crypto">Crypto</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/forecasts">Countries</a></li> <li class='dropdown-item nav-dropdown-item'><a href="/indicators?g=forecast">Indicators</a></li> </ul> </div> </div> <div class="search-li d-none d-lg-block"> <a noref id="thisIsTheSearchPlaceholderId" class="nav-searchbox-class stickydropdown d-block" title="Search"> <div id="thisIsTheSearchBoxWrapperId" class="typeahead-searchbox-glyphicon-wrapper d-flex "> <input type="text" placeholder="Search" aria-label="Search" id="thisIstheSearchBoxIdTag" autocomplete="off" class="d-none d-md-block nav-search-input-class"> </div> </a> <ul id="thisIstheSearchResultsIdTag" class="dropdown-menu nav-dropdown-menu typeahead-wrapper"> <li> <div class="container"> <div id="dpSearch-resultCnt" class="dpTaResult"> </div> </div> </li> </ul> </div> <div> <a class="d-block d-lg-none navbar-mobile-item" id="thisIsTheTinyGlyphiconId"><i class="bi bi-search me-2"></i></a> </div> <div class="dropdown dropdown-notification-list"> <button class="btn btn-notification-list" type="button" id="dropdownNotificationList" data-bs-toggle="offcanvas" data-bs-target="#offcanvasTop"> <svg xmlns="http://www.w3.org/2000/svg" width="21px" height="21px" viewBox="0 0 24 24" id="notification-empty" style="vertical-align:middle !important" data-name="notification-empty"><rect id="view-box" width="24" height="24" fill="none"/><path id="Shape" d="M6,17v-.5H2.25A2.253,2.253,0,0,1,0,14.25v-.382a2.542,2.542,0,0,1,1.415-2.289A1.248,1.248,0,0,0,2.1,10.572l.446-4.91a6.225,6.225,0,0,1,12.4,0l.446,4.91a1.26,1.26,0,0,0,.686,1.005,2.547,2.547,0,0,1,1.418,2.29v.382a2.252,2.252,0,0,1-2.25,2.25H11.5V17A2.75,2.75,0,0,1,6,17Zm1.5,0A1.25,1.25,0,0,0,10,17v-.5H7.5ZM4.045,5.8,3.6,10.708A2.738,2.738,0,0,1,2.089,12.92a1.055,1.055,0,0,0-.589.949v.382A.751.751,0,0,0,2.25,15h13A.751.751,0,0,0,16,14.25v-.382a1.054,1.054,0,0,0-.586-.948A2.739,2.739,0,0,1,13.9,10.708L13.456,5.8a4.725,4.725,0,0,0-9.411,0Z" transform="translate(3.25 2.25)" fill="#ddd"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="21px" height="21px" viewBox="0 0 24 24" id="notification-new" style="vertical-align:middle !important; display:none" data-name="notification-new"><rect id="view-box" width="24" height="24" fill="none" /><path id="Shape" d="M6,17v-.5H2.25A2.253,2.253,0,0,1,0,14.25v-.382a2.542,2.542,0,0,1,1.415-2.289A1.247,1.247,0,0,0,2.1,10.572l.446-4.91A6.227,6.227,0,0,1,10.618.286a5.477,5.477,0,0,0-.635,1.374A4.794,4.794,0,0,0,8.75,1.5,4.7,4.7,0,0,0,4.045,5.8L3.6,10.708A2.739,2.739,0,0,1,2.089,12.92a1.055,1.055,0,0,0-.589.949v.382A.751.751,0,0,0,2.25,15h13A.751.751,0,0,0,16,14.25v-.382a1.053,1.053,0,0,0-.586-.948A2.739,2.739,0,0,1,13.9,10.708l-.2-2.18a5.473,5.473,0,0,0,1.526.221l.166,1.822a1.26,1.26,0,0,0,.686,1.005,2.547,2.547,0,0,1,1.418,2.29v.382a2.252,2.252,0,0,1-2.25,2.25H11.5V17A2.75,2.75,0,0,1,6,17Zm1.5,0A1.25,1.25,0,0,0,10,17v-.5H7.5ZM15.047,6.744A3.486,3.486,0,0,1,13.5,6.28L13.456,5.8a4.7,4.7,0,0,0-1.648-3.185,3.5,3.5,0,0,1,.61-1.417A6.221,6.221,0,0,1,14.95,5.662l.1,1.081v0Z" transform="translate(3.25 2.25)" fill="#ddd" /> <path id="Shape-2" data-name="Shape" d="M3.5,7A3.5,3.5,0,1,1,7,3.5,3.5,3.5,0,0,1,3.5,7Z" transform="translate(15 2)" fill="#4287f5" /> </svg> </button> <div class="offcanvas offcanvas-top notification-list container custom-offcanvas" tabindex="-1" id="offcanvasTop" data-bs-scroll="true" aria-labelledby="offcanvasTopLabel" style="top:50px !important; border: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color);"> <div class="empty-notificationlist"> <div class="empty-notificationlist-content"> <span>You have no new notifications</span> <br> <i class="bi bi-bell-slash-fill"></i> <br> <div><a href="/stream" title="Show all news" class="empty-notificationlist-more"><div class="btn btn-outline-secondary">All News</div></a></div> </div> </div> </div> </div> <div class="userOptionsMenu"> <a title="" data-bs-toggle="offcanvas" href="#offcanvasGuest" role="button" aria-controls="offcanvasGuest"><i class="bi bi-person"></i></a> </div> </div> </div> </div> </div> <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasGuest" aria-labelledby="offcanvasGuestLabel"> <div class="offcanvas-header"> <h5 class="offcanvas-title" id="offcanvasGuestLabel"><b>Members</b></h5> <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> </div> <div class="offcanvas-body user-offcanvas-body"> <div class="list-group list-group-user"> <a href="/analytics/pricing.aspx?source=menu " class="user-item list-group-item"> <b class="list-group-item-heading"><i class="bi bi-save2-fill me-2"></i> DATA PLANS</b><br> <span class="list-group-item-text">Download historical data for 20 million indicators using your browser.</span> </a> <div class="user-item list-group-item"> <div class="navbar-user-link"> <a href="/analytics/pricing.aspx?source=menu" class="navbar-te-link mx-1">Subscription Plans</a> | <a href="/analytics/features.aspx?source=menu" class="navbar-te-link mx-1">Features</a> </div> </div> </div> <div class="list-group list-group-user"> <a href="/api/" class="user-item list-group-item"> <b class="list-group-item-heading"><i class="bi bi-phone mx-1 me-2"></i>API GATEWAY</b><br> <span class="list-group-item-text mx-1">Direct access to our data from your apps using any programing language.</span> </a> <div class="user-item list-group-item"> <div> <a href="https://docs.tradingeconomics.com/" target="_blank" class="navbar-te-link mx-1">Docs</a> | <a href="/api/?source=menu" class="navbar-te-link mx-1">Features</a> | <a href="https://developer.tradingeconomics.com/" class="navbar-te-link mx-1">Developer</a> </div> </div> </div> <div class="list-group list-group-user"> <a class="user-item list-group-item" href="https://sso.tradingeconomics.com/sso/login?returnurl=https://tradingeconomics.com/careers.aspx"><i class="bi bi-person-fill"></i> Already a user? <b>Login</b></a> </div> <style> .form-switch { width: 3.5em !important; height: 2em !important } .bi-sun-fill { font-size: 12px; color: #ddd !important; } .bi-moon-fill { font-size: 10px; color: #333 !important; } .darkmode-toggle-container { width: auto; padding: 0px; margin-left: 0px; margin-top: 0px; border: none; } .form-check-div-sun { width: 20px; margin-bottom: 3px; margin-left: -54px; position: relative } .form-check-div-moon { width: 20px; margin-bottom: 3px; margin-left: 3px; position: relative } .dk-switch-right-menu{ padding-left:10px; } </style> <div class="list-group list-group-user dk-switch-right-menu"> <div class="d-flex align-items-center darkmode-toggle-container"> <div class="form-check form-switch darkmode-form-switch user-item"> <input class="form-check-input p-1" type="checkbox" role="button" id="flexSwitchCheckChecked"> </div> <div class="form-check-div-sun"> <label class="form-check-label form-check-label-sun p-1 d-inline" for="flexSwitchCheckChecked"><i class="bi bi-sun-fill"></i></label> </div> <div class="form-check-div-moon"> <label class="form-check-label form-check-label-moon p-1 d-inline" for="flexSwitchCheckChecked"><i class="bi bi-moon-fill"></i></label> </div> </div> </div> <script> function SetTheme(isDark) { console.log('Changing theme', isDark); if (IsDarkMode != isDark) { IsDarkMode = isDark; document.body.classList.toggle("dark-theme"); // Set cookie const d = new Date(); d.setTime(d.getTime() + (365 * 24 * 60 * 60 * 1000)); let expires = "expires=" + d.toUTCString(); document.cookie = "IsDarkMode" + "=" + IsDarkMode + ";" + expires + ";path=/"; IsDarkMode ? ga('event', 'te_darkmode_on') : ga('event', 'te_darkmode_off'); window.location.reload(); } } document.addEventListener('DOMContentLoaded', function () { let checkbox = document.getElementById("flexSwitchCheckChecked"); let sundiv = document.getElementsByClassName("form-check-label-sun")[0]; let moondiv = document.getElementsByClassName("form-check-label-moon")[0]; if (IsDarkMode) { sundiv.classList.add("d-none"); moondiv.classList.remove("d-none"); } else { moondiv.classList.add("d-none"); sundiv.classList.remove("d-none"); } checkbox.checked = IsDarkMode; }); document.getElementById("flexSwitchCheckChecked").addEventListener("change", function () { SetTheme(!IsDarkMode) }); </script> </div> </div> <div class="offcanvas offcanvas-start" tabindex="-1" id="tesidemenu" aria-labelledby="tesidemenuoptions"> <div class="offcanvas-header"> <h5 class="offcanvas-title" id="offcanvasWithBothOptionsLabel"></h5> <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> </div> <div class="offcanvas-body"> <div class="row navbar-nav-scroll" style="--bs-scroll-height: 95vh;"> <div class="accordion" id="accordionNavbar"> <div class="accordion-item"> <div class="accordion-header menu-main-option"><a class="nav-link accordion-button navmenu-mobile-item" href="/calendar" target="_self"><i class="bi bi-calendar3 me-2"></i>Calendar</a></div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option"><a class="nav-link accordion-button navmenu-mobile-item" href="/stream" target="_self"><i class="bi bi-layout-text-sidebar me-2"></i>News</a></div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option d-flex align-items-center"> <button class="accordion-button navmenu-mobile-item collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseMarkets" aria-expanded="false" aria-controls="collapseTwo"> <i class="bi bi-arrow-down-up me-2"></i>Markets <i class="bi bi-caret-up-fill ms-auto caret-toggle"></i> </button> </div> <div id="collapseMarkets" class="accordion-collapse collapse show" data-bs-parent="#accordionNavbar"> <div class="accordion-body mobile-accordion-body"> <ul class="nav navbar-nav navbarMobile"> <li><a class="navmobile-link nav-link" href="/currencies" target="_self">Currencies</a></li> <li><a class="navmobile-link nav-link" href="/stocks" target="_self">Stocks</a></li> <li><a class="navmobile-link nav-link" href="/commodities" target="_self">Commodities</a></li> <li><a class="navmobile-link nav-link" href="/bonds" target="_self">Bonds</a></li> <li><a class="navmobile-link nav-link" href="/crypto" target="_self">Crypto</a></li> <li><a class="navmobile-link nav-link" href="/earnings" target="_self">Earnings</a></li> <li><a class="navmobile-link nav-link" href="/holidays" target="_self">Holidays</a></li> </ul> </div> </div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option d-flex align-items-center"> <button class="accordion-button navmenu-mobile-item collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseCountries" aria-expanded="false" aria-controls="collapseTwo"> <i class="bi bi-globe me-2"></i>Countries<i class="bi bi-caret-down-fill ms-auto caret-toggle"></i> </button> </div> <div id="collapseCountries" class="accordion-collapse collapse" data-bs-parent="#accordionNavbar"> <div class="accordion-body mobile-accordion-body"> <ul class="nav navbar-nav navbarMobile"> <li><a class="navmobile-link nav-link" href="/united-states/indicators" target="_self">United States</a></li> <li><a class="navmobile-link nav-link" href="/united-kingdom/indicators" target="_self">United Kingdom</a></li> <li><a class="navmobile-link nav-link" href="/euro-area/indicators" target="_self">Euro Area</a></li> <li><a class="navmobile-link nav-link" href="/australia/indicators" target="_self">Australia</a></li> <li><a class="navmobile-link nav-link" href="/canada/indicators" target="_self">Canada</a></li> <li><a class="navmobile-link nav-link" href="/japan/indicators" target="_self">Japan</a></li> <li><a class="navmobile-link nav-link" href="/china/indicators" target="_self">China</a></li> <li><a class="navmobile-link nav-link" href="/brazil/indicators" target="_self">Brazil</a></li> <li><a class="navmobile-link nav-link" href="/russia/indicators" target="_self">Russia</a></li> <li><a class="navmobile-link nav-link" href="/india/indicators" target="_self">India</a></li> <li><a class='navmobile-link nav-link' href="/countries" target="_self"><i class="bi bi-plus-square me-2"></i>More Countries</a></li> </ul> </div> </div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option d-flex align-items-center"> <button class="accordion-button navmenu-mobile-item collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseIndicators" aria-expanded="false" aria-controls="collapseTwo"> <i class="bi bi-bar-chart-fill me-2"></i>Indicators <i class="bi bi-caret-down-fill ms-auto caret-toggle"></i> </button> </div> <div id="collapseIndicators" class="accordion-collapse collapse" data-bs-parent="#accordionNavbar"> <div class="accordion-body mobile-accordion-body"> <ul class="nav navbar-nav navbarMobile"> <li><a class="navmobile-link nav-link" href="/country-list/interest-rate" target="_self">Interest Rate</a></li> <li><a class="navmobile-link nav-link" href="/country-list/inflation-rate" target="_self">Inflation Rate</a></li> <li><a class="navmobile-link nav-link" href="/country-list/unemployment-rate" target="_self">Unemployment Rate</a></li> <li><a class="navmobile-link nav-link" href="/country-list/gdp-growth-rate" target="_self">GDP Growth</a></li> <li><a class="navmobile-link nav-link" href="/country-list/gdp-per-capita" target="_self">GDP per Capita</a></li> <li><a class="navmobile-link nav-link" href="/country-list/current-account-to-gdp" target="_self">Current Account</a></li> <li><a class="navmobile-link nav-link" href="/country-list/gold-reserves" target="_self">Gold Reserves</a></li> <li><a class="navmobile-link nav-link" href="/country-list/government-debt-to-gdp" target="_self">Government Debt</a></li> <li><a class="navmobile-link nav-link" href="/country-list/crude-oil-production" target="_self">Crude Oil Production</a></li> <li><a class="navmobile-link nav-link" href="/country-list/gasoline-prices" target="_self">Gasoline Prices</a></li> <li><a class="navmobile-link nav-link" href="/country-list/rating" target="_self">Credit Rating</a></li> <li><a class='navmobile-link nav-link' href="/indicators" target="_self"><i class="bi bi-plus-square me-2"></i>More Indicators</a></li> </ul> </div> </div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option d-flex align-items-center"> <button class="accordion-button navmenu-mobile-item collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseForecasts" aria-expanded="false" aria-controls="collapseTwo"> <i class="bi bi-graph-down-arrow me-2"></i>Forecasts <i class="bi bi-caret-down-fill ms-auto caret-toggle"></i> </button> </div> <div id="collapseForecasts" class="accordion-collapse collapse" data-bs-parent="#accordionNavbar"> <div class="accordion-body mobile-accordion-body"> <ul class="nav navbar-nav navbarMobile"> <li class="d-block d-sm-none"><a class="navmobile-link nav-link" href="/indicators?g=forecast" target="_self">Markets & Indicators</a></li> <li class="d-block d-sm-none"><a class="navmobile-link nav-link" href="/forecasts" target="_self">Countries</a></li> <li class="d-none d-sm-block"><a class='navmobile-link nav-link' href="/forecasts">Countries</a></li> <li class="d-none d-sm-block"><a class='navmobile-link nav-link' href="/indicators?g=forecast">Indicators</a></li> <li class="d-none d-sm-block"><a class='navmobile-link nav-link' href="/forecast/currency">Currencies</a></li> <li class="d-none d-sm-block"><a class='navmobile-link nav-link' href="/forecast/stock-market">Stocks</a></li> <li class="d-none d-sm-block"><a class='navmobile-link nav-link' href="/forecast/commodity">Commodities</a></li> <li class="d-none d-sm-block"><a class='navmobile-link nav-link' href="/forecast/government-bond-10y">Bonds</a></li> <li class="d-none d-sm-block"><a class='navmobile-link nav-link' href="/forecast/crypto">Crypto</a></li> </ul> </div> </div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option d-flex align-items-center"> <button class="accordion-button navmenu-mobile-item collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseSolutions" aria-expanded="false" aria-controls="collapseTwo"> <i class="bi bi-code-square me-2"></i>Solutions <i class="bi bi-caret-down-fill ms-auto caret-toggle"></i> </button> </div> <div id="collapseSolutions" class="accordion-collapse collapse" data-bs-parent="#accordionNavbar"> <div class="accordion-body mobile-accordion-body"> <ul class="nav navbar-nav navbarMobile"> <li><a class="navmobile-link nav-link" href="/analytics/features.aspx" title="Register">Data Subscriptions</a></li> <li><a class="navmobile-link nav-link" href="/api/" title="Register">API Access</a></li> <li><a class="navmobile-link nav-link" href="/analytics/pricing.aspx?source=nav">Pricing</a></li> </ul> </div> </div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option d-flex align-items-center"> <button class="accordion-button navmenu-mobile-item collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseApps" aria-expanded="false" aria-controls="collapseTwo"> <i class="bi bi-phone me-2"></i>Apps <i class="bi bi-caret-down-fill ms-auto caret-toggle"></i> </button> </div> <div id="collapseApps" class="accordion-collapse collapse" data-bs-parent="#accordionNavbar"> <div class="accordion-body mobile-accordion-body"> <ul class="nav navbar-nav navbarMobile"> <li><a class="navmobile-link nav-link" href="https://itunes.apple.com/us/app/trading-economics/id1142178921?mt=8" target="_self">App Store</a></li> <li><a class="navmobile-link nav-link" href="https://play.google.com/store/apps/details?id=com.tradingeconomics.calendar" target="_self">Google Play</a></li> <li><a class="navmobile-link nav-link" href="https://www.twitter.com/teconomics" target="_self">Twitter</a></li> </ul> </div> </div> </div> <div class="accordion-item"> <div class="accordion-header menu-main-option d-flex align-items-center"> <button class="accordion-button navmenu-mobile-item collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseMore" aria-expanded="false" aria-controls="collapseTwo"> <i class="bi bi-question-circle me-2"></i>About <i class="bi bi-caret-down-fill ms-auto caret-toggle"></i> </button> </div> <div id="collapseMore" class="accordion-collapse collapse" data-bs-parent="#accordionNavbar"> <div class="accordion-body mobile-accordion-body"> <ul class="nav navbar-nav navbarMobile"> <li><a class="navmobile-link nav-link" href="/api/customers.aspx" target="_self">Customers</a></li> <li><a class="navmobile-link nav-link" href="/investors.aspx" target="_self">Investors</a></li> <li><a class="navmobile-link nav-link" href="/careers.aspx" target="_self">Careers</a></li> <li><a class="navmobile-link nav-link" href="/about-te.aspx" target="_self">About us</a></li> <li><a class="navmobile-link nav-link" href="/contact.aspx" target="_self">Contact</a></li> </ul> </div> </div> </div> <div class="accordion-item d-block d-md-none" style="border: none"> <div class="accordion-header menu-main-option accordion-last-item" style="padding: 30px 0px !important;"></div> </div> </div> </div> </div> </div> </div> </nav> <script> document.addEventListener('DOMContentLoaded', function () { let accordionHeaders = document.querySelectorAll('.menu-main-option'); accordionHeaders.forEach(function (header) { header.addEventListener('click', function () { let caretIcon = header.querySelector('.caret-toggle'); let allCaretIcons = document.querySelectorAll('.menu-main-option .caret-toggle'); allCaretIcons.forEach(function (icon) { if (icon !== caretIcon) { icon.classList.remove('bi-caret-up-fill'); icon.classList.add('bi-caret-down-fill'); } }); caretIcon.classList.toggle('bi-caret-down-fill'); caretIcon.classList.toggle('bi-caret-up-fill'); }); }); }); </script> <div class="container"> <div class="row"> <div class='col-xl-12' role="main"> <style> .card-header { font-weight: bold; } </style> <div style="text-align: justify;"> <br /> <div class="page-heading"> <h1><b>CAREERS @ TRADING ECONOMICS</b></h1> </div> <br /> With more than 1.5 billion page views, Trading Economics has become a reference in the world wide web for economic data and financial markets. Trading Economics is a fast growing company which welcomes candidates from all over the world. These are our current job opportunities: <br /> <br /> <br /> <div class="card"> <div class="card-header">Web Developer</div> <div class="card-body"> Trading Economics welcomes candidates that can help us build front-end web applications and back-end systems that will unleash the power of our data. Knowledge of .net core, node.js, python, javaScript and other technologies will weigh positively in your application. You can work remotely or in our office. Some degree in Computer Science or related will weigh positively in your application but is not required. This is a junior entry-level position and payment will be made accordingly.<br /> </div> <div class="card-footer"> <a target="_blank" href="https://tradingeconomics.com/contact.aspx?subject=careers+developer" class="btn btn-primary">Apply</a> </div> </div> <br /> <div class="card"> <div class="card-header">Web Designer</div> <div class="card-body"> You will be responsible for helping us designing the overall layout, user interface (UI), user experience (UX) and aesthetics of Trading Economics. This is a entry-level position but some basic knowledge of HTML, CSS and Javascript is expected. This job is expected to be performed remotely.<br /> </div> <div class="card-footer"> <a target="_blank" href="https://tradingeconomics.com/contact.aspx?subject=careers+designer" class="btn btn-primary">Apply</a> </div> </div> <br /> <div class="card"> <div class="card-header">Data Analyst - Americas</div> <div class="card-body"> Candidates will be responsible for updating our economic calendar with actual figures and write short but insightful comments about economic releases and market data. To qualify, you are required to be available during the release time of several economic indicators, in particular between 1400 EST and 1900 EST. This job is particularly fitted for someone located in the Americas wishing to work remotely. Some knowledge of Macroeconomics will weigh positively in your application but is not required. </div> <div class="card-footer"> <a target="_blank" href="https://tradingeconomics.com/contact.aspx?subject=careers+data+analyst+americas" class="btn btn-primary">Apply</a> </div> </div> <br /> <div class="card"> <div class="card-header">Sales | Business Developer</div> <div class="card-body"> We are excited to announce an opening for a Sales Position that offers an unparalleled opportunity to engage with a diverse client base, from individual users to multinational corporations. At Trading Economics, we value innovation, teamwork, and the pursuit of excellence and we're looking for motivated individuals with a knack for building long term relationships with our clients. </div> <div class="card-footer"> <a target="_blank" href="https://tradingeconomics.com/contact.aspx?subject=careers+sales" class="btn btn-primary">Apply</a> </div> </div> <br /> If the current available job postings do not match your expectations, please submit a <a target="_blank" href="https://tradingeconomics.com/contact.aspx?subject=careers" style="text-decoration:underline">spontaneous application</a>. <br /> </div> </div> </div> <br /> <br /> </div> <div class="container-fluid te-footer"> <footer> <div class="container"> <div class="row"> <div id="ctl00_Footer1_PanelFooter"> <style>.footer-spacer{padding: 4px}.footer-spacer-head{padding: 30px 4px 4px 4px;}@media only screen and (max-width:768px){.footer-icons{display: flex;margin-left: 50%;}.footer-icons a{padding: 0 12px 8px 0px; }}.footer-twitter{width: 50px; height: 50px;}.footer-github{width: 40px; height: 40px;}.footer-appstore{display: inline-block; overflow: hidden; background: url(//d3fy651gv2fhd3.cloudfront.net/images/appstore-lrg.svg?v=20171228) no-repeat; width: 135px; height: 40px; background-size: contain;}</style> <br /> <br /> <div class="container"> <div class="row"> <div class="col-lg-2 col-md-2 col-6"> <div class="footerHeader">Indicators</div> <a id="ctl00_Footer1_HyperLink6" class="footerItems" href="./">Homepage</a><br /> <a id="ctl00_Footer1_HyperLink17" class="footerItems" href="countries">Countries</a><br /> <a id="ctl00_Footer1_HyperLink18" class="footerItems" href="indicators">Indicators</a><br /> <a id="ctl00_Footer1_HyperLink1" class="footerItems" href="calendar">Calendar</a><br /> <a id="ctl00_Footer1_HyperLink2" class="footerItems" href="forecasts">Forecasts</a><br /> <a id="ctl00_Footer1_HyperLink11" class="footerItems" href="country-list/rating">Ratings</a> </div> <div class="col-lg-2 col-md-2 col-6"> <div class="footerHeader">Solutions</div> <a href="/analytics/features.aspx?source=footer"><span class="footerItems">Data Subscriptions</span></a><br /> <a href="/api/?source=footer"><span class="footerItems">API Access</span></a><br /> <a href="/analytics/excel.aspx"><span class="footerItems">Excel Add-In</span></a><br /> <a href="https://developer.tradingeconomics.com/" target="_blank"><span class="footerItems">Developer Account</span></a><br /> <a href="https://docs.tradingeconomics.com/" target="_blank"><span class="footerItems">Documentation</span></a><br /> <a href="/analytics/pricing.aspx?source=footer" target="_blank"><span class="footerItems">Pricing</span></a><br /> <br /> </div> <div class="col-lg-2 col-md-2 col-6"> <div class="footerHeader">About Us</div> <a id="ctl00_Footer1_HyperLink8" class="footerItems" href="api/customers.aspx">Customers</a><br /> <a id="ctl00_Footer1_HyperLink23" class="footerItems" href="careers.aspx">Careers</a><br /> <a id="ctl00_Footer1_HyperLink21" class="footerItems" href="investors.aspx">Investors</a><br /> <a id="ctl00_Footer1_HyperLink20" class="footerItems" href="advertise.aspx">Advertisers</a><br /> <a id="ctl00_Footer1_HyperLink19" class="footerItems" href="about-te.aspx">About us</a><br /> <a id="ctl00_Footer1_HyperLink9" class="footerItems" href="privacy-policy.aspx">Privacy</a> </div> <div class="col-lg-2 col-md-2 col-6"> <div class="footer-spacer-head"></div> <a href="https://itunes.apple.com/us/app/trading-economics/id1142178921?mt=8" class="footer-appstore"></a> <div class="footer-spacer"></div> <a href="https://play.google.com/store/apps/details?id=com.tradingeconomics.calendar"> <img alt="Android app on Google Play" src="https://d3fy651gv2fhd3.cloudfront.net/images/google-play.png" /></a> </div> </div> </div> <br /> <div class="footer-copyright"> <br /> <span>Copyright ©2024 TRADING ECONOMICS<br /> All Rights Reserved</span><br /> </div> <br /> <br /> </div> </div> </div> </footer> </div> </form> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.1/js/bootstrap.bundle.min.js"></script> <script> $(function(){ console.log("js/alerts.ascx") var isAlertsLoaded = false; function LoadAlertsScript() { console.log("Loading Alerts JS") $.getScript('https://d107vmm87795sh.cloudfront.net/historical/te-alerts-bs5.js?v=20230830'); //Bootstrap3: https://d107vmm87795sh.cloudfront.net/historical/te-alerts.js?v=20200117 isAlertsLoaded = true; } $('a[data-bs-toggle="tab"]').on('shown.bs.tab', function (e) { if (!isAlertsLoaded) { var target = $(e.target).attr("href"); if (target == "#alerts") { LoadAlertsScript(); $(window).scrollTop(0); } else if (target == "#calendar-table") { $("#pagemenutabs li").removeClass("active"); document.getElementById("calendar-table").scrollIntoView(); }; } }); if (!isAlertsLoaded && location.href.indexOf("#alerts") != -1) { LoadAlertsScript(); } }); </script> <script> $(function(){ console.log("/js/pagemenu-tabs") // remove calendar tab if no calendar is present var calendarTab = document.querySelector("li a[href='#calendar-table']"); if (!hasCalendar && calendarTab) { var li_parent = calendarTab.closest('li'); li_parent.remove(); console.log('calendar removed using js..'); } // active deactivate calendar on scroll var previousActive = document.querySelector(".pagetabs a.active") var section = document.querySelectorAll(".section"); var sections = {}; Array.prototype.forEach.call(section, function (e) { sections[e.id] = e.offsetTop; }); // hack while there is still tabs on top of the chart var all_togglers = document.querySelectorAll(".pagetabs a[data-bs-toggle]"); for (var i = 0; i < all_togglers.length; i++) { all_togglers[i].addEventListener("click", function (event) { var link = event.target.getAttribute("href"); // remove active from all chart-nav tabs var chartTabs = document.querySelectorAll(".chart-nav li"); for (var i = 0; i < chartTabs.length; i++) { chartTabs[i].classList.remove("active"); } var intradayTab = document.querySelector(".chart-nav li a[href='#intraday']"); var historicalTab = document.querySelector(".chart-nav li a[href='#historical']"); var forecastTab = document.querySelector(".chart-nav li a[href='#forecast']"); if (link == "#historical") { if (intradayTab) { intradayTab.closest('li').style.display = 'block'; intradayTab.closest('li').classList.add("active") } if (historicalTab) { historicalTab.closest('li').style.display = 'block'; if (intradayTab) historicalTab.closest('li').classList.remove("active"); else historicalTab.closest('li').classList.add("active"); } if (forecastTab) { forecastTab.closest('li').style.display = 'none'; forecastTab.closest('li').classList.remove("active"); } swapDataAndApiLinks("historical"); } else if (link == "#forecast") { if (intradayTab) { intradayTab.closest('li').style.display = 'none'; intradayTab.closest('li').classList.remove("active") } if (historicalTab) { historicalTab.closest('li').style.display = 'none'; historicalTab.closest('li').classList.remove("active"); } if (forecastTab) { forecastTab.closest('li').style.display = 'block'; forecastTab.closest('li').classList.add("active"); } swapDataAndApiLinks("forecast"); } else if (link == "#stats") { if (intradayTab) { intradayTab.closest('li').style.display = 'none'; intradayTab.closest('li').classList.remove("active") } if (historicalTab) { historicalTab.closest('li').style.display = 'none'; historicalTab.closest('li').classList.remove("active"); } if (forecastTab) { forecastTab.closest('li').style.display = 'block'; forecastTab.closest('li').classList.add("active"); } swapDataAndApiLinks("stats"); } }); } // swap Data and API links in the page between historical and forecast function swapDataAndApiLinks(type) { var apiUrl = $("#api-url-text").val(); if (typeof apiUrl == 'undefined') apiUrl = ''; var currentUrl = window.location.href; // replace the download btn if ($("#menu-download-btn") && $("#menu-download-btn").length > 0) { downloadBtnAnchor = $("#menu-download-dropdown [data-download=csv]").attr('href'); if (type == "historical" || type == "stats") { downloadBtnAnchor = downloadBtnAnchor.replace(new RegExp("/forecast/", 'g'), "/historical/"); downloadBtnAnchor = downloadBtnAnchor.replace(new RegExp("/forecasts/symbol/", 'g'), "/historical/"); if (currentUrl.indexOf("/commodity/") !== -1) { if (downloadBtnAnchor.indexOf("1900-01-01") === -1) { downloadBtnAnchor = downloadBtnAnchor.replace("?", "/1900-01-01?"); } } } else if (type == "forecast") if (apiUrl.includes("/markets")) { downloadBtnAnchor = downloadBtnAnchor.replace(new RegExp("/historical/", 'g'), "/forecasts/symbol/"); } else { if (currentUrl.indexOf("/commodity/") !== -1) { downloadBtnAnchor = downloadBtnAnchor.replace(new RegExp("/1900-01-01?", 'g'), ""); } downloadBtnAnchor = downloadBtnAnchor.replace(new RegExp("/historical/", 'g'), "/forecast/"); } $("#menu-download-dropdown [data-download=csv]").attr('href', downloadBtnAnchor); } // replace the API inner text var apiContent = $("#api-msg-panel").html(); if (apiContent) { if (type == "historical" || type == "stats") { apiContent = apiContent.replace(new RegExp("/forecasts/symbol/", 'g'), "/historical/"); apiContent = apiContent.replace(new RegExp("/forecast/", 'g'), "/historical/"); //if (TECategory == 'Commodity') { // apiContent = apiContent.replace(new RegExp("await te.getMarketsForecast", 'g'), "await te.getHistoricalMarkets"); //apiContent = apiContent.replace(new RegExp("getMarketsForecasts", 'g'), "getHistorical"); //} else { apiContent = apiContent.replace(new RegExp("await te.getForecast", 'g'), "await te.getHistoricalData"); apiContent = apiContent.replace(new RegExp("getForecastData", 'g'), "getHistoricalData"); //} $("#api-msg-panel").html(apiContent); if (currentUrl.includes("/commodity/") !== -1) { if (apiContent.indexOf("1900-01-01") === -1) { apiContent = apiContent.replace("?", "/1900-01-01?"); } } } else if (type = "forecast") { if (apiUrl.includes("/markets")) { apiContent = apiContent.replace(new RegExp("/historical/", 'g'), "/forecasts/symbol/"); } else { apiContent = apiContent.replace(new RegExp("/historical/", 'g'), "/forecast/"); apiContent = apiContent.replace(new RegExp("getHistoricalData", 'g'), "getForecastData"); apiContent = apiContent.replace(new RegExp("await te.getForecastData", 'g'), "await te.getForecast"); if (TESymbol.length > 0) { if (TECategory == 'Commodity') { apiContent = apiContent.replace(new RegExp("symbolToReplace", 'g'), TESymbol + ':COM'); } /*else if (TECategory == 'Currency') { apiContent = apiContent.replace(new RegExp("symbolToReplace", 'g'), TESymbol + ':CUR'); } else if (TECategory == 'Stock Market' || TECategory == 'Index') { apiContent = apiContent.replace(new RegExp("symbolToReplace", 'g'), TESymbol + ':IND'); } else if (TECategory == 'Stock') { apiContent = apiContent.replace(new RegExp("symbolToReplace", 'g'), apiUrl.split("/")[1]); } else if (TECategory.toLowerCase().includes('bond')) { apiContent = apiContent.replace(new RegExp("symbolToReplace", 'g'), TESymbol + ':GOV'); } else { apiContent = apiContent.replace(new RegExp("symbolToReplace", 'g'), 'SYMBOL'); }*/ } else { apiContent = apiContent.replace(new RegExp("symbolToReplace", 'g'), 'SYMBOL'); } if (currentUrl.indexOf("/commodity/") !== -1) { apiContent = apiContent.replace(new RegExp("/1900-01-01?", 'g'), ""); } } $("#api-msg-panel").html(apiContent); } } // replace the Data inner text var dataContent = $("#data.tab-pane").html(); if (dataContent) { if (type == "historical") { dataContent = dataContent.replace(new RegExp("/forecast/", 'g'), "/historical/"); $("#data.tab-pane").html(dataContent); if (currentUrl.indexOf("/commodity/") !== -1) { if (dataContent.indexOf("1900-01-01") === -1) { dataContent = dataContent.replace("?", "/1900-01-01?"); } } } else if (type = "forecast") { dataContent = dataContent.replace(new RegExp("/historical/", 'g'), "/forecast/"); $("#data.tab-pane").html(dataContent); if (currentUrl.indexOf("/commodity/") !== -1) { dataContent = dataContent.replace(new RegExp("/1900-01-01?", 'g'), ""); } } } // replace export var exportContent = $("#export-mssg-panel").html(); if (exportContent) { if (type == "historical" || type == "stats") { exportContent = exportContent.replace(new RegExp("/forecast/", 'g'), "/historical/"); exportContent = exportContent.replace(new RegExp("/forecasts/symbol/", 'g'), "/historical/"); exportContent = exportContent.replace(new RegExp("Forecast", 'g'), "Historical"); if (currentUrl.indexOf("/commodity/") !== -1) { if (exportContent.indexOf("1900-01-01") === -1) { var urlHist = "/ticker/" + TESymbol + "/1900-01-01"; var urlFor = "/ticker/" + TESymbol exportContent = exportContent.replace(new RegExp(urlFor, 'g'), urlHist); } } } else if (type = "forecast") { if (apiUrl.includes("/markets")) { exportContent = exportContent.replace(new RegExp("/historical/", 'g'), "/forecasts/symbol/"); } else { exportContent = exportContent.replace(new RegExp("/historical/", 'g'), "/forecast/"); if (currentUrl.indexOf("/commodity/") !== -1) { exportContent = exportContent.replace(new RegExp("/1900-01-01?", 'g'), ""); } } exportContent = exportContent.replace(new RegExp("Historical", 'g'), "Forecast"); } $("#export-mssg-panel").html(exportContent); } } var expandable_panel = document.getElementById("expand-panel"); var expand_links = document.getElementsByClassName("show-expand-panel"); var scroll_top_links = document.getElementsByClassName("scroll-top-on-click"); // scroll top for (var i = 0; i < scroll_top_links.length; i++) { scroll_top_links[i].addEventListener("click", function (event) { scrollTop(event) }); } function scrollTop() { window.scroll(0, 0); console.log("scroll top!"); } // show on click for (var i = 0; i < expand_links.length; i++) { expand_links[i].addEventListener("click", function (event) { expandPanelOnClick(event) }); } function expandPanelOnClick(event) { // get the element var element = event.target.closest("a.show-expand-panel"); // check if the element is expanding the panel if (element.classList.contains("expanding-panel")) return; // clear all the panel opened hidePanel(); // find the current element anchor and build the borders element.classList.add("expanding-panel"); // find the active li and remove the bottom border var active_anchor = document.querySelector(".pagetabs .nav li.active a"); active_anchor.classList.add("expand-panel-open"); // loader var loader = $("<div class='loader' style='width: 30px; height: 30px; align-self: center;'></div>"); // clear the panel content var panel_content = document.getElementById("expand-panel-content"); // show the right panel, by convention, it looks for the panel with the element id name, removing the word 'link' var elementId = element.id.replace("Link", ""); var panelToOpen = expandable_panel.querySelector("#" + elementId); if (panelToOpen) panelToOpen.hidden = false; // display the panel expandable_panel.style.display = "block"; console.log("panel openned"); } // hide on outside click function hidePanelOnClickOutside(element) { const isVisible = elem => !!elem && !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); const outsideClickListener = event => { // find the anchor expanding the panel var anchor_expanding = document.querySelector(".pagetabs .nav li a.expanding-panel"); if (!anchor_expanding) return; // if the element is not the panel or its children, or the anchor that expanded it, hide the panel if (!element.contains(event.target) && event.target.closest("a.show-expand-panel") != anchor_expanding) { if (isVisible(element)) { hidePanel(); } } }; document.addEventListener('click', outsideClickListener); } hidePanelOnClickOutside(expandable_panel); function hidePanel() { // hide the panel expandable_panel.style.display = "none"; // all panels hidden var panelsToHide = expandable_panel.querySelectorAll("#expand-panel-content > div"); if (panelsToHide) { for (var i = 0; i < panelsToHide.length; i++) { panelsToHide[i].hidden = true; } } // find the active li and add the bottom border var active_anchor = document.querySelector(".pagetabs .nav li.active a"); if (active_anchor) active_anchor.classList.remove("expand-panel-open"); // remove the class from the anchor expanding the panel var anchor_expanding = document.querySelector(".pagetabs .nav li a.expanding-panel"); if (anchor_expanding) anchor_expanding.classList.remove("expanding-panel"); console.log("panel closed"); } }); </script> <script>console.log("/js/chartec.ascx");</script> <script src='https://d1v8a2ofhkdel3.cloudfront.net/cdn/highstock_exporting.2024.10.1.0.js'></script> <link href="https://d2xewprs6ejfae.cloudfront.net/production/ec.min.css?v=20240320" rel="stylesheet" /> <script src="https://d2xewprs6ejfae.cloudfront.net/production/ec.min.js?v=20240320"></script> <style>.modal-dialog-centered{display:flex;align-items:center;justify-content:center;height:calc(100% - 60px)}.modal-footer,.modal-header{padding:10px 15px;border:none}#menu-download-dropdown li{padding:0;border-top:none}#menu-download-dropdown li a{padding:10px 20px;display:flex}</style> <script> $(function(){ console.log("/js/pagemenu-exports") // Bootstrap offcanvas events, fix for static one $('.navbar-toggler-icon').click(function () { $(".pagemenu, .pagetabs").css('padding-right', '17px'); }); $('.userOptionsMenu').click(function () { $(".pagemenu, .pagetabs").css('padding-right', '17px'); }); $('.offcanvas').on('show.bs.offcanvas hidden.bs.offcanvas', function () { var isShown = $(this).hasClass('show'); $(".pagemenu, .pagetabs").css('padding-right', isShown ? '17px' : ''); }); var pageTabs = document.querySelector(".pagetabs"); if (pageTabs) { pageTabs.addEventListener("click", function (e) { if (e.target.classList.contains("scroll-top-on-click")) { window.scroll(0, 0); } }); } // build the event to the click $('body').on("click", "a[data-download]", function (event) { event.preventDefault(); event.stopPropagation(); downloadBtnClickEvent(event); }); $('.pagetabs').on('click', '.page-scroll', function () { $('html, body').animate({ scrollTop: $($.attr(this, 'href')).offset().top }, 500); return false; }); $('.pagetabs').on('click', '.page-scroll-adjusted', function () { $('html, body').animate({ scrollTop: $($.attr(this, 'href')).offset().top - 135 }, 500); return false; }); var indicatorPage = false, calendarPage = false, forecastPage = false, snapshotPage = false;; var URL = window.location.pathname; var hasTabs = false; var tab = '<li class="nav-item"><a class="nav-link dropdown-toggle" href="" id="menu-download-btn" class="dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-download"></i> Export</a>' tab += '<ul id="menu-download-dropdown" class="dropdown-menu">' tab += '<li class="dropdown-item"><a href="#" data-download="csv"><img src="https://d3fy651gv2fhd3.cloudfront.net/images/downloadicons/download-csv-filled.svg" alt="CSV download button" style="height: 25px; width: 25px"> Download Data</a></li>' tab += '<li class="dropdown-item"><a href="#" data-download="excel"><img src="https://d3fy651gv2fhd3.cloudfront.net/images/downloadicons/microsoft-excel-filled.svg" alt="Excel download button" style="height: 25px; width: 25px"> Excel Add-in</a></li>' tab += '<li class="dropdown-item"><a href="#" data-download="api"><img src="https://d3fy651gv2fhd3.cloudfront.net/images/downloadicons/download-api.svg" alt="API download button" style="height: 25px; width: 25px"> API Access</a></li>' tab += '</ul></li>' if ( URL.indexOf("/currencies") > -1 || URL.indexOf("/stocks") > -1 || URL.indexOf("/bonds") > -1 || URL.indexOf("/commodities") > -1 || URL.indexOf("/crypto") > -1 || URL.indexOf(":") > -1 || URL.indexOf("/forecast/currency") > -1 || URL.indexOf("/forecast/stock-market") > -1 || URL.indexOf("/forecast/government-bond-10y") > -1 || URL.indexOf("/forecast/commodity") > -1 || URL.indexOf("/forecast/crypto") > -1 || // !isLoggedIn because API endpoints are still not implemented (!isLoggedIn && URL.split('/').length == 3 && (['indicators', 'forecast'].includes(URL.split('/')[2]) || ['country-list','forecastt'].includes(URL.split('/')[1])))) { var download_link = "https://docs.tradingeconomics.com/"; if (!isLoggedIn) { if (!hasTabs) { console.log("/js/pagemenu", "appending tab") if (IsMobile) { var tab = "<li><a href='" + download_link + "' data-download='csv' class='nav-link'><i class='bi bi-download d-none d-lg-inline'></i> Export</a></li>"; $('#pagemenutabs').append(tab); } else { $('#pagemenutabs').append(tab); } hasTabs = true; snapshotPage = true; } } else { var download_link = "https://api.tradingeconomics.com/"; if (URL.indexOf("/forecast/commodity") > -1) { download_link += "/markets/forecasts/commodity"; } else if (URL.indexOf("/forecast/currency") > -1) { download_link += "/markets/forecasts/currency"; } else if (URL.indexOf("/forecast/stock-market") > -1) { download_link += "/markets/forecasts/index"; } else if (URL.indexOf("/forecast/government-bond-10y") > -1) { download_link += "/markets/forecasts/bond"; } else if (URL.indexOf("/forecast/crypto") > -1) { download_link += "/markets/forecasts/crypto"; } else if (URL.indexOf("/currencies") > -1) { download_link += "markets/currency"; } else if (URL.indexOf("/stocks") > -1) { download_link += "markets/index"; } else if (URL.indexOf("/bonds") > -1) { download_link += "markets/bond"; } else if (URL.indexOf("/commodities") > -1) { download_link += "markets/commodities"; } else if (URL.indexOf("/crypto") > -1) { download_link += "markets/crypto"; } else if (URL.indexOf(":") > -1) { var currCsvDownload = $("#data a.export-btn-csv").attr("href"); download_link = currCsvDownload; } if (!hasTabs) { var tab = "<li class='nav-item'><a class ='nav-link' href='" + download_link + "' data-download='csv'><i class='bi bi-download'></i> Export</a></li>"; $('#pagemenutabs').append(tab); hasTabs = true; } } snapshotPage = true; } else if (URL.indexOf("/stock-market") > -1 || URL.indexOf("/currency") > -1 || URL.indexOf("/commodity/") > -1 || URL.indexOf("yield") > -1) { if (!isLoggedIn && !hasTabs) { console.log('@pagemmenu - adding download tab') if (IsMobile) { var tab = "<li class='nav-item'><a class ='nav-link' href='" + download_link + "' data-download='csv'><i class='bi bi-download d-none d-lg-inline'></i> Export</a></li>"; $('#pagemenutabs').append(tab); hasTabs = true; } else { $('#pagemenutabs').append(tab); } hasTabs = true; } } else if ($("#menu-download-btn") && $("#menu-download-btn").length > 0) { indicatorPage = true; buildDownloadList($("#menu-download-btn")); $("#menu-download-btn").click(function () { ga('event', 'te_click_data_dropdown'); }); } else if ($(".calendar-download") && $(".calendar-download").length > 0) { calendarPage = true; buildDownloadButton($(".calendar-download")); } else if ($(".indicators-download") && $(".indicators-download").length > 0) { buildDownloadButton($(".indicators-download")); } function downloadBtnClickEvent(event) { console.log("download click .."); var downloadBtn = $(event.target).closest("a"); var dataDownload = $(downloadBtn).attr("data-download"); if (!dataDownload) return; console.log("data-download = " + dataDownload); var modalTitle = ""; var modalContent = ""; var modalFooter = ""; var loginReturn = "https://sso.tradingeconomics.com/?returnurl=https://tradingeconomics.com" + URL; var loginAction = "<a class='btn btn-outline-secondary' href='" + loginReturn + "' target='_blank'>" + (IsMobile ? "Login" : "Member? <b>Login</b>") + "</a>"; var GAEvent = null; var gCategory = null; if (indicatorPage) { gCategory = 'Indicator'; if (gCategory && URL.indexOf("forecast") > -1) { gCategory += '_forecast' }; } else if (calendarPage) { gCategory = 'Calendar'; if (gCategory && URL.indexOf("forecast") > -1) { gCategory += '_forecast' }; } else if (snapshotPage) { gCategory = 'Snapshot'; if (URL.indexOf("/forecast/commodity") > -1) gCategory = "markets_forecasts_commodity"; else if (URL.indexOf("/forecast/currency") > -1) gCategory = "markets_forecasts_currency"; else if (URL.indexOf("/forecast/stock-market") > -1) gCategory = "markets_forecasts_index"; else if (URL.indexOf("/forecast/government-bond-10y") > -1) gCategory = "_markets_forecasts_bond"; else if (URL.indexOf("/forecast/crypto") > -1) gCategory = "markets_forecasts_crypto"; else if (URL.indexOf("/currencies") > -1) gCategory = "markets_currency"; else if (URL.indexOf("/stocks") > -1) gCategory = "markets_index"; else if (URL.indexOf("/bonds") > -1) gCategory = "markets_bond"; else if (URL.indexOf("/commodities") > -1) gCategory = "markets_commodities"; else if (URL.indexOf("/crypto") > -1) gCategory = "markets_crypto"; else if (URL.indexOf(":") > -1) gCategory = "markets_symbols"; else if (URL.indexOf("/country-list/") > -1) gCategory = 'category'; else if (URL.indexOf("/forecast/") > -1) gCategory = 'category_forecast'; else if (URL.indexOf("forecast") > -1) gCategory = 'country_forecast'; else if (URL.indexOf("/indicators") > -1) gCategory = 'country'; } switch (dataDownload) { case "csv": if (isLoggedIn) { GAEvent = 'te_click_csv_download'; ga('event', GAEvent); console.log('GAEvent', GAEvent); downloadItem(event.target, dataDownload); return; } else { //modalTitle = "<b>Join Trading Economics</b>"; modalContent = "Trading Economics has more than 20 million economic indicators for nearly 200 countries, plus exchange rates, government bond yields, stock indexes, shares and commodity prices. "; modalContent += "Subscription users can use our site to export data in <b>CSV</b>, <b>JSON</b> or <b>XML</b>. Users can get it directly through an <b>Excel</b> add-in. "; modalContent += "Clients can also use an <b>API</b> to have direct access to our data, to query our real-time economic calendar and to subscribe to updates from any programming language."; modalFooter += "<div style='text-align:center;'><div class='btn-group'><a class='btn btn-outline-secondary' href='https://tradingeconomics.com/analytics/features.aspx' target='_blank'>Learn More</a>"; modalFooter += "<a class='btn btn-outline-secondary' href='https://tradingeconomics.com/analytics/pricing.aspx' target='_blank'>Pricing</a>"; modalFooter += "<a class='btn btn-outline-secondary' href='https://tradingeconomics.com/contact.aspx?subject=data' target='_blank'>" + (IsMobile ? "Contact" : "Questions? <b>Contact us</b>") + "</a>"; modalFooter += loginAction; modalFooter += "</div></div>" GAEvent = 'te_click_csv'; if (gCategory != null) GAEvent += '_' + gCategory.toLowerCase(); } break; case "excel": modalTitle = "<b>Trading Economics Excel Add-in</b>"; modalContent += "The Trading Economics Excel Addin allows users with an active subscription to access our data directly from excel. " modalContent += "Trading Economic provides more than 20 million economic indicators for nearly 200 countries, plus exchange rates, government bond yields, stock indexes, and commodity prices. "; modalFooter = "<div style='text-align:center;'><div class='btn-group'><a class='btn btn-outline-secondary' href='https://tradingeconomics.com/analytics/excel.aspx' target='_blank'>Learn More</a>"; modalFooter += "<a class='btn btn-outline-secondary' data-download='excel-addin'>Download Addin</a>"; modalFooter += "<a class='btn btn-outline-secondary' href='https://tradingeconomics.com/contact.aspx?subject=excel' target='_blank'>Questions? <b>Contact us</b></a>"; if (!isLoggedIn) modalFooter += loginAction; modalFooter += "</div></div>"; GAEvent = 'te_click_excel'; if (gCategory != null) GAEvent += '_' + gCategory.toLowerCase(); break; case "api": modalTitle = "<b>Trading Economics API</b>"; modalContent = "<div>"; modalContent += "API Users have direct access to our economic data from any programming language, can query our real-time calendar, retrieve financial market quotes and subscribe to live updates. "; modalContent += "Trading Economics provides more than 20 million economic indicators for nearly 200 countries, plus exchange rates, government bond yields, stock indexes, and commodity prices." modalContent += "</div>"; modalFooter = "<div style='text-align:center;'><div class='btn-group'><a class='btn btn-outline-secondary' href='https://tradingeconomics.com/api/' target='_blank'>Learn More</a>"; modalFooter += "<a class='btn btn-outline-secondary' href='https://docs.tradingeconomics.com/' target='_blank'>API Docs</a>"; modalFooter += "<a class='btn btn-outline-secondary' href='https://tradingeconomics.com/api/contact.aspx' target='_blank'>Questions? <b>Contact us</b></a>"; if (!isLoggedIn) modalFooter += loginAction; modalFooter += "</div></div>"; GAEvent = 'te_click_api'; if (gCategory != null) GAEvent += '_' + gCategory.toLowerCase(); break; case "api-calendar": modalTitle = "<b>Trading Economics API</b>" modalContent = "The Trading Economics API provides you with direct access to our calendar, instant updates after economic events get released, historical data on thousands of indicators and live market quotes. "; modalFooter = "<div style='text-align:center'><div class='btn-group'><a class='btn btn-outline-secondary' href='../api/?source=calendar' target='_blank'>Learn More</a>"; modalFooter += "<a class='btn btn-outline-secondary' href='https://tradingeconomics.com/api/contact.aspx?subject=api+calendar' target='_blank'>Any question? <b>Contact us</b></a>"; if (!isLoggedIn) modalFooter += loginAction; modalFooter += "</div></div>"; GAEvent = 'te_click_calendar_api'; break; case "excel-addin": GAEvent = 'te_click_excel'; window.location = 'https://github.com/tradingeconomics/tradingeconomics/raw/master/Excel/All_Releases/ExcelAddInDeploy_latest.msi'; return; break; case "forecast": //modalTitle = "<b>Trading Economics Forecasts</b>"; modalContent += "At TRADING ECONOMICS, our forecasts rely on our proprietary global macro model and analysts expectations. We believe that global economies and financial markets are closely intertwined. Our approach involves establishing a general directional bias and then utilizing computer algorithms to calculate price levels. " modalContent += "<br><br>We have five standard investment ratings: " modalContent += "<br><br><img class='recommendation-img' src='//d3fy651gv2fhd3.cloudfront.net/images/recommendations.png' />" modalContent += "<br><br><p><b>Disclaimer</b></p>"; modalContent += "Forecasts and ratings displayed on TRADING ECONOMICS are for informational purposes only. Trading involves a significant risk of loss and may not be suitable for all investors. Therefore, we advise users to exercise caution and do their own research before making any financial decisions." modalFooter += "</div></div>" GAEvent = 'te_click_forecast'; } if (GAEvent != null) { ga('event', GAEvent); console.log('GAEvent: ', GAEvent); } showDownloadModal(modalTitle, modalContent, modalFooter); } function showDownloadModal(modalTitle, modalContent, modalFooter) { var modal = "<div class ='modal' id='downloadModal' tabindex='-1' role='dialog' aria-labelledby='myModalLabel'>"; modal += "<div class='modal-dialog modal-dialog-centered' role='document'>"; modal += "<div class='modal-content'>"; modal += "<div class='modal-header'><div class='modal-title'></div><button type='button' class ='btn-close' data-bs-dismiss='modal' aria-label='Close'></button></div>"; modal += "<div class='modal-body' style='text-align:justify;'></div>" modal += "<div class='modal-footer'></div>" modal += "</div></div></div>" var jModal = $(modal); $(jModal).find(".modal-title").html(modalTitle); // define the modal content if (modalContent) $(jModal).find(".modal-body").html(modalContent); else $(jModal).find(".modal-body").remove(); // define the modal footer if (modalFooter) $(jModal).find(".modal-footer").html(modalFooter); else $(jModal).find(".modal-footer").remove(); $(jModal).on('show.bs.modal', function (e) { $(".navbar").css("padding-right", "17px"); $(".pagemenu").css("padding-right", "17px"); $(".pagetabs").css("padding-right", "17px"); }); $(jModal).on('hide.bs.modal', function (e) { $(".navbar").css("padding-right", ""); $(".pagemenu").css("padding-right", ""); $(".pagetabs").css("padding-right", ""); }); $(jModal).modal("show"); } function buildDownloadList(downloadBtn) { console.log("/js/pagemenu", "buildDownloadList", downloadBtn) downloadBtn.addClass("dropdown-toggle"); downloadBtn.attr("data-bs-toggle", "dropdown"); var csvLink = $("<li><a href='#' data-download='csv'><img src='https://d3fy651gv2fhd3.cloudfront.net/images/downloadicons/download-csv-filled.svg' alt='CSV download button' style='height: 25px; width: 25px'> Download Data</a></li>"); var excelLink = $("<li><a href='#' data-download='excel'><img src='https://d3fy651gv2fhd3.cloudfront.net/images/downloadicons/microsoft-excel-filled.svg' alt='Excel download button' style='height: 25px; width: 25px'> Excel Add-in</a></li>"); var apiLink = $("<li><a href='#' data-download='api'><img src='https://d3fy651gv2fhd3.cloudfront.net/images/downloadicons/download-api.svg' alt='API download button' style='height: 25px; width: 25px'> API Access</a></li>"); var dataportalLink = $("<li><a href='https://data.tradingeconomics.com'><i class='bi bi-save2-fill ms-1'></i> Data Portal</a></li>"); // THIS IS A HACK SO WE DONT NEED TO REWRITE THE LINK BUILT IN THIS MOMENT var currCsvDownload = $("#data a.export-btn-csv").attr("href"); if (currCsvDownload) csvLink = $("<li><a href='" + currCsvDownload + "' data-download='csv' target='_blank'><img src='https://d3fy651gv2fhd3.cloudfront.net/images/downloadicons/download-csv-filled.svg' alt='CSV download button' style='height: 25px; width: 25px'> Download Data</a></li>"); var downloadList = $("<ul id='menu-download-dropdown' class='dropdown-menu'>"); downloadList.append(csvLink); downloadList.append(excelLink); downloadList.append(apiLink); if (isLoggedIn) downloadList.append(dataportalLink); downloadBtn.after(downloadList); } function buildDownloadButton(container) { if (isLoggedIn) { var downloadBtn = $("<a id='HyperLinkToDownload' href='https://api.tradingeconomics.com/calendar' class='btn btn-info' data-download='csv'><i class='bi bi-download'></i><span class='d-none d-lg-inline'> Download</span></a>"); var apiBtn = $("<a id='HyperLinkToAPI' href='#' class='btn btn btn-outline-secondary' data-download='api-calendar'><i class='bi bi-grid-fill hidden-sm'></i> API</a>"); $(container).append(downloadBtn); $(container).append(apiBtn); } else { var downloadBtn = $("<a id='HyperLinkToDownload' href='https://api.tradingeconomics.com/calendar' class='btn btn-outline-secondary' data-download='api-calendar'><i class='bi bi-download'></i><span class='d-none d-lg-inline'> Download</span></a>"); $(container).append(downloadBtn); } } var lock_download = false; function downloadItem(target, format) { target = $(target).closest('a'); if (!target || target.length == 0 || !$(target).is('a')) { console.log('Download link not found'); return; } if (lock_download) return; lock_download = true; var url = $(target).attr('href'); console.log('url to download = ' + url); var d_type = format; if (format == 'csv') { url = url.replace('format=csv', 'format=json'); d_type = 'json'; } var loader = $("<span> </span><div class='loader' style='height: 15px;width: 15px;display: inline-block;vertical-align: text-bottom;'></div>"); $(target).append(loader); $.ajax({ url: url, type: "GET", dataType: d_type, xhrFields: { withCredentials: true }, }).done(function (data, status, xhr) { console.log('SUCCESS'); console.log('status = ' + xhr.status); console.log('data = ' + data.length); // ga event for logged in successful CSV download if (indicatorPage) { var GAEvent = 'te_click_data_dropdown' ga('event', GAEvent, { 'format': format }); console.log('GAEvent:', GAEvent); } else if (calendarPage) { var GAEvent = 'te_click_calendar' ga('event', GAEvent, { 'format': format }); console.log('GAEvent:', GAEvent); } else if (snapshotPage) { var GAEvent = 'te_click_snapshot' ga('event', GAEvent, { 'format': format }); console.log('GAEvent:', GAEvent); } var filename = buildFilename(url, format); downloadData(data, filename, format); }).fail(function (xhr, status, error) { console.log('ERROR'); console.log('status = ' + xhr.status); console.log('error message = ' + xhr.responseText) // ga event for logged in failed CSV download if (indicatorPage) { var GAEvent = 'te_click_data_dropdown' ga('event', GAEvent, { 'format': format }); console.log('GAEvent::', GAEvent); } else if (calendarPage) { var GAEvent = 'te_click_calendar' ga('event', GAEvent, { 'format': format }); console.log('GAEvent::', GAEvent); } else if (snapshotPage) { var GAEvent = 'te_click_snapshot' ga('event', GAEvent, { 'format': format }); console.log('GAEvent::', GAEvent); } if (xhr.status) { switch (xhr.status) { case 401: // unauthorized launchInvalidKeyModal(); break; case 403: // forbidden launchTrialOverModal(); break; case 400: // bad request launchBadRequestModal(); break; case 409: // conflict (more requests per second than allowed) launchThrottleModal(); break; default: console.log('Unhandled status = ' + xhr.status) var redirect_url = ''; if (TECountry) { redirect_url = 'https://data.tradingeconomics.com/data/export/bycountry?country=' + TECountry; } else { redirect_url = 'https://data.tradingeconomics.com/'; } console.log('redirecting to: ' + redirect_url); window.open(redirect_url, '_blank'); break; } } }).always(function (xhr, status, error) { lock_download = false; console.log('done downloading!'); loader.remove(); }); }; function buildFilename(url, format) { var filename = decodeURI(url); filename = filename.replace("https://api.tradingeconomics.com/", ""); var questionMark = filename.indexOf('?'); if (questionMark != -1) filename = filename.substring(0, questionMark); filename = filename.replace(/\//g, '_'); filename = filename.replace(/\s/g, '_'); filename = filename.replace(/:/g, '_'); filename = filename.replace(/-/g, '_'); return filename + '.' + format; } function downloadData(data, filename, type) { var dataFile = null; switch (type) { case "csv": var csv = convertArrayOfObjectsToCSV({ data: data }); if (csv == null) return; // create the csv file var dataFile = new Blob([csv], { type: "text/csv;charset=utf-8" }); break; case "json": var dataFile = new Blob([JSON.stringify(data)], { type: "text/json;charset=utf-8" }); break; case "xml": var dataFile = new Blob([new XMLSerializer().serializeToString(data.documentElement)], { type: "text/plain;charset=utf-8" }); break; } if (dataFile != null) { var anchor = document.createElement('a'); anchor.href = window.URL.createObjectURL(dataFile); anchor.setAttribute("d-none", true); anchor.setAttribute("target", "_self"); anchor.setAttribute("download", filename); document.body.appendChild(anchor); anchor.click(); anchor.remove(); } } /* Download CSV from: https://halistechnology.com/2015/05/28/use-javascript-to-export-your-data-as-csv/ */ function convertArrayOfObjectsToCSV(args) { var result, ctr, keys, columnDelimiter, lineDelimiter, data; data = args.data || null; if (data == null || !data.length) { return null; } columnDelimiter = args.columnDelimiter || ','; lineDelimiter = args.lineDelimiter || '\r\n'; keys = Object.keys(data[0]); result = ''; result += keys.join(columnDelimiter); result += lineDelimiter; data.forEach(function (item) { ctr = 0; keys.forEach(function (key) { if (ctr > 0) result += columnDelimiter; result += item[key]; ctr++; }); result += lineDelimiter; }); return result; } function errorModal(title, text, actionLink, actionMsg, contactSubject) { var modalTitle = "<span><b>" + title + "</b></span>"; var modalFooter = "<div style='text-align:center;'><div class='btn-group'>"; if (actionLink && actionMsg) modalFooter += "<a class='btn btn-primary' href='" + actionLink + "'>" + actionMsg + "</a>"; modalFooter += "<a class='btn btn-outline-secondary' href='https://tradingeconomics.com/contact.aspx?subject=" + contactSubject + "' target='_blank'>Any question? <b>Contact us</b></a></div></div>"; showDownloadModal(modalTitle, text, modalFooter); } function launchTrialOverModal(experience) { errorModal("Trading Economics Data", "Activate your plan to get more data from Trading Economics", "https://billing.tradingeconomics.com/plans.aspx?activate=true", "ACTIVATE", "account+limit"); } function launchInvalidKeyModal() { errorModal("Trading Economics Data", "Trading Economics provides its premium members with access to more than 20 million indicators for 196 countries plus historical/delayed/live quotes for exchange rates, stocks, indexes, bonds and commodity prices. Subscribe to a plan to download data in a easy to use web interface, using our excel addin or our API.", "https://billing.tradingeconomics.com/plans.aspx?lead=true", "Get Started", "Subscription+Plans"); } function launchThrottleModal() { errorModal("Trading Economics Data", "Limit of request per second reached", null, null, "API+Access"); } function launchBadRequestModal() { errorModal("Trading Economics Data", "Something went wrong with the request, please contact support@tradingeconomics.com, or click the button bellow", "https://tradingeconomics.com/api/contact.aspx?subject=Bad+Request", "CONTACT SUPPORT", "API+Access"); } }); </script> <style> .morelink { text-decoration: none; outline: none; font-size: 85%; color: #808080; } .morecontent span { display: none; } </style> <script> $(function(){ console.log('Shorten Text') var showChar = 300; var ellipsestext = "..."; var moretext = "more"; var lesstext = "less"; $('.more').each(function () { var content = $(this).html(); if (content.length > showChar) { var c = content.substr(0, showChar); var h = content.substr(showChar, content.length - showChar); var html = c + '<span class="moreellipses">' + ellipsestext + '</span><span class="morecontent"><span>' + h + '</span> <a href="" class="morelink">' + moretext + '</a></span>'; $(this).html(html); } }); $(".morelink").click(function () { if ($(this).hasClass("less")) { $(this).removeClass("less"); $(this).html(moretext); } else { $(this).addClass("less"); $(this).html(lesstext); } $(this).parent().prev().toggle(); $(this).prev().toggle(); return false; }); }); </script> <style> .te-stream-title-div { padding-bottom: 5px; } .te-stream-item-3 { background-color: #f6cbcb; } .te-stream-item-2 { background-color: #eff3ff } .te-stream-country { background-color: #333; } .te-stream-category { background-color: #858585; } </style> <script type="text/javascript"> console.log("Stream JS"); var streamBaseURL = '/ws/stream.ashx'; var streamStart = 0; var streamSize = 20; var streamHeight = 1000; var streamPreviousTitle = ''; var streamIsLoading = false; var IsTicker = true; if (window.location.pathname.indexOf('/stream') !== -1 || window.location.pathname.indexOf('/news') !== -1) IsTicker = false; function getParameterByName(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, " ")); } function getItem(j, isPrepend) { //console.log(JSON.stringify(j)) if (j.title) { if (streamPreviousTitle != j.title) { if (!j.url) j.url = '/'; var item = "<li id='" + j.ID + "' "; item += "class='list-group-item te-stream-item"; if (!IsTicker && j.importance) { if (j.importance == 3) item += " te-stream-item-3"; else if (j.importance == 2) item += " te-stream-item-2"; } item += "'>" item += "<div class='te-stream-title-div d-flex justify-content-between'>"; if (IsTicker) { item += "<b>" + j.title + "</b>"; } else { var titleClass = 'te-stream-title' if (j.importance) { if (j.importance == 3) titleClass = "te-stream-title-3"; else if (j.importance == 2) titleClass = "te-stream-title-2"; } item += "<a class='" + titleClass + "' href=" + j.url + "><b>" + j.title + "</b></a>"; item += "<div>" item += '<a class="badge small te-stream-country" href="/stream?c=' + j.country.toLowerCase().replace(" ", "+") + '">' + j.country + '</a>'; if (j.category && j.category != j.country) { item += ' <a class="badge small te-stream-category" href="/stream?i=' + j.category.toLowerCase().replace(" ", "+") + '">' + j.category + '</a>'; } item += '</div>' } item += "</div>"; if (j.html) item += j.html; else if (j.description) item += j.description; if (j.image) item += '<br/><img src="' + j.image + '"></img>'; if (j.diff) item += '<br/><small>' + j.diff + '</small>'; item += '</li>'; streamPreviousTitle = j.title; if (isPrepend) { $("#stream").prepend(item); /* setTimeout(function () { $("#" + j.ID).css("backgroundColor", '#fff'); }, 2000) */ streamHeight = $("#stream").height(); } return item; } else { console.log("Skipping Repeated Title: " + j.title); return null; } } else { console.log("Missing Title"); return null; } } function getresult(start, size) { console.log("Stream getresult"); var streamURL = streamBaseURL + "?start=" + start + "&size=" + size; if (IsTicker) { console.log("Stream for Ticker"); start = start + 3; site = 10; streamURL = streamBaseURL + "?start=" + start + "&size=" + size; if (TECountry) streamURL += "&c=" + TECountry; if (TECategory) streamURL += "&i=" + TECategory; } else if (location.pathname.indexOf('/news') !== -1 && location.pathname.split('/').length == 3) { console.log("Stream for News"); var sCountry = location.pathname.split('/')[1]; if (sCountry) { sCountry = sCountry.replace('-', ' '); streamURL += "&c=" + sCountry; }; } else if (location.pathname.indexOf('/stream') !== -1) { var sCategory = getParameterByName('i'); if (sCategory) streamURL += "&i=" + sCategory; var sCountry = getParameterByName('c'); if (sCountry) streamURL += "&c=" + sCountry; } else { return; } console.log(streamURL); $.ajax({ url: streamURL, type: "GET", dataType: "json", beforeSend: function () { $('#spinner').show(); streamIsLoading = true; }, complete: function () { $('#spinner').hide(); streamIsLoading = false; }, success: function (data) { appendResult(data); if (start == 0) { $('#stream-btn').css("visibility", "visible"); if (sCategory || sCountry) { var sFilter = sCategory || sCountry; if (sFilter == "economy") $('#streamTabEconomy').tab('show'); else if (sFilter == "markets") $('#streamTabMarkets').tab('show'); else { //var sFilterDiv = '<a class="btn btn-outline-secondary" href="/stream">' + sFilter + ' <i class="glyphicon glyphicon-filter"></i></a><br/><br/>';$("#stream").prepend(sFilterDiv); //OLD - $('#streamTabs').append('<li id="streamTabFilter" class="active" style="text-transform:capitalize;"><a>' + sFilter + '</a></li> '); $('#pagemenutabs li a').removeClass("active") $('#pagemenutabs').append('<li id="streamTabFilter" class="nav-item" style="text-transform:capitalize;"><a class="nav-link active">' + sFilter + '</a></li> '); } } } }, error: function () { console.error("Stream Error") } }); } function appendResult(data) { console.log("Stream Appending Results"); //console.log(data); var now = (new Date).getTime(); var item = ''; var items = []; $.each(data, function (i, j) { //console.log(j); console.log(location.href.indexOf('?')) if (location.href.indexOf('/stream') > -1 && location.href.indexOf('?') === -1 && j.category === 'stocks') { console.log(j) return } var diff = ''; var diffMs = now - new Date(j.date).getTime(); // Miliseconds var offset = new Date().getTimezoneOffset() * 60 * 1000; diffMs = diffMs + offset; if (diffMs < 0) { diff = 'few seconds ago'; } else if (diffMs < 120000) { var diffS = Math.round(diffMs / 1000); // Seconds diff = diffS + ' seconds ago'; } else if (diffMs < 7200000) { var diffMins = Math.round(diffMs / 60000); // minutes diff = diffMins + ' minutes ago'; } else if (diffMs < 172800000) { var diffHrs = Math.round(diffMs / 3600000); // hours diff = diffHrs + ' hours ago'; } else { var diffDays = Math.round(diffMs / 86400000); // days if (diffDays < 30) diff = diffDays + ' days ago'; else diff = j.date; } //console.log(j.date, j.title, j.url, j.importance); j.diff = diff; if (streamStart == 0) { //if (j.url) j.image = 'https://d3fy651gv2fhd3.cloudfront.net/charts/stream.png?h=200&w=300&lbl=0&url=' + j.url; var itemLatest = getItem(j, true); } else { j.append = true; item = getItem(j, false) if (item) items.push(item); } streamStart += 1; }); $("<ul/>", { "class": "list-group", html: items.join("") }).appendTo("#stream"); streamHeight = $("#stream").height(); } if (!IsTicker) { $(window).scroll(function () { if (streamHeight < 100000) { if ($(window).scrollTop() >= streamHeight * 0.80) { if (!streamIsLoading) { getresult(streamStart, streamSize); } else { console.log("Stream Loading is Busy. Hold on ...") } } } }); getresult(streamStart, streamSize); } $('#stream-btn').click(function () { console.log("Load more Streams After Click"); getresult(streamStart, streamSize); }); </script> <script type="text/javascript" src="//d3fy651gv2fhd3.cloudfront.net/js/search.min.js?v=20240502" async></script> <script> TENotificationsHistorical = [] TENotificationsNews = [] //console.log('• Notifications Script Loaded - 20240701') setTimeout(() => { getNotificationsFromCookie() loadBellStatus() },1000) function loadBellStatus() { //console.log("• get bell status from cookie") var seenData = false const cookieData = document.cookie.split(';').find(item => item.trim().startsWith('TENewNotifications')); if (cookieData) { seenData = cookieData.split('TENewNotifications=')[1].split(',')[0] } if (seenData == 'true') { //console.log("new notification") $('#notification-new').show() $('#notification-empty').hide() } else { $('#notification-new').hide() $('#notification-empty').show() } } function setNotificationCookieStatus(status) { document.cookie = `TENewNotifications=${status.toString()}; expires=${createExpirationDate('eod')}; path=/`; } function changeIconStatus(isHover) { try { //console.log("change bell") if (TENotificationsHistorical.length > 0 && !isHover) { $('#notification-new').show() $('#notification-empty').hide() setNotificationCookieStatus(true) } else if (TENotificationsNews.length > 0 && !isHover) { $('#notification-new').show() $('#notification-empty').hide() setNotificationCookieStatus(true) } else { $('#notification-new').hide() $('#notification-empty').show() setNotificationCookieStatus(false) } } catch (e) { console.error(e) } } function timeAgo(datetime) { try { const now = new Date(); const diff = now - new Date(datetime); let seconds = Math.floor(diff / 1000); const minuteInSecs = 60; const hourInSecs = minuteInSecs * 60; let timeAgoString; if (seconds < minuteInSecs) { if (seconds == 0) { seconds = 1 } const plural = seconds == 1 ? '' : 's'; timeAgoString = `${seconds} second${plural} ago`; } else if (seconds < hourInSecs) { const minutes = Math.floor(seconds / minuteInSecs); timeAgoString = `${minutes} minutes ago`; } else { const hours = Math.floor(seconds / hourInSecs); const plural = hours > 1 ? 's' : ''; timeAgoString = `${hours} hour${plural} ago`; } return timeAgoString; } catch (e) { console.error(e) } } function createExpirationDate(span) { const expires = new Date(); if (span == '1d') { expires.setDate(expires.getDate() + 1) return expires.toUTCString() } else if (span == '1h') { expires.setHours(expires.getHours() + 1); return expires.toUTCString(); } else if (span == 'eod') { //end of day const expiresTime = new Date(expires.getTime()); expiresTime.setHours(23, 59, 59); return expiresTime.toUTCString(); } } function removeNotificationIndex(i) { try { if (TENotificationsHistorical.length == 0 && TENotificationsNews.length > 0) { TENotificationsNews.splice(i, 1); document.cookie = `TELastNews=${JSON.stringify(TENotificationsNews)}; path=/`; } if (TENotificationsHistorical.length > 0) { TENotificationsHistorical.splice(i, 1); } $('.notification-list').empty(); addNotificationCookie() if (TENotificationsNews.length == 0 || (TENotificationsNews.length == 0 && TENotificationsHistorical.length == 0)) { addEmptyContent() } if (TENotificationsHistorical.length > 0 || TENotificationsNews.length > 0) { upsertNotification(null, true, false) } } catch (e) { console.error(e) } } function addEmptyContent() { try { //console.log("Add Empty Content") const notificationList = $('.notification-list'); notificationList.empty(); //notificationList.append('<div style="display:flex;justify-content:space-between;align-itens:center"><span style="margin-left:18px"><b>Notifications</b></span></div>') let html = `<div class="empty-notificationlist"> <div class="empty-notificationlist-content"> <span>You have no new notifications</span> <br> <i class="bi bi-bell-slash-fill"></i> <br> <div><a href="/stream" title="Show all news" class="empty-notificationlist-more"><div class="btn btn-outline-secondary">All News</div></a></div> </div> </div>`; notificationList.append(html); } catch (e) { console.error(e) } } function addContent() { try { //console.log("AddContent") const notifiList = TENotificationsHistorical.length > 0 ? TENotificationsHistorical : TENotificationsNews; const notificationList = $('.notification-list'); notificationList.empty(); if (notifiList.length > 0) { notificationList.append('<div class="notificationList-first-title"><span style="margin-left:18px"><b>Notifications</b></span><span class="notifications-clean-all" title="Delete all notifications">Clear all</span></div>') for (let i = notifiList.length - 1; i >= 0; i--) { const notification = notifiList[i]; let html = `<div> <div class="card notificationlist-card" style="margin:0;"> <div class="card-body notificationlist-body"> <div class="notificationlist-header"> <div class="notificationlist-header-title"><a href="${notification.url}"><b>${notification.title}</b></a><span class="badge badge-notification-type" style="background-color:${notification.color}">${notification.type}</span></div> <span id="n-${i}" title="Delete" style="cursor:pointer"><i id="cleanIndividualNotif" class="bi bi-trash3"></i></span> </div> <span style="font-size:15px">${notification.text}</span> <div class="notificationlist-footer"> <p>${timeAgo(notification.datetime)}</p> </div> </div> </div> </div>`; notificationList.append(html); $(`#n-${i}`).on('click', function () { removeNotificationIndex(i) }) } notificationList.append('<div class="notificationlist-more-div"><a href="/stream" title="Show more streams" class="notificationlist-more"><div class="btn btn-outline-secondary">More News</div></a></div>') $('.notifications-clean-all').on('click', function () { //console.log("Clicked") notificationList.empty(); if (TENotificationsHistorical.length > 0) { document.cookie = "TENotifications=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"; TENotificationsHistorical = [] } else if (TENotificationsNews.length > 0) { document.cookie = `TELastNews=[]; path=/`; TENotificationsNews = [] } upsertNotification(null, true, false) }); } } catch (e) { console.error(e) } } function fetchLastNews() { try { //console.log("• Fetch News") TENotificationsNews = [] const newsUrl = '/ws/stream.ashx?start=0&size=3' fetch(newsUrl) .then(response => { if (!response.ok) { console.error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { for (let item of data) { if (item.description.length > 300) { item.description = item.description.substring(0, 300) + ' ...'; let lastPeriodIndex = Math.min(item.description.lastIndexOf('. '), 300); if (lastPeriodIndex !== -1) { item.description = item.description.substring(0, lastPeriodIndex + 1) + '..'; } else { item.description = item.description.substring(0, 300) + '...'; } } TENotificationsNews.unshift({ title: item.title, url: item.url, text: item.description, importance: item.importance, datetime: item.date, type: 'News', color: '#ddd' }) } document.cookie = `TELastNews=${JSON.stringify(TENotificationsNews)}; path=/`; // console.log("• Saved News on Cookies TELastNews") upsertNotification(null, true, false) }) .catch(error => { console.error('Error fetching last news:', error); }); } catch (e) { console.error(e) } } function getNotificationsFromCookie() { try { //console.log("• get Notifications From Cookie") const cookieData = document.cookie.split(';').find(item => item.trim().startsWith('TENotifications')); if (cookieData) { let encodedData = cookieData.split('TENotifications=')[1].split(',') //const decrompressedData = pako.inflate(encodedData, { to: 'string' }); try { TENotificationsHistorical = JSON.parse(encodedData); //console.log(TENotificationsHistorical) if (TENotificationsHistorical.length > 0) { upsertNotification(null, true, false) } } catch (error) { console.error("Error parsing existing cookie data:", error); } } } catch (e) { console.error(e) } } function estimateNotificationSize() { return JSON.stringify(TENotificationsHistorical).length; } function getCookieSize() { try { let safeLoop = 0 const cookies = document.cookie.split(';'); let total = 0 for (const cookie of cookies) { if (safeLoop == 50) { return 0; } const [key, value] = cookie.trim().split('='); if (key !== 'TENotifications') { total = total + JSON.stringify(cookie).length + 2 } safeLoop++ } return total; } catch (e) { console.error(e); } } function manageCookieSize(maxSize) { try { //console.log("• Check threshold of cookies size"); const currentCookieSize = getCookieSize(); const currentNotificationsSize = estimateNotificationSize(); let totalBytes = currentCookieSize + currentNotificationsSize; let nLoopCount = 0; //console.log("• Current Cookies Estimated Size: " + currentCookieSize); //console.log("• With Notifications Cookie Estimated Size: " + currentNotificationsSize); if (totalBytes > maxSize) { while (nLoopCount < 10 && totalBytes > maxSize) { //console.log("---------------------> nLoopCount: " + nLoopCount); TENotificationsHistorical.shift(); totalBytes = currentCookieSize + estimateNotificationSize(); //console.log(`• Notification removed to control cookie size. New size: ${totalBytes} bytes`); if (totalBytes <= maxSize) { //console.log(`• Cookie size is already within limit: ${totalBytes} bytes`); break; } nLoopCount++; } }// else { //console.log(`• Cookie size is within limit: ${totalBytes} bytes`); //} } catch (e) { console.error(e); } } function addNotificationCookie() { try { //console.log("• Add Notifications on Cookie"); const isEmptyNews = TENotificationsNews.length === 0; const isEmptyHistorical = TENotificationsHistorical.length === 0; document.cookie = `TELastNews=${isEmptyNews ? '[]' : JSON.stringify(TENotificationsNews)}; path=/`; manageCookieSize(3400); if (isEmptyHistorical) { document.cookie = `TENotifications=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/`; } else { document.cookie = `TENotifications=${JSON.stringify(TENotificationsHistorical)}; expires=${createExpirationDate('1d')}; path=/`; } } catch (e) { console.error(e); } } function createDefaultNotification(n) { return { ...n, datetime: new Date(), type: n.importance > 0 ? 'Calendar' : 'News', color: n.importance > 0 ? '#ffb3ba' : '#ddd', }; } function upsertNotification(n, cookie, fromStream) { try { //console.log("-----------------------------------------------> Start of upsert Notification on list flow"); //console.log(`• Dealing with ${JSON.stringify(n)}`); if (!cookie) { const newNotification = createDefaultNotification(n); const existingNotification = TENotificationsHistorical.find(item => item.text === newNotification.text); if (existingNotification) { TENotificationsHistorical.splice(TENotificationsHistorical.indexOf(existingNotification), 1); } TENotificationsHistorical.push(newNotification); } const notificationListContainer = $('.offcanvas-top.notification-list.container'); const notificationList = $('.notification-list'); if (!notificationList.length) { notificationListContainer.append(`<div class="offcanvas-header"></div>`); } if (TENotificationsHistorical.length > 0 || TENotificationsNews.length > 0) { if (fromStream == true) { changeIconStatus(false); setNotificationCookieStatus(true); } if (!cookie) { addNotificationCookie(); } addContent(); } else { addEmptyContent(); } } catch (e) { console.error(e); } } $('.btn-notification-list').on('click', function (event) { //console.log('click') event.preventDefault() let cookieNewsIsPresent = false //console.log("• Check if there is LastNews Cookie") const cookieData = document.cookie.split(';').find(item => item.trim().startsWith('TELastNews')); if (cookieData) { let cookieNews = cookieData.split('TELastNews=')[1].split(',') cookieNewsIsPresent = true TENotificationsNews = JSON.parse(cookieNews) } //console.log(cookieNewsIsPresent) if (TENotificationsHistorical.length == 0 && TENotificationsNews.length == 0 && !cookieNewsIsPresent) { //console.log("IF") $('.offcanvas-top').removeClass("show") $('.offcanvas-top').removeClass("showing") fetchLastNews() } else { if (TENotificationsNews.length > 0 || TENotificationsHistorical.length > 0) { upsertNotification(null, true, false) } else { addEmptyContent() } } changeIconStatus(true) }); </script> <script async src="https://www.googletagmanager.com/gtag/js?id=G-SZ14JCTXWQ"></script> <script> window.dataLayer = window.dataLayer || []; function ga() { dataLayer.push(arguments); } ga('js', new Date()); ga('config', 'G-SZ14JCTXWQ', { 'allow_google_signals': false }); </script> </body> </html>