ExBitstamp v0.1.1 ExBitstamp View Source
Wraps Bitstamp HTTP API into functions respective of public and private API endpoints.
The currency_pair
parameter in functions is expected to be an ExBitstamp.CurrencyPair
struct. See module
documentation for more info on all available convenience functions, but in short, supported currency pairs can
be obtained by calling appropriately named functions:
alias ExBitstamp.CurrencyPair
ExBitstamp.ticker(CurrencyPair.btcusd())
API call functions return successful results as a {:ok, results}
tuple or {:error, {error_type, reason}
tuple in case of an error. See respective functions’ docs for examples of specific return values.
ExBitstamp
module uses v2 Bitstamp API endpoints whenever possible.
Module functions which take an optional creds
parameter hit Bitstamp’s private API which requires valid
API credentials for signature generation. By default, if no credentials are provided as an argument ExBitstamp
will try to fetch credentials from config. Config should be defined as:
config :ex_bitstamp,
creds: %{
customer_id: "customer_id",
key: "key",
secret: "key"
}
Otherwise, if credentials are provided as an argument, ExBitstamp.Credentials
struct should be used to
pass the credentials to functions.
Link to this section Summary
Functions
Fetches account balance data for a currency pair
Fetches account balance data for all currencies
Retrieves bank withdrawal status
Places a limit buy order for a currency pair
Places a buy market order for a currency pair
Cancels all orders
Cancels bank withdrawal status
Cancels an order
Retrieves bitcoin cash deposit address
Retrieves bitcoin deposit address
Retrieves ethereum deposit address
Retrieves litecoin deposit address
Retrieves ripple deposit address using v1 API
Retrieves xrp deposit address
Fetches EUR/USD conversion rate
Retireves transactions for liquidation address
Creates new liquidation address
Executes a bank withdrawal
Fetches open orders data for a currency pair
Fetches open orders data for all currencies
Fetches order book data for a currency pair
Fetches order status
Places a limit sell order for a currency pair
Places a sell market order for a currency pair
Fetches ticker data for a currency pair
Fetches hourly ticker data for a currency pair
Fetches trading pairs info
Fetches transactions data for a currency pair
Executes a transfer of funds from main account to sub account
Executes a transfer of funds from sub account to main account
Retrieves unconfirmed BTC data
Fetches user transaction data for a currency pair
Fetches user transaction data for all currencies
Executes bitcoin cash withdrawal
Executes bitcoin withdrawal
Executes ethereum withdrawal
Executes litecoin withdrawal
Fetches all withdrawal requests
Executes ripple withdrawal using v1 API
Executes ripple withdrawal
Link to this section Functions
balance(ExBitstamp.CurrencyPair.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches account balance data for a currency pair.
Example successful response:
{:ok,
%{
"btc_available" => "0.00000000",
"btc_balance" => "0.00000000",
"btc_reserved" => "0.00000000",
"fee" => 0.25,
"usd_available" => "0.00",
"usd_balance" => "0.00",
"usd_reserved" => "0.00"
}}
balance_all(ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches account balance data for all currencies.
Example successful response:
{:ok,
%{
"xrp_reserved" => "0.00000000",
"bcheur_fee" => "0.12",
"ltc_balance" => "0.00000000",
"ltcbtc_fee" => "0.25",
"btc_balance" => "0.00000000",
"ltc_reserved" => "0.00000000",
"eth_balance" => "0.39706665",
"eur_available" => "0.00",
"xrpbtc_fee" => "0.25",
"bchusd_fee" => "0.12",
"bch_available" => "0.00000000",
"eurusd_fee" => "0.25",
"ethusd_fee" => "0.25",
"btc_available" => "0.00000000",
"xrpeur_fee" => "0.25",
"eur_balance" => "0.00",
"btceur_fee" => "0.25",
"usd_balance" => "0.00",
"bch_balance" => "0.00000000",
"xrpusd_fee" => "0.25",
"ltcusd_fee" => "0.25",
"eth_available" => "0.00000000",
"bch_reserved" => "0.00000000",
"ltceur_fee" => "0.25",
"etheur_fee" => "0.25",
"eur_reserved" => "0.00",
"ethbtc_fee" => "0.25",
"xrp_balance" => "0.00000000",
"ltc_available" => "0.00000000",
"bchbtc_fee" => "0.12",
"eth_reserved" => "0.00000000",
"btcusd_fee" => "0.25",
"usd_available" => "0.00",
"xrp_available" => "0.00000000",
"usd_reserved" => "0.00",
"btc_reserved" => "0.00000000"
}}
bank_withdrawal_status(String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves bank withdrawal status.
buy( ExBitstamp.CurrencyPair.t(), float(), float(), list() | nil, ExBitstamp.Credentials.t() | nil ) :: tuple()
Places a limit buy order for a currency pair.
Accepts list of optional parameters as a keyword list. Allowed keys are: limit_price
or daily_order
.
Only one of these can be present. See Bitstamp API docs
for more info.
buy_market( ExBitstamp.CurrencyPair.t(), float(), ExBitstamp.Credentials.t() | nil ) :: tuple()
Places a buy market order for a currency pair.
cancel_all_orders(ExBitstamp.Credentials.t() | nil) :: tuple()
Cancels all orders.
Example successful response:
{:ok, true}
cancel_bank_withdrawal(String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Cancels bank withdrawal status.
cancel_order(String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Cancels an order.
Example successful response:
{:ok, %{"amount" => 0.1, "id" => 951827494, "price" => 750.0, "type" => 1}}
deposit_address_bch(ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves bitcoin cash deposit address.
deposit_address_btc(ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves bitcoin deposit address.
deposit_address_eth(ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves ethereum deposit address.
deposit_address_ltc(ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves litecoin deposit address.
deposit_address_ripple(ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves ripple deposit address using v1 API.
deposit_address_xrp(ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves xrp deposit address.
Fetches EUR/USD conversion rate.
Example successful response:
{:ok, %{"buy" => "1.235", "sell" => "1.235"}}
liquidation_address_info(String.t() | nil, ExBitstamp.Credentials.t() | nil) :: tuple()
Retireves transactions for liquidation address.
new_liquidation_address(String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Creates new liquidation address.
open_bank_withdrawal( ExBitstamp.BankWithdrawal.t(), ExBitstamp.Credentials.t() | nil ) :: tuple()
Executes a bank withdrawal.
open_orders(ExBitstamp.CurrencyPair.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches open orders data for a currency pair.
Example successful response:
{:ok,
[
%{
"amount" => "0.10000000",
"datetime" => "2018-02-13 16:24:00",
"id" => "951827494",
"price" => "750.00",
"type" => "1"
}
]}
open_orders_all(ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches open orders data for all currencies.
Example successful response:
{:ok,
[
%{
"amount" => "0.10000000",
"currency_pair" => "ETH/EUR",
"datetime" => "2018-02-13 16:24:00",
"id" => "951827494",
"price" => "750.00",
"type" => "1"
}
]}
order_book(ExBitstamp.CurrencyPair.t()) :: tuple()
Fetches order book data for a currency pair.
Example successful response:
{:ok,
%{
"asks" => [
["7021.91", "1.11552422"],
["7021.92", "0.00216174"],
["7022.70", ...],
[...],
...
],
"bids" => [
["6867.88", "20.63509100"],
["6865.74", "2.94040800"],
["6861.31", ...],
[...],
...
],
"timestamp" => "1517927756"
}}
order_status(String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches order status.
Example successful response:
{:ok, %{"status" => "Open", "transactions" => []}}
sell( ExBitstamp.CurrencyPair.t(), float(), float(), list() | nil, ExBitstamp.Credentials.t() | nil ) :: tuple()
Places a limit sell order for a currency pair.
Accepts list of optional parameters as a keyword list. Allowed keys are: limit_price
or daily_order
.
Only one of these can be present. See Bitstamp API docs
for more info.
sell_market( ExBitstamp.CurrencyPair.t(), float(), ExBitstamp.Credentials.t() | nil ) :: tuple()
Places a sell market order for a currency pair.
ticker(ExBitstamp.CurrencyPair.t()) :: tuple()
Fetches ticker data for a currency pair.
Example successful response:
{:ok,
%{
"ask" => "7117.11",
"bid" => "7100.00",
"high" => "7499.00",
"last" => "7100.00",
"low" => "5920.72",
"open" => "6878.65",
"timestamp" => "1517927052",
"volume" => "71876.22396439",
"vwap" => "6707.61"
}}
ticker_hour(ExBitstamp.CurrencyPair.t()) :: tuple()
Fetches hourly ticker data for a currency pair.
Example successful response:
{:ok,
%{
"ask" => "6905.42",
"bid" => "6900.51",
"high" => "7281.80",
"last" => "6900.60",
"low" => "6784.18",
"open" => "7165.04",
"timestamp" => "1517927653",
"volume" => "4102.91186873",
"vwap" => "7076.36"
}}
Fetches trading pairs info.
Example successful response:
{:ok,
[
%{
"base_decimals" => 8,
"counter_decimals" => 2,
"description" => "Litecoin / U.S. dollar",
"minimum_order" => "5.0 USD",
"name" => "LTC/USD",
"trading" => "Enabled",
"url_symbol" => "ltcusd"
},
%{
"base_decimals" => 8,
"counter_decimals" => 2,
"description" => "Ether / U.S. dollar",
"minimum_order" => "5.0 USD",
"name" => "ETH/USD",
"trading" => "Enabled",
"url_symbol" => "ethusd"
},
...
]}
transactions(ExBitstamp.CurrencyPair.t(), list()) :: tuple()
Fetches transactions data for a currency pair.
Accepts list of optional parameters as a keyword list. Allowed key is time
with on of the following values:
"minute"
, "hour"
(default) or "day"
. See Bitstamp API docs
for more info.
Example successful response:
{:ok,
[
%{
"amount" => "0.51879098",
"date" => "1517928659",
"price" => "7011.46",
"tid" => "52902107",
...
},
%{
"amount" => "0.23897801",
"date" => "1517928659",
"price" => "7011.45",
...
},
%{"amount" => "0.01480362", "date" => "1517928659", ...},
%{"amount" => "0.04021837", ...},
%{...},
...
]}
Executes a transfer of funds from main account to sub account.
transfer_to_main(float(), String.t(), any(), ExBitstamp.Credentials.t() | nil) :: tuple()
Executes a transfer of funds from sub account to main account.
unconfirmed_btc(ExBitstamp.Credentials.t() | nil) :: tuple()
Retrieves unconfirmed BTC data.
user_transactions(ExBitstamp.CurrencyPair.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches user transaction data for a currency pair.
Example successful response:
{:ok,
[
%{
"btc" => 0.0,
"datetime" => "2018-02-02 13:08:20",
"eth" => "0.41245141",
"eth_eur" => 725.54,
"eur" => "-299.25",
"fee" => "0.75",
"id" => 51366122,
"order_id" => 880205621,
"type" => "2",
"usd" => 0.0
},
%{
"btc" => 0.0,
"btc_usd" => "0.00",
"datetime" => "2018-02-02 13:00:29",
"eur" => "300.00",
"fee" => "0.00",
"id" => 51351200,
"type" => "0",
"usd" => 0.0
},
....
]}
user_transactions_all(ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches user transaction data for all currencies.
Example successful response:
{:ok,
[
%{
"btc" => 0.0,
"datetime" => "2018-02-02 13:08:20",
"eth" => "0.41245141",
"eth_eur" => 725.54,
"eur" => "-299.25",
"fee" => "0.75",
"id" => 51366122,
"order_id" => 880205621,
"type" => "2",
"usd" => 0.0
},
%{
"btc" => 0.0,
"btc_usd" => "0.00",
"datetime" => "2018-02-02 13:00:29",
"eur" => "300.00",
"fee" => "0.00",
"id" => 51351200,
"type" => "0",
"usd" => 0.0
},
....
]}
withdrawal_bch(float(), String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Executes bitcoin cash withdrawal.
withdrawal_btc(float(), String.t(), boolean(), ExBitstamp.Credentials.t() | nil) :: tuple()
Executes bitcoin withdrawal.
withdrawal_eth(float(), String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Executes ethereum withdrawal.
withdrawal_ltc(float(), String.t(), ExBitstamp.Credentials.t() | nil) :: tuple()
Executes litecoin withdrawal.
withdrawal_requests(list(), ExBitstamp.Credentials.t() | nil) :: tuple()
Fetches all withdrawal requests.
withdrawal_ripple( float(), String.t(), String.t(), ExBitstamp.Credentials.t() | nil ) :: tuple()
Executes ripple withdrawal using v1 API.
withdrawal_xrp( float(), String.t(), String.t() | nil, ExBitstamp.Credentials.t() | nil ) :: tuple()
Executes ripple withdrawal.