Package org.knowm.xchange.luno
Interface LunoAuthenticated
- All Superinterfaces:
Luno
-
Method Summary
Modifier and TypeMethodDescriptionbalance
(si.mazi.rescu.ParamsDigest auth) Return the list of all accounts and their respective balances.cancelWithdrawal
(si.mazi.rescu.ParamsDigest auth, String withdrawalId) Cancel a withdrawal request.createAccount
(si.mazi.rescu.ParamsDigest auth, String currency, String name) Create an additional account for the specified currency.createFundingAddress
(si.mazi.rescu.ParamsDigest auth, String asset) Allocates a new receive address to your account.createQuote
(si.mazi.rescu.ParamsDigest auth, OrderType type, BigDecimal baseAmount, String pair) Creates a new quote to buy or sell a particular amount.
You can specify either the exact amount that you want to pay or the exact amount that you want too receive.
For example, to buy exactly 0.1 Bitcoin using ZAR, you would create a quote to BUY 0.1 XBTZAR.discardQuote
(si.mazi.rescu.ParamsDigest auth, String quoteId) Discard a quote.exerciseQuote
(si.mazi.rescu.ParamsDigest auth, String quoteId) Exercise a quote to perform the trade.Returns your fees and 30 day trading volume (as of midnight) for a given pair.getFundingAddress
(si.mazi.rescu.ParamsDigest auth, String asset, String address) Returns the default receive address associated with your account and the amount received via the address.Get an order by its id.Get the latest status of a quote.getWithdrawal
(si.mazi.rescu.ParamsDigest auth, String withdrawalId) Returns the status of a particular withdrawal request.listOrders
(si.mazi.rescu.ParamsDigest auth, State state, String pair) Returns a list of the most recently placed orders.listTrades
(si.mazi.rescu.ParamsDigest auth, String pair, Long since, Integer limit) Returns a list of your recent trades for a given pair, sorted by oldest first.
type in the response indicates the type of order that you placed in order to participate in the trade.
If is_buy in the response is true, then the order which completed the trade (market taker) was a bid order.pendingTransactions
(si.mazi.rescu.ParamsDigest auth, String id) Return a list of all pending transactions related to the account.
Unlike account entries, pending transactions are not numbered, and may be reordered, deleted or updated at any time.postLimitOrder
(si.mazi.rescu.ParamsDigest auth, String pair, OrderType type, BigDecimal volume, BigDecimal price, String baseAccountId, String counterAccountId) Create a new trade order.
Warning! Orders cannot be reversed once they have executed.postMarketOrder
(si.mazi.rescu.ParamsDigest auth, String pair, OrderType type, BigDecimal counterVolume, BigDecimal baseVolume, String baseAccountId, String counterAccountId) Create a new market order.
Warning! Orders cannot be reversed once they have executed.requestWithdrawal
(si.mazi.rescu.ParamsDigest auth, String type, BigDecimal amount, String beneficiaryId) Creates a new withdrawal request.send
(si.mazi.rescu.ParamsDigest auth, BigDecimal amount, String currency, String address, String description, String message) Send Bitcoin from your account to a Bitcoin address or email address.
If the email address is not associated with an existing Luno account, an invitation to create an account and claim the funds will be sent.
Warning! Bitcoin transactions are irreversible.Request to stop an order.transactions
(si.mazi.rescu.ParamsDigest auth, String id, int minRow, int maxRow) Return a list of transaction entries from an account.
Transaction entry rows are numbered sequentially starting from 1, where 1 is the oldest entry.withdrawals
(si.mazi.rescu.ParamsDigest auth) Returns a list of withdrawal requests.
-
Method Details
-
createAccount
@POST @Path("accounts") LunoAccount createAccount(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @QueryParam("currency") String currency, @QueryParam("name") String name) throws IOException, LunoException Create an additional account for the specified currency. You must be verified to trade currency in order to be able to create an account. A user has a limit of 4 accounts per currency.- Parameters:
auth
-currency
- required - The currency code for the account you want to create e.g. XBT, IDR, MYR, ZARname
- required - The label to use for this account e.g. "Trading ACC".- Returns:
- Throws:
IOException
LunoException
-
balance
@GET @Path("balance") LunoBalance balance(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth) throws IOException, LunoException Return the list of all accounts and their respective balances.- Parameters:
auth
-- Returns:
- Throws:
IOException
LunoException
-
transactions
@GET @Path("accounts/{id}/transactions") LunoAccountTransactions transactions(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String id, @QueryParam("min_row") int minRow, @QueryParam("max_row") int maxRow) throws IOException, LunoException Return a list of transaction entries from an account.
Transaction entry rows are numbered sequentially starting from 1, where 1 is the oldest entry. The range of rows to return are specified with the min_row (inclusive) and max_row (exclusive) parameters. At most 1000 rows can be requested per call.
If min_row or max_row is non-positive, the range wraps around the most recent row. For example, to fetch the 100 most recent rows, use min_row=-100 and max_row=0.- Parameters:
auth
-id
- required - Account IDminRow
- required - Minimum of the row range to return (inclusive)maxRow
- required - Maximum of the row range to return (exclusive)- Returns:
- Throws:
IOException
LunoException
-
pendingTransactions
@GET @Path("accounts/{id}/pending") LunoPendingTransactions pendingTransactions(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String id) throws IOException, LunoException Return a list of all pending transactions related to the account.
Unlike account entries, pending transactions are not numbered, and may be reordered, deleted or updated at any time.- Parameters:
auth
-id
-- Returns:
- Throws:
IOException
LunoException
-
listOrders
@GET @Path("listorders") LunoOrders listOrders(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @QueryParam("state") State state, @QueryParam("pair") String pair) throws IOException, LunoException Returns a list of the most recently placed orders. You can specify an optional state=PENDING parameter to restrict the results to only open orders. You can also specify the market by using the optional pair parameter. The list is truncated after 100 items.- Parameters:
auth
-state
- optional - Filter to only orders of this state e.g. PENDINGpair
- optional - Filter to only orders of this currency pair e.g. XBTZAR- Returns:
- Throws:
IOException
LunoException
-
postLimitOrder
@POST @Path("postorder") LunoPostOrder postLimitOrder(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @FormParam("pair") String pair, @FormParam("type") OrderType type, @FormParam("volume") BigDecimal volume, @FormParam("price") BigDecimal price, @FormParam("base_account_id") String baseAccountId, @FormParam("counter_account_id") String counterAccountId) throws IOException, LunoException Create a new trade order.
Warning! Orders cannot be reversed once they have executed. Please ensure your program has been thoroughly tested before submitting orders.
If no base_account_id or counter_account_id are specified, your default base currency or counter currency account will be used. You can find your account IDs by calling the Balances API https://www.luno.com/en/api#accounts-balances.- Parameters:
auth
-pair
- required - The currency pair to trade e.g. XBTZARtype
- required - "BID" for a bid (buy) limit order or "ASK" for an ask (sell) limit order.volume
- required - Amount of Bitcoin to buy or sell as a decimal string in units of BTC e.g. "1.423".price
- required - Limit price as a decimal string in units of ZAR/BTC e.g. "1200".baseAccountId
- optional - The base currency account to use in the trade.counterAccountId
- optional - The counter currency account to use in the trade.- Returns:
- Throws:
IOException
LunoException
-
postMarketOrder
@POST @Path("marketorder") LunoPostOrder postMarketOrder(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @FormParam("pair") String pair, @FormParam("type") OrderType type, @FormParam("counter_volume") BigDecimal counterVolume, @FormParam("base_volume") BigDecimal baseVolume, @FormParam("base_account_id") String baseAccountId, @FormParam("counter_account_id") String counterAccountId) throws IOException, LunoException Create a new market order.
Warning! Orders cannot be reversed once they have executed. Please ensure your program has been thoroughly tested before submitting orders.
If no base_account_id or counter_account_id are specified, your default base currency or counter currency account will be used. You can find your account IDs by calling the Balances API https://www.luno.com/en/api#accounts-balances.
A market order executes immediately, and either buys as much bitcoin that can be bought for a set amount of fiat currency, or sells a set amount of bitcoin for as much fiat as possible.- Parameters:
auth
-pair
- required - The currency pair to trade e.g. XBTZARtype
- required - "BUY" to buy bitcoin, or "SELL" to sell bitcoin.counterVolume
- required, if type is "BUY" - For a "BUY" order: amount of local currency (e.g. ZAR, MYR) to spend as a decimal string in units of the local currency e.g. "100.50".baseVolume
- required, if type is "SELL" - For a "SELL" order: amount of Bitcoin to sell as a decimal string in units of BTC e.g. "1.423".baseAccountId
- optional - The base currency account to use in the trade.counterAccountId
- optional - The counter currency account to use in the trade.- Returns:
- Throws:
IOException
LunoException
-
stopOrder
@POST @Path("stoporder") LunoBoolean stopOrder(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @FormParam("order_id") String orderId) throws IOException, LunoException Request to stop an order.- Parameters:
auth
-orderId
- required - The order reference as a string e.g. BXMC2CJ7HNB88U4- Returns:
- Throws:
IOException
LunoException
-
getOrder
@GET @Path("orders/{id}") LunoOrders.Order getOrder(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String orderId) throws IOException, LunoException Get an order by its id.- Parameters:
auth
-orderId
- required - The order ID- Returns:
- Throws:
IOException
LunoException
-
listTrades
@GET @Path("listtrades") LunoUserTrades listTrades(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @QueryParam("pair") String pair, @QueryParam("since") Long since, @QueryParam("limit") Integer limit) throws IOException, LunoException Returns a list of your recent trades for a given pair, sorted by oldest first.
type in the response indicates the type of order that you placed in order to participate in the trade.
If is_buy in the response is true, then the order which completed the trade (market taker) was a bid order.- Parameters:
auth
-pair
- required - Filter to trades of this currency pair e.g. XBTZARsince
- optional - Filter to trades on or after this timestamp, e.g. 1470810728478limit
- optional - Limit to this number of trades (min 1, max 100, default 100)- Returns:
- Throws:
IOException
LunoException
-
feeInfo
@GET @Path("fee_info") LunoFeeInfo feeInfo(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @QueryParam("pair") String pair) throws IOException, LunoException Returns your fees and 30 day trading volume (as of midnight) for a given pair.- Parameters:
auth
-pair
- required - Filter to trades of this currency pair e.g. XBTZAR- Returns:
- Throws:
IOException
LunoException
-
getFundingAddress
@GET @Path("funding_address") LunoFundingAddress getFundingAddress(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @QueryParam("asset") String asset, @QueryParam("address") String address) throws IOException, LunoException Returns the default receive address associated with your account and the amount received via the address. You can specify an optional address parameter to return information for a non-default receive address. In the response, total_received is the total confirmed Bitcoin amount received excluding unconfirmed transactions. total_unconfirmed is the total sum of unconfirmed receive transactions.- Parameters:
auth
-asset
- required - Currency code of the asset e.g. XBTaddress
- optional - Specific Bitcoin address to retrieve. If not provided, the default address will be used.- Returns:
- Throws:
IOException
LunoException
-
createFundingAddress
@POST @Path("funding_address") LunoFundingAddress createFundingAddress(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @FormParam("asset") String asset) throws IOException, LunoException Allocates a new receive address to your account. There is a rate limit of 1 address per hour, but bursts of up to 10 addresses are allowed.- Parameters:
auth
-- Returns:
- Throws:
IOException
LunoException
-
withdrawals
@GET @Path("withdrawals") LunoWithdrawals withdrawals(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth) throws IOException, LunoException Returns a list of withdrawal requests.- Parameters:
auth
-- Returns:
- Throws:
IOException
LunoException
-
requestWithdrawal
@POST @Path("withdrawals") LunoWithdrawals.Withdrawal requestWithdrawal(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @FormParam("type") String type, @FormParam("amount") BigDecimal amount, @FormParam("beneficiary_id") String beneficiaryId) throws IOException, LunoException Creates a new withdrawal request.- Parameters:
auth
-type
- required - Withdrawal types e.g. ZAR_EFT, NAD_EFT, KES_MPESA, MYR_IBG, IDR_LLGamount
- required - Amount to withdraw. The currency depends on the type.beneficiaryId
- optional - The beneficiary ID of the bank account the withdrawal will be paid out to. This parameter is required if you have multiple bank accounts. Your bank account beneficiary ID can be found by clicking on the beneficiary name on the Beneficiaries page [https://www.luno.com/wallet/beneficiaries].- Returns:
- Throws:
IOException
LunoException
-
getWithdrawal
@GET @Path("withdrawals/{id}") LunoWithdrawals.Withdrawal getWithdrawal(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String withdrawalId) throws IOException, LunoException Returns the status of a particular withdrawal request.- Parameters:
auth
-withdrawalId
- required - Withdrawal ID to retrieve.- Returns:
- Throws:
IOException
LunoException
-
cancelWithdrawal
@DELETE @Path("withdrawals/{id}") LunoWithdrawals.Withdrawal cancelWithdrawal(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String withdrawalId) throws IOException, LunoException Cancel a withdrawal request. This can only be done if the request is still in state PENDING.- Parameters:
auth
-withdrawalId
- required - ID of the withdrawal to cancel.- Returns:
- Throws:
IOException
LunoException
-
send
@POST @Path("send") LunoBoolean send(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @FormParam("amount") BigDecimal amount, @FormParam("currency") String currency, @FormParam("address") String address, @FormParam("description") String description, @FormParam("message") String message) throws IOException, LunoException Send Bitcoin from your account to a Bitcoin address or email address.
If the email address is not associated with an existing Luno account, an invitation to create an account and claim the funds will be sent.
Warning! Bitcoin transactions are irreversible. Please ensure your program has been thoroughly tested before using this call.- Parameters:
auth
-amount
- required - Amount to send as a decimal string.currency
- required - Currency to send e.g. XBTaddress
- required - Destination Bitcoin address or email address to send to.description
- optional - Description for the transaction to record on the account statement.message
- optional - Message to send to the recipient. This is only relevant when sending to an email address.- Returns:
- Throws:
IOException
LunoException
-
createQuote
@POST @Path("quotes") LunoQuote createQuote(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @FormParam("type") OrderType type, @FormParam("base_amount") BigDecimal baseAmount, @FormParam("pair") String pair) throws IOException, LunoException Creates a new quote to buy or sell a particular amount.
You can specify either the exact amount that you want to pay or the exact amount that you want too receive.
For example, to buy exactly 0.1 Bitcoin using ZAR, you would create a quote to BUY 0.1 XBTZAR. The returned quote includes the appropriate ZAR amount. To buy Bitcoin using exactly ZAR 100, you would create a quote to SELL 100 ZARXBT. The returned quote specifies the Bitcoin as the counter amount that will be returned.
An error is returned if your account is not verified for the currency pair, or if your account would have insufficient balance to ever exercise the quote.- Parameters:
auth
-type
- required - Possible types: BUY, SELLbaseAmount
- required - Amount to buy or sell in the pair base currency.pair
- required - Currency pair to trade e.g. XBTZAR, XBTMYR. The pair can also be flipped if you want to buy or sell the counter currency (e.g. ZARXBT).- Returns:
- Throws:
IOException
LunoException
-
getQuote
@GET @Path("quotes/{id}") LunoQuote getQuote(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String quoteId) throws IOException, LunoException Get the latest status of a quote.- Parameters:
auth
-quoteId
- required - ID of the quote to retrieve.- Returns:
- Throws:
IOException
LunoException
-
exerciseQuote
@PUT @Path("quotes/{id}") LunoQuote exerciseQuote(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String quoteId) throws IOException, LunoException Exercise a quote to perform the trade. If there is sufficient balance available in your account, it will be debited and the counter amount credited.
An error is returned if the quote has expired or if you have insufficient available balance.- Parameters:
auth
-quoteId
- required - ID of the quote to exercise.- Returns:
- Throws:
IOException
LunoException
-
discardQuote
@DELETE @Path("quotes/{id}") LunoQuote discardQuote(@HeaderParam("Authorization") si.mazi.rescu.ParamsDigest auth, @PathParam("id") String quoteId) throws IOException, LunoException Discard a quote. Once a quote has been discarded, it cannot be exercised even if it has not expired yet.- Parameters:
auth
-quoteId
- required - ID of the quote to discard.- Returns:
- Throws:
IOException
LunoException
-