下单交易

@param symbol
@param type
@param price
@param amount (只能是整数)
@return
@throws IOException
176775
public OkCoinTradeResult trade(String symbol, String type, String price, String amount)
      throws IOException {
    OkCoinTradeResult tradeResult =
        okCoin.trade(apikey, symbol, type, price, amount, signatureCreator());
    return returnOrThrow(tradeResult);
  }
1274702
public static TransactionException addingInstancesToAbstractType(Type type) {
        return create(ErrorMessage.IS_ABSTRACT.getMessage(type.label()));
    }
113014
public function trade($market, $amount, $type, $rate=false) {



        $data = [
            'Market' => $market,
            'Type' => $type,
            'Amount' => $amount,
            'Rate' => $rate
        ];

        $b = $this->privateRequest("SubmitTrade", $data, "POST");
    
        return $b;

    }
457011
public synchronized void incrementLoad(ResourceType type) {
    Integer load = typeToTotalLoad.get(type);
    assert(load != null);
    typeToTotalLoad.put(type, load + 1);
  }
179589
public static String print(Type type) {
        return type.match(new Type.MatchBlock<String>(){
            @Override
            public String _case(Ref x) {
                return print(x.type);
            }

            @Override
            public String _case(Primitive x) {
                return print(x.type);
            }
            
        });
    }
176210
int putSymbol(String symbolName)
    {

        if (isReadOnly)
        {
            throw new ReadOnlyValueException(SymbolTable.class);
        }

        if (mySymbolsCount == mySymbolNames.length)
        {
            int newlen = mySymbolsCount * 2;
            if (newlen < DEFAULT_CAPACITY)
            {
                newlen = DEFAULT_CAPACITY;
            }
            String[] temp = new String[newlen];
            System.arraycopy(mySymbolNames, 0, temp, 0, mySymbolsCount);
            mySymbolNames = temp;
        }

        int sid = -1;
        if (symbolName != null)
        {
            sid = mySymbolsCount + myFirstLocalSid;
            assert sid == getMaxId() + 1;

            putToMapIfNotThere(mySymbolsMap, symbolName, sid);
        }
        mySymbolNames[mySymbolsCount] = symbolName;
        mySymbolsCount++;

        return sid;
    }
661609
int addType(final String value) {
    int hashCode = hash(Symbol.TYPE_TAG, value);
    Entry entry = get(hashCode);
    while (entry != null) {
      if (entry.tag == Symbol.TYPE_TAG && entry.hashCode == hashCode && entry.value.equals(value)) {
        return entry.index;
      }
      entry = entry.next;
    }
    return addType(new Entry(typeCount, Symbol.TYPE_TAG, value, hashCode));
  }
1256388
public static void cost(String type, long costInMilli) {
        info(new JSONObject() {{
            put("type", type);
            put("cost", costInMilli);
        }});
    }
810352
function Amount(value, unit) {
  if (!(this instanceof Amount))
    return new Amount(value, unit);

  this.value = 0;
  this.unit = null;

  if (value != null)
    this.fromOptions(value, unit);
}
796367
private function addTransactionElement($amount, $type, $options)
    {

        if ($type == 'PreAuth' || $type == 'Auth') {
            $this->xml .= <<<XML
 <Transaction>
 <Type DataType="String">{$type}</Type>
 <CurrentTotals>
 <Totals>
 <Total DataType="Money" Currency="{$this->currency_lookup(self::$default_currency)}">{$amount}</Total>
 </Totals>
 </CurrentTotals>
 </Transaction>
XML;
        } elseif ($type == 'PostAuth' || $type == 'Void') {
            $this->xml .= <<<XML
 <Transaction>
 <Type DataType="String">{$type}</Type>
 <Id DataType="String">{$options['authorization']}</Id>
 <CurrentTotals>
 <Totals>
 <Total DataType="Money" Currency="{$this->currency_lookup(self::$default_currency)}">{$amount}</Total>
 </Totals>
 </CurrentTotals>
 </Transaction>
XML;
        }
    }
207982
public synchronized void putSymbol( String strName, Class type, Object value )
  {
    if( value != null )
    {
      Class typeValue = value.getClass();
      if( !type.isAssignableFrom( typeValue ) && !typeValue.isAssignableFrom( type ) )
      {
        throw new IllegalArgumentException( type.getName() + " is not compatible with " + typeValue.getName() );
      }
    }

    Symbol root = new Symbol( strName,
                              TypeSystem.get( type ),
                              value );
    getThreadLocalSymbolTable().putSymbol( root );
  }
1226651
public List<OkCoinFutureKline> getFutureKline(
      CurrencyPair currencyPair,
      OkCoinKlineType type,
      FuturesContract contractType,
      Integer size,
      Long since)
      throws IOException {
    List<Object[]> list =
        okCoin.getFutureKline(
            "1",
            OkCoinAdapters.adaptSymbol(currencyPair),
            type.getType(),
            contractType.getName(),
            size,
            since);
    List<OkCoinFutureKline> klineList = new ArrayList<>();
    list.stream().forEach(kline -> klineList.add(new OkCoinFutureKline(kline)));
    return klineList;
  }
786277
@Override
    public void print(MoneyPrintContext context, Appendable appendable, BigMoney money) throws IOException {
        MoneyAmountStyle activeStyle = style.localize(context.getLocale());
        if (money.isNegative()) {
            money = money.negated();
            if (!activeStyle.isAbsValue()) {
                appendable.append(activeStyle.getNegativeSignCharacter());
            }
        }
        String str = money.getAmount().toPlainString();
        char zeroChar = activeStyle.getZeroCharacter();
        if (zeroChar != '0') {
            int diff = zeroChar - '0';
            StringBuilder zeroConvert = new StringBuilder(str);
            for (int i = 0; i < str.length(); i++) {
                char ch = str.charAt(i);
                if (ch >= '0' && ch <= '9') {
                    zeroConvert.setCharAt(i, (char) (ch + diff));
                }
            }
            str = zeroConvert.toString();
        }
        final int decPoint = str.indexOf('.');
        final int afterDecPoint = decPoint + 1;
        if (activeStyle.getGroupingStyle() == GroupingStyle.NONE) {
            if (decPoint < 0) {
                appendable.append(str);
                if (activeStyle.isForcedDecimalPoint()) {
                    appendable.append(activeStyle.getDecimalPointCharacter());
                }
            } else {
                appendable.append(str.subSequence(0, decPoint))
                    .append(activeStyle.getDecimalPointCharacter()).append(str.substring(afterDecPoint));
            }
        } else {
            int groupingSize = activeStyle.getGroupingSize();
            int extendedGroupingSize = activeStyle.getExtendedGroupingSize();
            extendedGroupingSize = extendedGroupingSize == 0 ? groupingSize : extendedGroupingSize;
            char groupingChar = activeStyle.getGroupingCharacter();
            int pre = (decPoint < 0 ? str.length() : decPoint);
            int post = (decPoint < 0 ? 0 : str.length() - decPoint - 1);
            appendable.append(str.charAt(0));
            for (int i = 1; i < pre; i++) {
                if (isPreGroupingPoint(pre - i, groupingSize, extendedGroupingSize)) {
                    appendable.append(groupingChar);
                }
                appendable.append(str.charAt(i));
            }
            if (decPoint >= 0 || activeStyle.isForcedDecimalPoint()) {
                appendable.append(activeStyle.getDecimalPointCharacter());
            }
            if (activeStyle.getGroupingStyle() == GroupingStyle.BEFORE_DECIMAL_POINT) {
                if (decPoint >= 0) {
                    appendable.append(str.substring(afterDecPoint));
                }
            } else {
                for (int i = 0; i < post; i++) {
                    appendable.append(str.charAt(i + afterDecPoint));
                    if (isPostGroupingPoint(i, post, groupingSize, extendedGroupingSize)) {
                        appendable.append(groupingChar);
                    }
                }
            }
        }
    }
1077565
public static <T> TypeToken<T> of(Type type) {
    Assert.notNull(type, "type");
    return new TypeToken<T>(type);
  }
778033
public long value() {
        switch (type) {
        case AVERAGE:
            return numPoints != 0 ? value / numPoints : 0;
        case NONE:
            return 0;
        case MAXIMUM:
        case MINIMUM:
        case SUM:
            return value;
        default:
            throw new IllegalStateException("Unknown type [" + type + "]!");
        }
    }
74060
public void writeMapBegin(String type)
        throws IOException
    {
        os.write('M');
        os.write('t');
        printLenString(type);
    }
440905
public void beginType(String type, String kind, int modifiers,
      String extendsType, String... implementsTypes) throws IOException {
    indent();
    modifiers(modifiers);
    out.write(kind);
    out.write(" ");
    type(type);
    if (extendsType != null) {
      out.write("\n");
      indent();
      out.write("    extends ");
      type(extendsType);
    }
    if (implementsTypes.length > 0) {
      out.write("\n");
      indent();
      out.write("    implements ");
      for (int i = 0; i < implementsTypes.length; i++) {
        if (i != 0) {
          out.write(", ");
        }
        type(implementsTypes[i]);
      }
    }
    out.write(" {\n");
    pushScope(Scope.TYPE_DECLARATION);
  }