当前位置: 软件>java软件
XChange
本文导语: XChange 是一个提供简单和一致的 API 用于和多样化的金融安全交换数据,包括对 Bitcoin 的支持。 示例代码: package com.xeiam.xchange.examples.mtgox.v1.polling; import com.xeiam.xchange.Exchange; import com.xeiam.xchange.ExchangeFactory; import com.xeiam.xch...
XChange 是一个提供简单和一致的 API 用于和多样化的金融安全交换数据,包括对 Bitcoin 的支持。
示例代码:
package com.xeiam.xchange.examples.mtgox.v1.polling;
import com.xeiam.xchange.Exchange;
import com.xeiam.xchange.ExchangeFactory;
import com.xeiam.xchange.ExchangeSpecification;
import com.xeiam.xchange.dto.trade.AccountInfo;
import com.xeiam.xchange.service.trade.polling.PollingTradeService;
/**
* Demo requesting account info at MtGox
*/
public class AccountInfoDemo {
private static PollingTradeService tradeService;
public static void main(String[] args) {
// Use the factory to get the version 1 MtGox exchange API using default settings
ExchangeSpecification exchangeSpecification = new ExchangeSpecification("com.xeiam.xchange.mtgox.v1.MtGoxExchange");
exchangeSpecification.setApiKey("150c6db9-e5ab-47ac-83d6-4440d1b9ce49");
exchangeSpecification.setSecretKey("olHM/yl3CAuKMXFS2+xlP/MC0Hs1M9snHpaHwg0UZW52Ni0Tf4FhGFELO9cHcDNGKvFrj8CgyQUA4VsMTZ6dXg==");
exchangeSpecification.setUri("https://mtgox.com");
exchangeSpecification.setVersion("1");
Exchange mtgox = ExchangeFactory.INSTANCE.createExchange(exchangeSpecification);
// Interested in the private trading functionality (authentication)
tradeService = mtgox.getPollingTradeService();
// Get the account information
AccountInfo accountInfo = tradeService.getAccountInfo();
System.out.println("AccountInfo as String: " + accountInfo.toString());
}
}
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。