scripts/global.js
/* Test if an input stock symbol is valid and/or assume probable if close */
Test if an input stock symbol is valid and/or assume probable if close
Test if an input stock symbol is valid and / or assume probable if close
testValidSymbol(symbol) {
    return new Promise((resolve, reject) => {
      const url = `${MARKIT_LOOKUP}/jsonp`;
      $({
        url,
        data: { input: symbol },
        dataType: 'jsonp',
        success: function(json) {
          if (!json || json.Message || !json.length > 0) {
            resolve(false);
            console.error(json.Message);
          } else if (json[0].Symbol !== symbol) resolve(false);
          else resolve(true);
        },
        error: function(response, status) {
          reject({ response, status });
        }
      });
    });
  }
testValidSymbol ( symbol ) { return new Promise ( ( resolve , reject ) => { const url = ` ${ MARKIT_LOOKUP } ` ; $ ( { url , data : { input : symbol } , dataType : 'jsonp' , success : function ( json ) { if ( ! json || json . Message || ! json . length > 0 ) { resolve ( false ) ; console . error ( json . Message ) ; } else if ( json [ 0 ] . Symbol !== symbol ) resolve ( false ) ; else resolve ( true ) ; } , error : function ( response , status ) { reject ( { response , status } ) ; } } ) ; } ) ; }
Test if an input stock symbol is valid and/or assume probable if close
Test if an input stock symbol is valid and / or assume probable if close