Order Endpoints¶
-
class
quoine.client.
Quoinex
(api_token_id, api_secret, vendor_id=None, language=None)[source] -
cancel_order
(order_id) Cancel an order
https://developers.quoine.com/#cancel-an-order
Parameters: order_id (int) – required result = client.cancel_order(order_id=2157479)
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "cancelled", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD" }
Raises: QuoineResponseException, QuoineAPIException
-
create_limit_buy
(product_id, quantity, price) Create a limit spot buy order
https://developers.quoine.com/#orders
Parameters: - product_id (int) – required
- quantity (string) – required quantity to buy or sell
- price (string) – required price per unit of cryptocurrency
order = client.create_limit_buy( product_id=1, quantity='100', price='0.00001')
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "live", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "unwound_trade_leverage_level": null, }
Raises: QuoineResponseException, QuoineAPIException
-
create_limit_sell
(product_id, quantity, price) Create a limit spot sell order
https://developers.quoine.com/#orders
Parameters: - product_id (int) – required
- quantity (string) – required quantity to buy or sell
- price (string) – required price per unit of cryptocurrency
order = client.create_limit_sell( product_id=1, quantity='100', price='0.00001')
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "live", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "unwound_trade_leverage_level": null, }
Raises: QuoineResponseException, QuoineAPIException
-
create_margin_order
(order_type, product_id, side, quantity, price, leverage_level=2, price_range=None, funding_currency=None, order_direction=None) Create a leveraged margin order of type limit, market, or market with range
Only available on Quoinex
To trade at any specific leverage level, you will first need to go to margin trading dashboard, click on that leverage level and then confirm to get authorized. Or you can do it using the update_leverage_level function
https://developers.quoine.com/#orders
Parameters: - order_type (string) – required - limit, market or market_with_range
- product_id (int) – required
- side (string) – required - buy or sell
- quantity (string) – required quantity to buy or sell
- price (string) – required price per unit of cryptocurrency
- leverage_level (int) – optional - 2, 4, 5, 10 or 25 (default 2)
- price_range (string) – optional - For order_type of market_with_range only, slippage of the order.
- funding_currency (string) – optional - Currency used to fund the trade with. Default is quoted currency
order = client.create_order( type=Quoinex.ORDER_TYPE_LIMIT product_id=1, side=Quoinex.SIDE_BUY, quantity='100', price='0.00001')
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "live", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "unwound_trade_leverage_level": null, }
Raises: QuoineResponseException, QuoineAPIException
-
create_market_buy
(product_id, quantity, price_range=None) Create a market spot buy order
https://developers.quoine.com/#orders
Parameters: - product_id (int) – required
- quantity (string) – required quantity to buy or sell
- price_range (string) – optional - slippage of the order.
order = client.create_market_buy( product_id=1, quantity='100') # place a market buy with range for slippage order = client.create_market_buy( product_id=1, quantity='100', price_range='0.001')
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "live", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "unwound_trade_leverage_level": null, }
Raises: QuoineResponseException, QuoineAPIException
-
create_market_sell
(product_id, quantity, price_range=None) Create a market spot sell order
https://developers.quoine.com/#orders
Parameters: - product_id (int) – required
- quantity (string) – required quantity to buy or sell
- price_range (string) – optional - slippage of the order.
order = client.create_market_sell( product_id=1, quantity='100') # place a market sell with range for slippage order = client.create_market_sell( product_id=1, quantity='100', price_range='0.001')
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "live", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "unwound_trade_leverage_level": null, }
Raises: QuoineResponseException, QuoineAPIException
-
create_order
(order_type, product_id, side, quantity, price=None, price_range=None) Create a limit, market or market with range spot order. This function gives full flexibility for spot orders.
https://developers.quoine.com/#orders
Parameters: - order_type (string) – required - limit, market or market_with_range
- product_id (int) – required
- side (string) – required - buy or sell
- quantity (string) – required quantity to buy or sell
- price (string) – required price per unit of cryptocurrency
- price_range (string) – optional For order_type of market_with_range only, slippage of the order.
order = client.create_order( type=Quoinex.ORDER_TYPE_LIMIT product_id=1, side=Quoinex.SIDE_BUY, quantity='100', price='0.00001')
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "live", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "unwound_trade_leverage_level": null, }
Raises: QuoineResponseException, QuoineAPIException
-
get_order
(order_id) Get an order
https://developers.quoine.com/#get-an-order
Parameters: order_id (int) – required order = client.get_order(order_id=2157479)
Returns: API response { "id": 2157479, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.01", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "filled", "leverage_level": 2, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "unwound_trade_leverage_level": null, "executions": [ { "id": 4566133, "quantity": "0.01", "price": "500.0", "taker_side": "buy", "my_side": "sell", "created_at": 1465396785 } ] }
Raises: QuoineResponseException, QuoineAPIException
-
get_order_trades
(order_id) Get an orders trades
https://developers.quoine.com/#get-an-order’s-trades
Parameters: order_id (int) – required trades = client.get_order_trades(order_id=2157479)
Returns: API response [ { "id": 57896, "currency_pair_code": "BTCUSD", "status": "closed", "side": "short", "margin_used": "0.83588", "open_quantity": "0.01", "close_quantity": "0.0", "quantity": "0.01", "leverage_level": 5, "product_code": "CASH", "product_id": 1, "open_price": "417.65", "close_price": "417.0", "trader_id": 3020, "open_pnl": "0.0", "close_pnl": "0.0065", "pnl": "0.0065", "stop_loss": "0.0", "take_profit": "0.0", "funding_currency": "USD", "created_at": 1456250726, "updated_at": 1456251837, "close_fee": "0.0", "total_interest": "0.02", "daily_interest": "0.02" } ]
Raises: QuoineResponseException, QuoineAPIException
-
get_orders
(funding_currency=None, product_id=None, status=None, with_details=False, limit=None, page=None) Get a list of orders using filters with pagination
https://developers.quoine.com/#get-orders
Parameters: - funding_currency (string) – optional - filter orders based on funding currency
- product_id (int) – optional - filter orders based on product
- status (string) – optional - filter orders based on status
- with_details (bool) – optional - return full order details (attributes between *) including executions
- limit (int) – optional - page limit
- page (int) – optional - page number
orders = client.get_orders(product_id=1, limit=10)
Returns: API response { "models": [ { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "live", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD", "unwound_trade_leverage_level": null, "order_fee": "0.0", "margin_used": "0.0", "margin_interest": "0.0", "executions": [] } ], "current_page": 1, "total_pages": 1 }
Raises: QuoineResponseException, QuoineAPIException
-
update_live_order
(order_id, quantity=None, price=None) Update a live order
https://developers.quoine.com/#edit-a-live-order
Parameters: - order_id (int) – required
- quantity (string) – optional - one or both of quantity or price should be set
- price (string) – optional - one or both of quantity or price should be set
order = client.update_live_order( order_id=2157479, quantity='101', price='0.001')
Returns: API response { "id": 2157474, "order_type": "limit", "quantity": "0.01", "disc_quantity": "0.0", "iceberg_total_quantity": "0.0", "side": "sell", "filled_quantity": "0.0", "price": "500.0", "created_at": 1462123639, "updated_at": 1462123639, "status": "cancelled", "leverage_level": 1, "source_exchange": "QUOINE", "product_id": 1, "product_code": "CASH", "funding_currency": "USD", "currency_pair_code": "BTCUSD" }
Raises: QuoineResponseException, QuoineAPIException
-