poloniex_client v0.0.1 PoloniexClient.Trading View Source

Module for Poloniex Private/Trading API Commands/Methods https://poloniex.com/support/api/

Link to this section Summary

Functions

Places a limit buy order in a given market. Required POST parameters are "currencyPair", "rate", and "amount". If successful, the method will return the order number. You may optionally set "fillOrKill", "immediateOrCancel", "postOnly" to 1. A fill-or-kill order will either fill in its entirety or be completely aborted. An immediate-or-cancel order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled rather than left on the order book. A post-only order will only be placed if no portion of it fills immediately; this guarantees you will never pay the taker fee on any part of the order that fills.

Cancels all open orders in a given market or, if no market is provided, all open orders in all markets. Optional parameter is "currencyPair". If successful, the method will return a success of 1 along with a JSON array of orderNumbers representing the orders that were cancelled.

Cancels a loan offer specified by the "orderNumber" parameter.

Cancels an order you have placed in a given market. Required POST parameter is "orderNumber"

Closes your margin position in a given market (currencyPair) using a market order. This call will also return success if you do not have an open position in the specified market.

Creates a loan offer for a given currency. Required parameters: "currency", "amount", "duration" (from 2 to 60, inclusive), "autoRenew" (0 or 1), and "lendingRate".

Generates a new deposit address for the currency specified by the "currency" POST parameter.

Returns information about your margin position in a given market, specified by the "currencyPair" parameter. You may set "currencyPair" to "all" if you wish to fetch all of your margin positions at once.

Places a margin buy order in a given market. Required parameters: "currencyPair", "rate", and "amount". Optionally specify a maximum lending rate using the "lendingRate" parameter. (the default "lendingRate" value is 0.02 which stands for 2% per day)

Places a margin sell order in a given market. Required parameters: "currencyPair", "rate", and "amount". Optionally specify a max lending rate using the "lendingRate" parameter. (the default "lendingRate" value is 0.02 which stands for 2% per day)

Cancels an order and places a new one of the same type in a single atomic transaction, meaning either both operations will succeed or both will fail. Required parameters: "orderNumber" and "rate". Optionally parameter: "amount", if you wish to change the amount of the new order. "postOnly" or "immediateOrCancel" may be specified for exchange orders, but will have no effect on margin orders.

Returns your active loans for each currency.

Returns your balances sorted by account. You may optionally specify the "account" POST parameter if you wish to fetch only the balances of one account.

Returns all of your available balances.

Returns all of your balances, including available balance, balance on orders, and the estimated BTC value of your balance. By default, this call is limited to your exchange account; set the "account" POST parameter to "all" to include your margin and lending accounts.

Returns all of your deposit addresses.

Returns your deposit and withdrawal history within a range, specified by the "start" and "end" POST parameters, both of which should be given as UNIX timestamps.

If you are enrolled in the maker-taker fee schedule, returns your current trading fees and trailing 30-day volume in BTC. This information is updated once every 24 hours

Returns your lending history within a time range specified by the "start" and "end" POST parameters as UNIX timestamps. "limit" may also be specified to limit the number of rows returned.

Returns a summary of your entire margin account. This is the same information you will find in the Margin Account section of the Margin Trading page.

Returns your open loan offers for each currency.

Returns your open orders for a given market, specified by the "currencyPair" POST parameter, e.g. "BTC_XCP". Set "currencyPair" to "all" to return open orders for all markets

Returns the status of a given order, specified by the "orderNumber" POST parameter. If the specified orderNumber is not open, or it is not yours, you will receive an error.

Returns all trades involving a given order, specified by the "orderNumber" POST parameter. If no trades for the order have occurred or you specify an order that does not belong to you, you will receive an error

Returns your current tradable balances for each currency in each market for which margin trading is enabled.

Returns the past 200 trades for a given market, or up to 50,000 trades between a range specified in UNIX timestamps by the "start" and "end" GET parameters.

Places a sell order in a given market. Parameters and output are the same as for the buy method.

Toggles the autoRenew setting on an active loan, specified by the "orderNumber" parameter. If successful, "message" will indicate the new autoRenew setting.

Transfers funds from one account to another. Eg. from your exchange account to your margin account.

Immediately places a withdrawal for a given currency, with no email confirmation. In order to use this method, withdrawal privilege must be enabled for your API key. Required POST parameters are "currency", "amount", and "address".

Link to this section Functions

Link to this function

buy(currency_pair, rate, amount, order_type \\ nil)

View Source

Places a limit buy order in a given market. Required POST parameters are "currencyPair", "rate", and "amount". If successful, the method will return the order number. You may optionally set "fillOrKill", "immediateOrCancel", "postOnly" to 1. A fill-or-kill order will either fill in its entirety or be completely aborted. An immediate-or-cancel order can be partially or completely filled, but any portion of the order that cannot be filled immediately will be canceled rather than left on the order book. A post-only order will only be placed if no portion of it fills immediately; this guarantees you will never pay the taker fee on any part of the order that fills.

Link to this function

cancel_all_orders(currency_pair \\ nil)

View Source

Cancels all open orders in a given market or, if no market is provided, all open orders in all markets. Optional parameter is "currencyPair". If successful, the method will return a success of 1 along with a JSON array of orderNumbers representing the orders that were cancelled.

Link to this function

cancel_loan_offer(order_number)

View Source

Cancels a loan offer specified by the "orderNumber" parameter.

Link to this function

cancel_order(order_number)

View Source

Cancels an order you have placed in a given market. Required POST parameter is "orderNumber"

Link to this function

close_margin_position(currency_pair)

View Source

Closes your margin position in a given market (currencyPair) using a market order. This call will also return success if you do not have an open position in the specified market.

Link to this function

create_loan_offer(currency, amount, duration, auto_renew, lending_rate)

View Source

Creates a loan offer for a given currency. Required parameters: "currency", "amount", "duration" (from 2 to 60, inclusive), "autoRenew" (0 or 1), and "lendingRate".

Link to this function

generate_new_address(currency)

View Source

Generates a new deposit address for the currency specified by the "currency" POST parameter.

Link to this function

get_margin_position(currency_pair)

View Source

Returns information about your margin position in a given market, specified by the "currencyPair" parameter. You may set "currencyPair" to "all" if you wish to fetch all of your margin positions at once.

Link to this function

margin_buy(currency_pair, rate, amount, lending_rate \\ nil, client_order_id \\ nil)

View Source

Places a margin buy order in a given market. Required parameters: "currencyPair", "rate", and "amount". Optionally specify a maximum lending rate using the "lendingRate" parameter. (the default "lendingRate" value is 0.02 which stands for 2% per day)

Note: "rate" * "amount" must be > 0.02 when creating or expanding a market. If successful, the method will return the order number and any trades immediately resulting from your order.

Link to this function

margin_sell(currency_pair, rate, amount, lending_rate \\ nil, client_order_id \\ nil)

View Source

Places a margin sell order in a given market. Required parameters: "currencyPair", "rate", and "amount". Optionally specify a max lending rate using the "lendingRate" parameter. (the default "lendingRate" value is 0.02 which stands for 2% per day)

Note: "rate" * "amount" must be > 0.02, when creating or expanding a market. If successful, the method will return the order number and any trades immediately resulting from your order.

Link to this function

move_order(order_number, rate, client_order_id \\ nil, order_type \\ nil, amount \\ nil)

View Source

Cancels an order and places a new one of the same type in a single atomic transaction, meaning either both operations will succeed or both will fail. Required parameters: "orderNumber" and "rate". Optionally parameter: "amount", if you wish to change the amount of the new order. "postOnly" or "immediateOrCancel" may be specified for exchange orders, but will have no effect on margin orders.

Returns your active loans for each currency.

Link to this function

return_available_account_balances()

View Source

Returns your balances sorted by account. You may optionally specify the "account" POST parameter if you wish to fetch only the balances of one account.

Link to this function

return_available_account_balances(atom)

View Source

Returns all of your available balances.

Link to this function

return_complete_balances()

View Source

Returns all of your balances, including available balance, balance on orders, and the estimated BTC value of your balance. By default, this call is limited to your exchange account; set the "account" POST parameter to "all" to include your margin and lending accounts.

Link to this function

return_complete_balances(atom)

View Source
Link to this function

return_deposit_addresses()

View Source

Returns all of your deposit addresses.

Link to this function

return_deposits_withdrawals(start, to)

View Source

Returns your deposit and withdrawal history within a range, specified by the "start" and "end" POST parameters, both of which should be given as UNIX timestamps.

If you are enrolled in the maker-taker fee schedule, returns your current trading fees and trailing 30-day volume in BTC. This information is updated once every 24 hours

Link to this function

return_lending_history(start, to, limit \\ nil)

View Source

Returns your lending history within a time range specified by the "start" and "end" POST parameters as UNIX timestamps. "limit" may also be specified to limit the number of rows returned.

Link to this function

return_margin_account_summary()

View Source

Returns a summary of your entire margin account. This is the same information you will find in the Margin Account section of the Margin Trading page.

Link to this function

return_open_loan_offers()

View Source

Returns your open loan offers for each currency.

Link to this function

return_open_orders(currency_pair)

View Source

Returns your open orders for a given market, specified by the "currencyPair" POST parameter, e.g. "BTC_XCP". Set "currencyPair" to "all" to return open orders for all markets

Link to this function

return_order_status(order_number)

View Source

Returns the status of a given order, specified by the "orderNumber" POST parameter. If the specified orderNumber is not open, or it is not yours, you will receive an error.

Link to this function

return_order_trades(order_number)

View Source

Returns all trades involving a given order, specified by the "orderNumber" POST parameter. If no trades for the order have occurred or you specify an order that does not belong to you, you will receive an error

Link to this function

return_tradable_balances()

View Source

Returns your current tradable balances for each currency in each market for which margin trading is enabled.

Link to this function

return_trade_history(currency_pair, start, to)

View Source

Returns the past 200 trades for a given market, or up to 50,000 trades between a range specified in UNIX timestamps by the "start" and "end" GET parameters.

Link to this function

sell(currency_pair, rate, amount, order_type \\ nil)

View Source

Places a sell order in a given market. Parameters and output are the same as for the buy method.

Link to this function

toggle_auto_renew(order_number)

View Source

Toggles the autoRenew setting on an active loan, specified by the "orderNumber" parameter. If successful, "message" will indicate the new autoRenew setting.

Link to this function

transfer_balance(currency, amount, from_account, to_account)

View Source

Transfers funds from one account to another. Eg. from your exchange account to your margin account.

Link to this function

withdraw(currency, amount, address, payment_id \\ nil, currency_to_withdraw_as \\ nil)

View Source

Immediately places a withdrawal for a given currency, with no email confirmation. In order to use this method, withdrawal privilege must be enabled for your API key. Required POST parameters are "currency", "amount", and "address".

For withdrawals which support payment IDs, (such as XMR) you may optionally specify "paymentId".

For currencies where there are multiple networks to choose from you need to specify the param: currencyToWithdrawAs. For USDT use currencyToWithdrawAs=USDTTRON or USDTETH. The default for USDT is Omni which is used if currencyToWithdrawAs is not specified.