1. REGISTRATION REQUIREMENTS:

    Register with your xenforo.com Username then start a conversation at xenforo.com w/Bob and provide the following:
    1. Your XenForo License Validation Token
    2. The Domain Name associated with the License
    NOTE: Your account will be validated once ALL requirements are verified/met. Thank you for your patience.

Fixed Top Stocks have limits

Discussion in 'Stock Trader Resolved Bug Reports' started by Edrondol, Dec 12, 2012.

  1. Edrondol

    Edrondol New Member

    stock error 3.png

    As you can see from the thumbnail picture, if you have too many users playing, you can no longer look at top stocks. Yahoo only allows 200.
     
  2. Bob

    Bob Developer Staff Member

    I'll paginate the listing instead of having a cut off.
     
  3. Edrondol

    Edrondol New Member

    I don't think pagination is the issue. We are calling the API for 203 and Yahoo just sends back an error.
     
  4. Bob

    Bob Developer Staff Member

    yes, pagination will only query the amount that the page is set to.. if you set the member stocks to paginate at 100, it will only pull 100 from the feed.
     
  5. Bob

    Bob Developer Staff Member

    If you are saying that one of your members has 203 stocks, that is more than one problem. I will have to build in something preventing members from owning that many different stocks.
     
  6. Edrondol

    Edrondol New Member

    i did not know that. Learn something new, eh?

    Oh, and I'm more than willing to give you access to our PseudoAdmin account. :)
     
  7. Bob

    Bob Developer Staff Member

    ya, when you do pagination, you use a limit query so that it only pulls x results at a time. Makes things more efficient :)

    Glad you brought this up tho as I need to build in hard limits to prevent that error.
     
  8. Bob

    Bob Developer Staff Member

    TEMP FIX ....

    in the file /library/NFLJ/StockTrader/Model/Stock.php

    replace this method

    PHP:
        public function getSymbolsAllUsers()
        {
            return 
    $this->_getDb()->fetchCol('       
                SELECT DISTINCT symbol
                FROM xf_nflj_stocktrader_stock
                WHERE shares_owned > 0
                ORDER BY symbol   
            '
    );
        }

    with this method

    PHP:
        public function getSymbolsAllUsers()
        {
            return 
    $this->_getDb()->fetchCol('       
                SELECT DISTINCT symbol
                FROM xf_nflj_stocktrader_stock
                WHERE shares_owned > 0
                ORDER BY symbol   
                LIMIT 200           
            '
    );
        }
    This will also effect the CRON that rebuild user portfolios as well. This is just a TEMP solution until I come up with a work around for the API limitation.
     
  9. Edrondol

    Edrondol New Member

    It works on the Popular Stocks but the cron is still borked. This time it gave me a Yahoo error.

    stock error 5.png
     
  10. Edrondol

    Edrondol New Member

    If nothing else, we are stress testing the crap out of this!

    And we did find a guy who learned how to game the system.

    [​IMG]
     
    erich37 likes this.
  11. Bob

    Bob Developer Staff Member

    ya, it won't FIX the CRON, it will effect it tho and sometimes will let things through depending on if a person has any stock symbols or not in those limited results.. ir, if they have any in 201-219, it will die at that point as there is no matching result with ends up indefined.

    The temp fix is for the Popular Stocks only and like I said in the other post, just turn cron off for the rebuilding of portfolios.
     
  12. Bob

    Bob Developer Staff Member

    There is a minimum price option, to prevent penny stocks. Set min price to 1 and you won't have to deal with penny stocks. You can make a killin on them if you know what you are doing (which he obviously did).
     
  13. erich37

    erich37 Member

  14. Bob

    Bob Developer Staff Member

    could be.. both get their data from the same 3rd party tho, so dunno.

    I'd actually love to use the Google API, but the LIMIT the number of queries and its a very low number. My first version of stock trader used the GFAPI and I had to drop it because of daily query limits.
     
  15. Bob

    Bob Developer Staff Member

    I rewrote the Member Owned Tab functionality on the Popular Stocks Page so that it is now paginated. You can control the amount of stocks to display per page via the stock trader options. Default is set to 50 per page which is a reasonable amount IMO. Minimum is 1 per page and Max is set at 200 per page.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.