Create a gist now

Instantly share code, notes, and snippets.

Embed
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