Examples of ExchangeInterface


Examples of com.codeguin.jtradr.ExchangeInterface

    float price = 0;
    float amount = 0;

    HashMap authMap = null;

    ExchangeInterface httpI = null;

    if (0 == args.length)
    {
      print_help();
      return;
    }

    for (int i=0; i<args.length; i++)
    {
      switch (args[i])
      {
        case "-c":
          if (i+1 < args.length)
          {
            configFile = args[++i];
          }
          break;
        case "-h":
          print_help();
          return;
        default:
          query = args[i];

          if (query.equals("buy") || query.equals("sell"))
          {
            amount = Float.parseFloat(args[++i]);
            price  = Float.parseFloat(args[++i]);
          }
          else if (query.equals("cancel"))
          {
            oid = args[++i];
          }
      }
    }

    httpI = new MtGoxInterface();

    authMap = (new ConfigParser()).parse_file(configFile);
    httpI.authenticate(authMap);

    if (!query.equals(""))
    {
      switch (query)
      {
        case "account":
          System.out.println(httpI.get_account());
          break;
        case "buy":
          System.out.println(httpI.place_order("bid",price,amount));
          break;
        case "sell":
          System.out.println(httpI.place_order("ask",price,amount));
          break;
        case "cancel":
          System.out.println(httpI.cancel_order(oid));
          break;
        case "depth":
          System.out.println(httpI.get_depth());
          break;
        case "orders":
          System.out.println(httpI.get_orders());
          break;
        case "ticker":
          System.out.println(httpI.get_ticker());
          break;
        default:
          System.out.println("'"+query+"' is not a valid query.");
          break;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.