bt_buy: Place a Buy Limit Order

View source: R/private-interface.r

bt_buyR Documentation

Place a Buy Limit Order

Description

The bt_buy() function places a buy order on https://bittrex.com. This function only works after you have set up authentication.

Usage

bt_buy(market, quantity, rate, type = c("limit", "market"))

Arguments

market

the market to place the buy limit order on.

quantity

how much of the quote currency you want to buy.

rate

the price per unit of the quote currency that you wish to buy at.

type

either "market" or "limit". Note that market orders are disabled as of July 7, 2017. (default is "limit")

Value

A named list with the following elements:

  • success: a boolean indicating whether the request is successful.

  • message: a string describing the error if the request was not successful, otherwise an empty string.

  • result: a named list, with element "uuid" whose element is an integer identifying the order. This value is used to query the status of of the order with either the bt_getorder() or bt_getopenorders() function. When the order is fulfilled it appears in the order history data.frame returned by the bt_getorderhistory() function.

References

https://bittrex.com/api/v1.1/market/buylimit

See Also

bt_authenticate(), bt_sell(), bt_getorder(), bt_getopenorders(), bt_getorderhistory()

Examples

## Not run: 
# Note you must authenticate first.
# Buy half a bitcoin at 17000 USDT per bitcoin.
bt_buy("usdt-btc", 0.5, 17000)
# $success
# [1] TRUE
#
# $message
# [1] ""
#
# $result
# $result$uuid
# [1] "2d6169e9-17fb-4f2a-8aff-37418b515624"

# Buy 3.4 ETH at 0.063 BTC per ETH
bt_buy("btc-eth", 3.4, 0.063)

# Buy 2 LTC at 255 USDT per LTC
bt_buy("usdt-ltc", 2, 255)

## End(Not run)

kaneplusplus/bittrex documentation built on July 6, 2022, 10:02 p.m.