Your username here MUST MATCH your XenForo username (connected to your XF license).

    Once you have registered here, then you need to 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.

Change Ordering?

Discussion in 'Stock Trader Support' started by anthony parsons, Mar 13, 2013.

  1. anthony parsons

    anthony parsons Member Showcase Sportsbook Pickem

    How do I change the 'top portfolio's' ordering to use the percentage, instead of the dollar growth?
  2. Bob

    Bob Developer Staff Member

    try this and see if it does what you are wanting it to do..

    find the getTopPortfolios method in the /library/NFLJ/StockTrader/Model/Stock.php (roughly around line 273) and change the ORDER BY to use gain_percent vs gain_amount (as shown below)

        public function getTopPortfolios($numResults=NULL)
    $limit '';
            if (
    $limit 'LIMIT ' $numResults;
                SELECT portfolio.*,
                    user.username, user.avatar_date, user.avatar_width, user.avatar_height, user.gravatar
                FROM xf_nflj_stocktrader_portfolio as portfolio
                    LEFT JOIN xf_user AS user
                        ON (user.user_id = portfolio.user_id)
                WHERE portfolio.total_invested > 0                                 
                ORDER BY portfolio.gain_percent desc
    $limit '             
    SneakyDave likes this.
  3. SneakyDave

    SneakyDave Member Sportsbook

    Does a cron update the top portfolios, or is that done in real time?

    Never mind, it appears to happen via the "Stock Trader: Rebuild Users Portfolio Values" cron entry, once an hour.
  4. Bob

    Bob Developer Staff Member

    There are actually two processes.. one is hourly CRON, then other is when ever you do a transaction (buy/sell) it will also rebuild YOUR portfolio.
  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.