Skip to content

Instantly share code, notes, and snippets.

@dsaki
Last active August 29, 2015 14:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save dsaki/94ea531ee48f727fc7cd to your computer and use it in GitHub Desktop.
import com.xeiam.xchange.kraken.KrakenExchange
import com.xeiam.xchange.ExchangeFactory
import com.xeiam.xchange.currency.CurrencyPair
import com.xeiam.xchange.dto.Order.OrderType
import com.xeiam.xchange.dto.trade.MarketOrder
val kraken = ExchangeFactory.INSTANCE.createExchange(classOf[KrakenExchange].getName)
kraken.getExchangeSpecification.setApiKey("API-Key")
kraken.getExchangeSpecification.setSecretKey("API-Secret")
kraken.applySpecification(kraken.getExchangeSpecification)
// 残高取得
val accountService = kraken.getPollingAccountService
println(accountService.getAccountInfo)
// AccountInfo [username=null, wallets=[Wallet [currency=EUR, balance=1.9270, description=], Wallet [currency=JPY, balance=0.00, description=], Wallet [currency=BTC, balance=3.6268694200, description=]]]
// トレード(例外が発生)
val tradeService = kraken.getPollingTradeService
val marketOrder = new MarketOrder(
OrderType.ASK,
BigDecimal(0.01).bigDecimal,
CurrencyPair.BTC_EUR
)
tradeService.placeMarketOrder(marketOrder) //Exception
// Execution exception[[ExchangeException: [EGeneral:Permission denied]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment