title: Invoke-RestMethod and foreach loop
body: <p>Via PowerShell I'm trying to get the last ticker data from all currency pairs via the public API of a cryptocurrency exchange.
  For this I first get all markets and then I want to loop through these, but for some reason only the first currency pair is being returned.</p>
  
  <p>Anyone knows what I'm missing?</p>
  
  <pre><code>$bt_baseapi_url = "https://bittrex.com/api/v1.1/"
  $getmarkets = $bt_baseapi_url + "public/getmarkets"
  $getticker = $bt_baseapi_url + "public/getticker"
  
  $markets = Invoke-RestMethod -Uri $getmarkets
  $marketnames = $markets.result
  
  foreach ($marketname in $marketnames.marketname) {
      $tickerurl = $getticker + "?market=" + $marketname
      $ticker = Invoke-RestMethod -Uri $tickerurl
      return $ticker.result.last
  }
  </code></pre>