Skip to main content

A Python interface for the Phemex API.

Project description

https://img.shields.io/pypi/v/phemex.svg https://img.shields.io/pypi/l/phemex.svg https://img.shields.io/pypi/pyversions/phemex.svg

Features

  • Initial, limited support of Phemex REST API
    • Public API:
    >>> from phemex import PhemexConnection
    >>> conn = PhemexConnection()
    >>> products = conn.get_products()
    
    • Authenticated connections:
    >>> from phemex import PhemexConnection, AuthCredentials
    >>> credentials = AuthCredentials(api_key, secret_key)
    >>> conn = PhemexConnection()
    >>> products = conn.get_products()
    
    • Placing orders:
    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

$ pip install phemex

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for phemex, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size phemex-0.3.0-py3-none-any.whl (7.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size phemex-0.3.0.tar.gz (6.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page