title: Querying Securities Exchange Comission (SEC) using EDGAR
body: <p>I'm working on a project that allows the user to pull out information from both SEC and on the company's traded Stock using the company's stock-ticker.</p>
  
  <p>Now, in order for me to be able to retrieve information from the SEC using the stock ticker ONLY, I must first query the gem <code>stock_quotes</code> for the company's Name to then retrieve the company's <strong>CIK-code.</strong> However, EDGAR is a well and true disaster when it comes to querying businesses based on their name, it does a much better job of querying based on CIK only, but currently, there's no other way to get the CIK from the Ticker only as in the query sequence of <code>TICKER =&gt; CIK</code> only the sequence <code>TICKER =&gt; COMPANY_NAME =&gt; CIK</code> works.</p>
  
  <p>Now, since Edgar is old, and does not understand well, this means that for some companies, finding the CIK code using the format "COMPANY, INC" works perfectly. For some companies, that doesn't work, and I must remove the "INC" for Edgar to understand. And some companies have special characters in their names that Edgar doesn't know what to do with, so he throws errors left and right.</p>
  
  <p>Now, here's an example:</p>
  
  <pre><code>@sec = SecQuery::Entity.find("#{@stock.name}".gsub("INC", "").gsub("COM", "").gsub("USD0.0001", "").gsub("USD0.001", 
      "").gsub("USD0.01", "").gsub("USD0.1", "").gsub("USD1.0", ""))
  </code></pre>
  
  <p>Now, I have reached a point to where I've realized that some companies actually do not have "inc" included in their written company name. This means I must add "INC" to that company name for edgar to understand which company I'm looking for.</p>
  
  <p>But I'm unable to ADD things to the <code>@stock.name</code> - Could someone help me figure out how?</p>
  
  <p>Ive tried different variations of</p>
  
  <pre><code> @sec = SecQuery::Entity.find("#{@stock.name}".insert(-1, "INC")
  
   @sec = SecQuery::Entity.find("#{@stock.name}".concat(" INC")
  
   @sec = SecQuery::Entity.find("#{@stock.name}".gsub(/$/, ' INC')
  </code></pre>
  
  <p>Any help would be extremely useful.</p>