phemex 0.3.0
A Python interface for the Phemex API.
License: MIT
Requires Python: >=3.7.x

Phemex: A Python API
=====================

.. image:: https://img.shields.io/pypi/v/phemex.svg
    :target: https://pypi.org/project/phemex/

.. image:: https://img.shields.io/pypi/l/phemex.svg
    :target: https://pypi.org/project/phemex/

.. image:: https://img.shields.io/pypi/pyversions/phemex.svg
    :target: https://pypi.org/project/phemex/

Features
--------
- Initial, limited support of Phemex REST API
    - Public API:

    .. code-block:: python

        >>> from phemex import PhemexConnection
        >>> conn = PhemexConnection()
        >>> products = conn.get_products()

    - Authenticated connections:

    .. code-block:: python

        >>> from phemex import PhemexConnection, AuthCredentials
        >>> credentials = AuthCredentials(api_key, secret_key)
        >>> conn = PhemexConnection()
        >>> products = conn.get_products()

    - Placing orders:

    .. code-block:: python

        conn = PhemexConnection(credentials)

        # set up order helper classes
        order_placer = conn.get_order_placer()
        order_factory = order_placer.get_order_factory()

        # create a limit order
        limit = order_factory.create_limit_order(Side.SELL, 1, 10000.0, Contract('BTCUSD'))

        # create a market order for BTCUSD, "cross" (no leverage), sell / short
        order = order_factory.create_market_order(Side.SELL, 1, Contract('BTCUSD'))

        # build up a conditional that places the given market short sell order
        # when last trade price touches 8800
        conditional = ConditionalOrder(Condition.IF_TOUCHED, Trigger.LAST_PRICE, 10000.0, order)

        # place the orders
        limit_hnd = order_placer.submit(limit)
        cond_hnd = order_placer.submit(conditional)

        # cancel them
        limit_hnd.cancel()
        cond_hnd.cancel()


Installation
------------

.. code-block:: bash

    $ pip install phemex


.. :changelog:

Release History
---------------

0.3.0 (2020-04-13)
++++++++++++++++++

- Switched back to Python 3.7 due to BeakerX incompatibility

0.2.0 (2020-04-12)
++++++++++++++++++

- Moved phemex to top level
- Updated README to match latest API
- Added conditional order example

0.1.0 (2020-04-12)
++++++++++++++++++

- Critical fixes to setup.py
- Switched to require Python 3.8+

0.0.8 (2020-03-07)
++++++++++++++++++

- Fixed README to match latest API

0.0.7 (2020-03-07)
++++++++++++++++++

- Added explicit Condition to ConditionalOrder: STOP or IF_TOUCHED
- Fixed ordType derivation logic to incorporate Condition
- Eliminated declared support for pre-3.7 Python versions

0.0.6 (2020-03-01)
++++++++++++++++++

- Improved documentation

0.0.5 (2020-03-01)
+++++++++++++++++++

- Start of Pythonic API's for public & private endpoints
- Added Order object model
- Improved documentation

0.0.4 (2020-02-18)
+++++++++++++++++++

- Authenticated connections now working
- Improved documentation

0.0.3 (2020-02-11)
+++++++++++++++++++

- Bug fixes for authentication

0.0.2 (2020-02-11)
+++++++++++++++++++

- Authenticated and public client
- No dedicated API wrappers, raw request only

0.0.1 (2020-02-11)
+++++++++++++++++++

- Hello world.