获取KLine
        :param symbol
        :param period: 可选值：{1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year }
        :param size: 可选值： [1,2000]
        :return:
162739
def get_kline(self, symbol, period, size=150, _async=False):
        
        params = {'symbol': symbol, 'period': period, 'size': size}

        url = u.MARKET_URL + '/market/history/kline'
        return http_get_request(url, params, _async=_async)
729937
def get_anniversary_periods(start, finish, anniversary=1):
    
    import sys
    current = start
    periods = []
    while current <= finish:
        (period_start, period_finish) = date_period(DATE_FREQUENCY_MONTHLY, anniversary, current)
        current = period_start + relativedelta(months=+1)
        period_start = period_start if period_start > start else start
        period_finish = period_finish if period_finish < finish else finish
        periods.append((period_start, period_finish))
    return periods
236681
def hr(color):
    
    logger = log(color)
    return lambda symbol: logger(symbol * terminal_size.usable_width)
459090
def get_time_period(period_name):
    
    time_abbreviation = time_map.get(period_name.lower())

    if time_abbreviation is None:
        raise Exception("Symbol %s not recognised as a time period"%period_name)

    return time_abbreviation
1317023
def get_quotation_kline(self, symbol, period, limit=None, _async=False):
        
        params = {}
        path = '/quotation/market/history/kline'
        params['symbol'] = symbol
        params['period'] = period
        if limit:
            params['limit'] = limit

        return api_key_get(params, path, _async=_async)
227700
def get_ticker(self, symbol, size=1, _async=False):
        
        params = {'symbol': symbol, 'size': size}

        url = u.MARKET_URL + '/market/history/trade'
        return http_get_request(url, params, _async=_async)
707152
def usage(self, startTime, endTime, vars=None, period=None,
              groupby=None, name=None, stype=None, etype=None,
              appId=None, deviceId=None, username=None, appOrgId=None,
              userOrgId=None, hostOrgId=None):
        

        url = self.root + "/usage"
        startTime = str(int(local_time_to_online(dt=startTime)))
        endTime = str(int(local_time_to_online(dt=endTime)))

        params = {
                    'f' : 'json',
                    'startTime' : startTime,
                    'endTime' : endTime,
                    'vars' : vars,
                    'period' : period,
                    'groupby' : groupby,
                    'name' : name,
                    'stype' : stype,
                    'etype' : etype,
                    'appId' : appId,
                    'deviceId' : deviceId,
                    'username' : username,
                    'appOrgId' : appOrgId,
                    'userOrgId' : userOrgId,
                    'hostOrgId' : hostOrgId,
                 }

        params = {key:item for key,item in params.items() if item is not None}
        return self._post(url=url,
                             param_dict=params,
                             securityHandler=self._securityHandler,
                             proxy_url=self._proxy_url,
                             proxy_port=self._proxy_port)
865012
function(line) {
  const length = getLength(line);
  let output;
  if (length > 100) {
    output = (Math.round(length / 1000 * 100) / 100) +
        ' ' + 'km';
  } else {
    output = (Math.round(length * 100) / 100) +
        ' ' + 'm';
  }
  return output;
}
1206009
def k(self, symbol='', begin=None, end=None):
        '''
        
        '''
        with self.client.connect(*self.bestip):
            data = self.client.get_k_data(symbol, begin, end)
            return data
695790
def periodic(period=60.0, file=sys.stderr):
    
    import threading
    import time
    S = _StatsThread(period=period, file=file)
    T = threading.Thread(target=S)
    T.daemon = True
    T.start()
1233178
def period(self, value: float):
        
        if value < 0:
            raise ValueError("Period must be greater or equal than zero.")
        self._period = timedelta(seconds=value)
718916
private static List parse(String pattern, TimeZone timeZone, Locale locale,
                              DateFormatSymbols symbols) {
        List rules = new ArrayList();

        String[] ERAs = symbols.getEras();
        String[] months = symbols.getMonths();
        String[] shortMonths = symbols.getShortMonths();
        String[] weekdays = symbols.getWeekdays();
        String[] shortWeekdays = symbols.getShortWeekdays();
        String[] AmPmStrings = symbols.getAmPmStrings();

        int length = pattern.length();
        int[] indexRef = new int[1];

        for (int i=0; i<length; i++) {
            indexRef[0] = i;
            String token = parseToken(pattern, indexRef);
            i = indexRef[0];

            int tokenLen = token.length();
            if (tokenLen == 0) {
                break;
            }

            Rule rule;
            char c = token.charAt(0);

            switch (c) {
            case 'G': // era designator (text)
                rule = new TextField(Calendar.ERA, ERAs);
                break;
            case 'y': // year (number)
                if (tokenLen >= 4) {
                    rule = new UnpaddedNumberField(Calendar.YEAR);
                }
                else {
                    rule = new TwoDigitYearField();
                }
                break;
            case 'M': // month in year (text and number)
                if (tokenLen >= 4) {
                    rule = new TextField(Calendar.MONTH, months);
                }
                else if (tokenLen == 3) {
                    rule = new TextField(Calendar.MONTH, shortMonths);
                }
                else if (tokenLen == 2) {
                    rule = new TwoDigitMonthField();
                }
                else {
                    rule = new UnpaddedMonthField();
                }
                break;
            case 'd': // day in month (number)
                rule = selectNumberRule(Calendar.DAY_OF_MONTH, tokenLen);
                break;
            case 'h': // hour in am/pm (number, 1..12)
                rule = new TwelveHourField
                    (selectNumberRule(Calendar.HOUR, tokenLen));
                break;
            case 'H': // hour in day (number, 0..23)
                rule = selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen);
                break;
            case 'm': // minute in hour (number)
                rule = selectNumberRule(Calendar.MINUTE, tokenLen);
                break;
            case 's': // second in minute (number)
                rule = selectNumberRule(Calendar.SECOND, tokenLen);
                break;
            case 'S': // millisecond (number)
                rule = selectNumberRule(Calendar.MILLISECOND, tokenLen);
                break;
            case 'E': // day in week (text)
                rule = new TextField
                    (Calendar.DAY_OF_WEEK,
                     tokenLen < 4 ? shortWeekdays : weekdays);
                break;
            case 'D': // day in year (number)
                rule = selectNumberRule(Calendar.DAY_OF_YEAR, tokenLen);
                break;
            case 'F': // day of week in month (number)
                rule = selectNumberRule
                    (Calendar.DAY_OF_WEEK_IN_MONTH, tokenLen);
                break;
            case 'w': // week in year (number)
                rule = selectNumberRule(Calendar.WEEK_OF_YEAR, tokenLen);
                break;
            case 'W': // week in month (number)
                rule = selectNumberRule(Calendar.WEEK_OF_MONTH, tokenLen);
                break;
            case 'a': // am/pm marker (text)
                rule = new TextField(Calendar.AM_PM, AmPmStrings);
                break;
            case 'k': // hour in day (1..24)
                rule = new TwentyFourHourField
                    (selectNumberRule(Calendar.HOUR_OF_DAY, tokenLen));
                break;
            case 'K': // hour in am/pm (0..11)
                rule = selectNumberRule(Calendar.HOUR, tokenLen);
                break;
            case 'z': // time zone (text)
                if (tokenLen >= 4) {
                    rule = new TimeZoneRule(timeZone, locale, TimeZone.LONG);
                }
                else {
                    rule = new TimeZoneRule(timeZone, locale, TimeZone.SHORT);
                }
                break;
            case '\'': // literal text
                String sub = token.substring(1);
                if (sub.length() == 1) {
                    rule = new CharacterLiteral(sub.charAt(0));
                }
                else {
                    rule = new StringLiteral(new String(sub));
                }
                break;
            default:
                throw new IllegalArgumentException
                    ("Illegal pattern component: " + token);
            }

            rules.add(rule);
        }

        return rules;
    }
1066286
def _period_array_cmp(cls, op):
    
    opname = '__{name}__'.format(name=op.__name__)
    nat_result = opname == '__ne__'

    def wrapper(self, other):
        op = getattr(self.asi8, opname)

        if isinstance(other, (ABCDataFrame, ABCSeries, ABCIndexClass)):
            return NotImplemented

        if is_list_like(other) and len(other) != len(self):
            raise ValueError("Lengths must match")

        if isinstance(other, Period):
            self._check_compatible_with(other)

            result = op(other.ordinal)
        elif isinstance(other, cls):
            self._check_compatible_with(other)

            result = op(other.asi8)

            mask = self._isnan | other._isnan
            if mask.any():
                result[mask] = nat_result

            return result
        elif other is NaT:
            result = np.empty(len(self.asi8), dtype=bool)
            result.fill(nat_result)
        else:
            other = Period(other, freq=self.freq)
            result = op(other.ordinal)

        if self._hasnans:
            result[self._isnan] = nat_result

        return result

    return compat.set_function_name(wrapper, opname, cls)
1173651
function (position) {
      if (position >= this.periodHeight) {
        position = 0;
      }

      if (position < 0) {
        position = 0;
      }

      var hour = Math.floor(position / this.periodInterval);
      var mn = (position / this.periodInterval - hour) * 60;

      if (this.settings.hour === 12) {
        var time = hour;
        var ind = '';

        if (hour >= 12) {
          ind = 'p';
        }
        if (hour > 12) {
          time = hour - 12;
        }
        if (hour === 0 || hour === 24) {
          ind = '';
          time = 12;
        }
        if (mn !== 0) {
          time += ':' + mn;
        }

        return time + ind;
      }

      if (hour < 10) {
        hour = '0' + hour;
      }
      if (mn < 10) {
        mn = '0' + mn;
      }

      return hour + ':' + mn;
    }
1359844
def get_period_last_30_days() -> str:
    
    today = Datum()
    today.today()
    # start_date = today - timedelta(days=30)
    start_date = today.clone()
    start_date.subtract_days(30)

    period = get_period(start_date.value, today.value)
    return period
671936
def parse_subpattern(pattern)
      return ISO8601::Duration.new(pattern) if pattern.start_with?('P')

      ISO8601::DateTime.new(pattern)
    end
880522
def get_reference_line_numeration_marker_patterns(prefix=u''):
    
    title = u""
    if type(prefix) in (str, unicode):
        title = prefix
    g_name = u'(?P<mark>'
    g_close = u')'
    space = ur'\s*'
    patterns = [
        # [1]
        space + title + g_name + ur'\[\s*(?P<marknum>\d+)\s*\]' + g_close,
        # [<letters and numbers]
        space + title + g_name +
        ur'\[\s*[a-zA-Z:-]+\+?\s?(\d{1,4}[A-Za-z:-]?)?\s*\]' + g_close,
        # {1}
        space + title + g_name + ur'\{\s*(?P<marknum>\d+)\s*\}' + g_close,
        # (1)
        space + title + g_name + ur'\<\s*(?P<marknum>\d+)\s*\>' + g_close,
        space + title + g_name + ur'\(\s*(?P<marknum>\d+)\s*\)' + g_close,
        space + title + g_name + ur'(?P<marknum>\d+)\s*\.(?!\d)' + g_close,
        space + title + g_name + ur'(?P<marknum>\d+)\s+' + g_close,
        space + title + g_name + ur'(?P<marknum>\d+)\s*\]' + g_close,
        # 1]
        space + title + g_name + ur'(?P<marknum>\d+)\s*\}' + g_close,
        # 1}
        space + title + g_name + ur'(?P<marknum>\d+)\s*\)' + g_close,
        # 1)
        space + title + g_name + ur'(?P<marknum>\d+)\s*\>' + g_close,
        # [1.1]
        space + title + g_name + ur'\[\s*\d+\.\d+\s*\]' + g_close,
        # [    ]
        space + title + g_name + ur'\[\s*\]' + g_close,
        # *
        space + title + g_name + ur'\*' + g_close,
    ]
    return [re.compile(p, re.I | re.UNICODE) for p in patterns]