コード例 #1
0
    def test_for_indicator(self, symbol):

        geode_client = GeodeClient()

        latest_days = geode_client.query_stock_days_latest(symbol, 30)

        print IndicatorUtils.MA(latest_days, 5, 0)
コード例 #2
0
    def test_for_week_ma_match(self, symbol):

        geode_client = GeodeClient()

        hist_symbols_days = {}
        hist_symbols_weeks = {}

        latest_days = geode_client.query_stock_days_latest(symbol, 300)
        latest_weeks = geode_client.query_stock_weeks_latest(symbol, 300)

        #       stock_today = SinaStockUtils.get_sina_stock_day(symbol)[0]

        stock_today = latest_days[0]
        print 'stub_stock_day = ' + stock_today.id

        #       print json.encode(stock_today)

        hist_symbols_days[symbol] = latest_days
        hist_symbols_weeks[symbol] = latest_weeks
        #       print json.encode(latest_weeks[0:50])

        model_test = ModelBase(hist_symbols_days, hist_symbols_weeks,
                               stock_today.day)

        print model_test.match(stock_today)
コード例 #3
0
    def test_for_symbol_incubator(self, symbol):

        geode_client = GeodeClient()

        hist_symbols_days = {}

        latest_days = geode_client.query_stock_days_latest(symbol, 30)

        stock_today = SinaStockUtils.get_sina_stock_day(symbol)[0]

        hist_symbols_days[symbol] = latest_days

        model_test = StockIncubator(hist_symbols_days)
コード例 #4
0
    def test_for_symbol_today_match(self, symbol):

        geode_client = GeodeClient()

        hist_symbols_days = {}

        latest_days = geode_client.query_stock_days_latest(symbol, 300)

        #       stock_today = SinaStockUtils.get_sina_stock_day(symbol)[0]

        stock_today = latest_days[0]

        #       print json.encode(stock_today)

        hist_symbols_days[symbol] = latest_days

        model_test = ModelCover(hist_symbols_days, stock_today.day)

        print model_test.match(stock_today)
コード例 #5
0
 def __init__(self):
     self.stock_list_url = 'http://vip.stock.finance.sina.com.cn/quotes_service/api/json_v2.php/Market_Center.getHQNodeData?page={0}&num={1}&sort=changepercent&asc=0&node={2}&symbol=&_s_r_a=page'
     self.size = 80
     self.geode_client = GeodeClient()
コード例 #6
0
 def __init__(self):
     self.geode_client = GeodeClient()
     self.redis_client = RedisClient()
     self.symbols = self.geode_client.query_all_stock_symbols()
     self.test_days = 1