Package org.knowm.xchange.bitmex
Interface BitmexAuthenticated
- All Superinterfaces:
Bitmex
-
Method Summary
Modifier and TypeMethodDescriptioncancelAllAfter
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, long timeout) Useful as a dead-man's switch to ensure your orders are canceled in case of an outage.cancelAllOrders
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String symbol, String filter, String text) cancelOrder
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String orderID, String clOrdID) Either an orderID or a clOrdID must be provided.getAccount
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest) getDepositAddress
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String currency) getExecutions
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String symbol, String filter, String columns, Integer count, Long start, Boolean reverse, Date startTime, Date endTime) Get all raw executions for your account.getMarginAccountsStatus
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest) getMarginAccountStatus
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String currency) getOrders
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String symbol, String filter, String columns, Integer count, Long start, Boolean reverse, Date startTime, Date endTime) getPositions
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest) getPositions
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String filter) getTradeHistory
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String symbol, String filter, String columns, Integer count, Long start, Boolean reverse, Date startTime, Date endTime) Get all balance-affecting executions.getWallet
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest) getWalletHistory
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String currency, Integer count, Long start) Get a history of all of your wallet transactions (deposits, withdrawals, PNL)getWalletSummary
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String currency) Get a summary of all of your wallet transactions (deposits, withdrawals, PNL)placeOrder
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String symbol, String side, BigDecimal orderQuantity, BigDecimal simpleOrderQuantity, BigDecimal displayQuantity, BigDecimal price, BigDecimal stopPrice, String orderType, String clOrdID, String executionInstructions, String clOrdLinkID, String contingencyType, BigDecimal pegOffsetValue, String pegPriceType, String timeInForce, String text) placeOrderBulk
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String orderCommands) replaceOrder
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String orderId, String origClOrdID, String clOrdID, BigDecimal simpleOrderQty, BigDecimal orderQuantity, BigDecimal simpleLeavesQty, BigDecimal leavesQty, BigDecimal price, BigDecimal stopPrice, BigDecimal pegOffsetValue, String text) replaceOrderBulk
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String orderCommands) updateLeveragePosition
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String symbol, BigDecimal leverage) withdrawFunds
(String apiKey, si.mazi.rescu.SynchronizedValueFactory<Long> nonce, si.mazi.rescu.ParamsDigest paramsDigest, String currency, BigDecimal amount, String address) Methods inherited from interface org.knowm.xchange.bitmex.Bitmex
getActiveTickers, getBucketedTrades, getDepth, getFundingHistory, getPromptsAndSymbols, getTicker, getTickers, getTrades
-
Method Details
-
getExecutions
@GET @Path("execution") HttpResponseAwareList<BitmexPrivateExecution> getExecutions(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @QueryParam("symbol") String symbol, @Nullable @QueryParam("filter") String filter, @Nullable @QueryParam("columns") String columns, @Nullable @QueryParam("count") Integer count, @Nullable @QueryParam("start") Long start, @Nullable @QueryParam("reverse") Boolean reverse, @Nullable @QueryParam("startTime") Date startTime, @Nullable @QueryParam("endTime") Date endTime) throws IOException, BitmexException Get all raw executions for your account. This returns all raw transactions, which includes order opening and cancelation, and order status changes. It can be quite noisy. More focused information is available at /execution/tradeHistory.- Throws:
IOException
BitmexException
-
getTradeHistory
@GET @Path("execution/tradeHistory") HttpResponseAwareList<BitmexPrivateExecution> getTradeHistory(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @QueryParam("symbol") String symbol, @Nullable @QueryParam("filter") String filter, @Nullable @QueryParam("columns") String columns, @Nullable @QueryParam("count") Integer count, @Nullable @QueryParam("start") Long start, @Nullable @QueryParam("reverse") Boolean reverse, @Nullable @QueryParam("startTime") Date startTime, @Nullable @QueryParam("endTime") Date endTime) throws IOException, BitmexException Get all balance-affecting executions. This includes each trade, insurance charge, and settlement.- Throws:
IOException
BitmexException
-
getOrders
@GET @Path("order") BitmexPrivateOrderList getOrders(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @QueryParam("symbol") String symbol, @Nullable @QueryParam("filter") String filter, @Nullable @QueryParam("columns") String columns, @Nullable @QueryParam("count") Integer count, @Nullable @QueryParam("start") Long start, @Nullable @QueryParam("reverse") Boolean reverse, @Nullable @QueryParam("startTime") Date startTime, @Nullable @QueryParam("endTime") Date endTime) throws IOException, BitmexException - Parameters:
apiKey
-nonce
-paramsDigest
-symbol
- Instrument symbol. Send a bare series (e.g. XBU) to get data for the nearest expiring contract in that series. You can also send a timeframe, e.g. XBU:monthly. Timeframes are daily, weekly, monthly, quarterly, and biquarterly.filter
- Generic table filter. Send JSON key/value pairs, such as {"key": "value"}. You can key on individual fields, and do more advanced querying on timestamps. See the Timestamp Docs for more details.columns
- Generic table filter. Send JSON key/value pairs, such as {"key": "value"}. You can key on individual fields, and do more advanced querying on timestamps. See the Timestamp Docs for more details.count
- Number of results to fetch.start
- Starting point for results.reverse
- If true, will sort results newest first.startTime
- Starting date filter for results.endTime
- Ending date filter for results.- Returns:
BitmexPrivateOrderList
containing the requested order(s).- Throws:
IOException
BitmexException
-
placeOrder
@POST @Path("order") BitmexPrivateOrder placeOrder(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @FormParam("symbol") String symbol, @Nullable @FormParam("side") String side, @Nullable @FormParam("orderQty") BigDecimal orderQuantity, @Nullable @FormParam("simpleOrderQty") BigDecimal simpleOrderQuantity, @Nullable @FormParam("displayQty") BigDecimal displayQuantity, @Nullable @FormParam("price") BigDecimal price, @Nullable @FormParam("stopPx") BigDecimal stopPrice, @Nullable @FormParam("ordType") String orderType, @Nullable @FormParam("clOrdID") String clOrdID, @Nullable @FormParam("execInst") String executionInstructions, @Nullable @FormParam("clOrdLinkID") String clOrdLinkID, @Nullable @FormParam("contingencyType") String contingencyType, @Nullable @FormParam("pegOffsetValue") BigDecimal pegOffsetValue, @Nullable @FormParam("pegPriceType") String pegPriceType, @Nullable @FormParam("timeInForce") String timeInForce, @Nullable @FormParam("text") String text) throws IOException, BitmexException - Parameters:
apiKey
-nonce
-paramsDigest
-symbol
- Instrument symbol. e.g.XBTUSD
.side
- Optional Order side. Valid options:Buy
,Sell
. Defaults toBuy
unlessorderQty
orsimpleOrderQty
is negative.orderQuantity
- Optional Order quantity in units of the instrument (i.e. contracts).simpleOrderQuantity
- Optional Order quantity in units of the underlying instrument (i.e. Bitcoin).displayQuantity
- Optional quantity to display in the book. Use0
for a fully hidden order.price
- Optional limit price forLimit
,StopLimit
, andLimitIfTouched
orders.stopPrice
- Optional trigger price forStop
,StopLimit
,MarketIfTouched
, andLimitIfTouched
orders. Use a price below the current price for stop-sell orders and buy-if-touched orders. UseexecInst
ofMarkPrice
orLastPrice
to define the current price used for triggering.orderType
- Optional Order type. Valid options:Market
,Limit
,Stop
,StopLimit
,MarketIfTouched
,LimitIfTouched
,MarketWithLeftOverAsLimit
,Pegged
. Defaults toLimit
whenprice
is specified. Defaults toStop
whenstopPx
is specified. Defaults toStopLimit
whenprice
andstopPx
are specified.clOrdID
- Optional Client Order ID. ThisclOrdID
will come back on the order and any related executions.executionInstructions
- Optional execution instructions. Valid options:ParticipateDoNotInitiate
,AllOrNone
,MarkPrice
,IndexPrice
,LastPrice
,Close
,ReduceOnly
,Fixed
.AllOrNone
instruction requiresdisplayQty
to be0
.MarkPrice
,IndexPrice
orLastPrice
instruction valid forStop
,StopLimit
,MarketIfTouched
, andLimitIfTouched
orders.clOrdLinkID
- Optional Client Order Link ID for contingent orders.contingencyType
- Optional contingency type for use with clOrdLinkID. Valid options:OneCancelsTheOther
,OneTriggersTheOther
,OneUpdatesTheOtherAbsolute
,OneUpdatesTheOtherProportional
.pegOffsetValue
- Optional trailing offset from the current price forStop
,StopLimit
,MarketIfTouched
, andLimitIfTouched
orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price forPegged
orders.pegPriceType
- Optional peg price type. Valid options:LastPeg
,MidPricePeg
,MarketPeg
,PrimaryPeg
,TrailingStopPeg
.timeInForce
- Optional Time in force. Valid options:Day
,GoodTillCancel
,ImmediateOrCancel
,FillOrKill
. Defaults toGoodTillCancel
forLimit
,StopLimit
,LimitIfTouched
, andMarketWithLeftOverAsLimit
orders.text
- Optional order annotation. e.g.Take profit
.- Returns:
BitmexPrivateOrder
contains the result of the call.- Throws:
IOException
BitmexException
-
replaceOrder
@PUT @Path("order") @Consumes("application/x-www-form-urlencoded") BitmexPrivateOrder replaceOrder(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @FormParam("orderID") String orderId, @Nullable @FormParam("origClOrdID") String origClOrdID, @Nullable @FormParam("clOrdID") String clOrdID, @Nullable @FormParam("simpleOrderQty") BigDecimal simpleOrderQty, @Nullable @FormParam("orderQty") BigDecimal orderQuantity, @Nullable @FormParam("simpleLeavesQty") BigDecimal simpleLeavesQty, @Nullable @FormParam("leavesQty") BigDecimal leavesQty, @Nullable @FormParam("price") BigDecimal price, @Nullable @FormParam("stopPx") BigDecimal stopPrice, @Nullable @FormParam("pegOffsetValue") BigDecimal pegOffsetValue, @Nullable @FormParam("text") String text) throws IOException, BitmexException - Parameters:
apiKey
-nonce
-paramsDigest
-orderId
- Order IDorigClOrdID
- Client Order ID. Seeinvalid @link
Bitmex#placeOrder
clOrdID
- Optional new Client Order ID, requiresorigClOrdID
.simpleOrderQty
- Optional order quantity in units of the underlying instrument (i.e. Bitcoin).orderQuantity
- Optional order quantity in units of the instrument (i.e. contracts).simpleLeavesQty
- Optional leaves quantity in units of the underlying instrument (i.e. Bitcoin). Useful for amending partially filled orders.leavesQty
- Optional leaves quantity in units of the instrument (i.e. contracts). Useful for amending partially filled orders.price
- Optional limit price forLimit
,StopLimit
, andLimitIfTouched
orders.stopPrice
- Optional trigger price forStop
,StopLimit
,MarketIfTouched
, andLimitIfTouched
orders. Use a price below the current price for stop-sell orders and buy-if-touched orders.pegOffsetValue
- Optional trailing offset from the current price forStop
,StopLimit
,MarketIfTouched
, andLimitIfTouched
orders; use a negative offset for stop-sell orders and buy-if-touched orders. Optional offset from the peg price forPegged
orders.text
- Optional amend annotation. e.g.Adjust skew
.- Returns:
BitmexPrivateOrder
contains the result of the call.- Throws:
IOException
BitmexException
-
placeOrderBulk
@POST @Path("order/bulk") BitmexPrivateOrderList placeOrderBulk(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @FormParam("orders") String orderCommands) throws IOException, BitmexException - Parameters:
apiKey
-nonce
-paramsDigest
-orderCommands
- JSON Array of order(s). UsePlaceOrderCommand
to generate JSON.- Returns:
BitmexPrivateOrderList
contains the results of the call.- Throws:
IOException
BitmexException
-
replaceOrderBulk
@PUT @Path("order/bulk") @Consumes("application/x-www-form-urlencoded") BitmexPrivateOrderList replaceOrderBulk(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @FormParam("orders") String orderCommands) throws IOException, BitmexException - Parameters:
apiKey
-nonce
-paramsDigest
-orderCommands
- JSON Array of order(s). UseReplaceOrderCommand
to generate JSON.- Returns:
BitmexPrivateOrderList
contains the results of the call.- Throws:
IOException
BitmexException
-
cancelOrder
@DELETE @Path("order") BitmexPrivateOrderList cancelOrder(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @FormParam("orderID") String orderID, @Nullable @FormParam("clOrdID") String clOrdID) throws IOException, BitmexException Either an orderID or a clOrdID must be provided.- Parameters:
apiKey
-nonce
-paramsDigest
-orderID
- Order ID(s).clOrdID
- Client Order ID(s). Seeinvalid @link
Bitmex#placeOrder
- Returns:
BitmexPrivateOrderList
contains the results of the call.- Throws:
IOException
BitmexException
-
cancelAllOrders
@DELETE @Path("order/all") BitmexPrivateOrderList cancelAllOrders(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @FormParam("symbol") String symbol, @Nullable @FormParam("filter") String filter, @Nullable @FormParam("text") String text) throws IOException, BitmexException - Parameters:
apiKey
-nonce
-paramsDigest
-symbol
- Optional symbol. If provided, only cancels orders for that symbol.filter
- Optional filter for cancellation. Use to only cancel some orders, e.g. {"side": "Buy"}.text
- Optional cancellation annotation. e.g. 'Spread Exceeded'- Returns:
BitmexPrivateOrderList
contains the results of the call.- Throws:
IOException
BitmexException
-
cancelAllAfter
@POST @Path("order/cancelAllAfter") BitmexCancelAll cancelAllAfter(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @FormParam("timeout") long timeout) throws IOException, BitmexException Useful as a dead-man's switch to ensure your orders are canceled in case of an outage. If called repeatedly, the existing offset will be canceled and a new one will be inserted in its place. Example usage: call this route at 15s intervals with an offset of 60000 (60s). If this route is not called within 60 seconds, all your orders will be automatically canceled.- Parameters:
timeout
- Timeout in ms. Set to 0 to cancel this timer.- Returns:
BitmexPrivateOrderList
contains the results of the call.- Throws:
IOException
BitmexException
-
updateLeveragePosition
@POST @Path("position/leverage") BitmexPosition updateLeveragePosition(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @FormParam("symbol") String symbol, @FormParam("leverage") BigDecimal leverage) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
getPositions
@GET @Path("position") BitmexPositionList getPositions(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
getPositions
@GET @Path("position") BitmexPositionList getPositions(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @QueryParam("filter") String filter) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
getAccount
@GET @Path("user") BitmexAccount getAccount(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
getWallet
@GET @Path("user/wallet") BitmexWallet getWallet(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
getWalletHistory
@GET @Path("user/walletHistory") BitmexWalletTransactionList getWalletHistory(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @QueryParam("currency") String currency, @Nullable @QueryParam("count") Integer count, @Nullable @QueryParam("start") Long start) throws IOException, BitmexException Get a history of all of your wallet transactions (deposits, withdrawals, PNL)- Throws:
IOException
BitmexException
-
getWalletSummary
@GET @Path("user/walletSummary") BitmexWalletTransactionList getWalletSummary(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @QueryParam("currency") String currency) throws IOException, BitmexException Get a summary of all of your wallet transactions (deposits, withdrawals, PNL)- Throws:
IOException
BitmexException
-
getMarginAccountStatus
@GET @Path("user/margin") BitmexMarginAccount getMarginAccountStatus(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @Nullable @QueryParam("currency") String currency) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
getMarginAccountsStatus
@GET @Path("user/margin?currency=all") BitmexMarginAccountList getMarginAccountsStatus(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
getDepositAddress
@GET @Path("user/depositAddress") String getDepositAddress(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @QueryParam("currency") String currency) throws IOException, BitmexException - Throws:
IOException
BitmexException
-
withdrawFunds
@POST @Path("user/requestWithdrawal") BitmexWalletTransaction withdrawFunds(@HeaderParam("api-key") String apiKey, @HeaderParam("api-expires") si.mazi.rescu.SynchronizedValueFactory<Long> nonce, @HeaderParam("api-signature") si.mazi.rescu.ParamsDigest paramsDigest, @FormParam("currency") String currency, @FormParam("amount") BigDecimal amount, @FormParam("address") String address) throws IOException, BitmexException - Throws:
IOException
BitmexException
-