Skip to main content

DXFeed Python API via C API

Project description

dxfeed package

PyPI Documentation Status PyPI - Python Version PyPI - Wheel PyPI - License Test workflow

This package provides access to dxFeed streaming data. The library is build as a thin wrapper over dxFeed C-API library. We use Cython in this project as it combines flexibility, reliability and usability in writing C extensions.

This package already contains basic C-API functions related to creating connections, subscriptions etc. Moreover default listeners (functions responsible for event processing) are ready to use. The user is also able to write his own custom listener in Cython

Installation

Requirements: python >3.6, pandas

pip3 install pandas

Install package via PyPI

pip3 install dxfeed

Basic usage

Following steps should be performed:

  • Import
  • Create Endpoint
  • Create Subscription
  • Attach listener
  • Add tickers
  • Finally close subscription and connection

Import package

import dxfeed as dx
from datetime import datetime  # for timed subscription

Configure and create connection with Endpoint class

Create instance of Endpoint class which will connect provided address.

endpoint = dx.Endpoint('demo.dxfeed.com:7300')

Endpoint instance contains information about the connection, e.g. connection address or status

print(f'Connected address: {endpoint.address}')
print(f'Connection status: {endpoint.connection_status}')
Connected address: demo.dxfeed.com:7300
Connection status: Connected and authorized

Configure and create subscription

You should specify event type. For timed subscription (conflated stream) you should also provide time to start subscription from.

trade_sub = endpoint.create_subscription('Trade', data_len=-1)

Attach default listener - function that process incoming events

trade_sub = trade_sub.attach_listener()

Add tikers you want to recieve events for

trade_sub = trade_sub.add_symbols(['C', 'TSLA'])

For timed subscription you may provide either datetime object or string. String might be incomlete, in this case you will get warning with how your provided date parsed automatically

tns_sub = endpoint.create_subscription('TimeAndSale', date_time=datetime.now()) \
                  .attach_listener() \
                  .add_symbols(['AMZN'])
candle_sub = endpoint.create_subscription('Candle', date_time='2020-04-16 13:05')
candle_sub = candle_sub.attach_listener()
candle_sub = candle_sub.add_symbols(['AAPL', 'MSFT'])

Subscription instance properties

print(f'Subscription event type: {tns_sub.event_type}')
print(f'Subscription symbols: {candle_sub.symbols}')
Subscription event type: TimeAndSale
Subscription symbols: ['AAPL', 'MSFT']

Access data

Data is stored as deque. Its length is configured with data_len parameter and by default is 100000. When you call method below you extracts all data recieved to the moment and clears the buffer in class.

candle_sub.get_data()

Close connection

endpoint.close_connection()
print(f'Connection status: {endpoint.connection_status}')
Connection status: Not connected

Transform data to pandas DataFrame

trade_df = trade_sub.get_dataframe()
tns_df = tns_sub.get_dataframe()
candle_df = candle_sub.get_dataframe()

Project details


Download files

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

Source Distribution

dxfeed-0.3.0.tar.gz (409.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

dxfeed-0.3.0-cp38-cp38m-win_amd64.whl (732.8 kB view details)

Uploaded CPython 3.8mWindows x86-64

dxfeed-0.3.0-cp38-cp38-macosx_10_14_x86_64.whl (736.5 kB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

dxfeed-0.3.0-cp37-cp37m-win_amd64.whl (730.3 kB view details)

Uploaded CPython 3.7mWindows x86-64

dxfeed-0.3.0-cp37-cp37m-macosx_10_14_x86_64.whl (734.9 kB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

dxfeed-0.3.0-cp36-cp36m-win_amd64.whl (730.4 kB view details)

Uploaded CPython 3.6mWindows x86-64

dxfeed-0.3.0-cp36-cp36m-macosx_10_14_x86_64.whl (739.5 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

Details for the file dxfeed-0.3.0.tar.gz.

File metadata

  • Download URL: dxfeed-0.3.0.tar.gz
  • Upload date:
  • Size: 409.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Linux/5.3.0-1020-azure

File hashes

Hashes for dxfeed-0.3.0.tar.gz
Algorithm Hash digest
SHA256 80c9193b2a8d4bb7c355ee5ec458f5883c20db534d6be174b796f19a2a0b0b5c
MD5 0980597717161f8787fa7257fbdc7eda
BLAKE2b-256 efe567cf2408bd689f421a107a8388750ffeaada516f31d167748f367b8f0ee9

See more details on using hashes here.

File details

Details for the file dxfeed-0.3.0-cp38-cp38m-win_amd64.whl.

File metadata

  • Download URL: dxfeed-0.3.0-cp38-cp38m-win_amd64.whl
  • Upload date:
  • Size: 732.8 kB
  • Tags: CPython 3.8m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Linux/5.3.0-1020-azure

File hashes

Hashes for dxfeed-0.3.0-cp38-cp38m-win_amd64.whl
Algorithm Hash digest
SHA256 4ddf986235e8ccac469520ce0350e4fa725c630973e4874bd97ef047cd7a6e70
MD5 5e60cf7dd97e16fb98260e424e3460bb
BLAKE2b-256 2a8f08168d4d1c08444e68cb3ca52746b6b941591c6d6753b63f140403f3923b

See more details on using hashes here.

File details

Details for the file dxfeed-0.3.0-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: dxfeed-0.3.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 736.5 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Linux/5.3.0-1020-azure

File hashes

Hashes for dxfeed-0.3.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 c4ad3ef4737a56ad64b1734cd852a221cbc996948de556acbe3daea87aa9b188
MD5 bb9c9208abeb0b12a24f60de9ab51ae1
BLAKE2b-256 52ed6755f8531aa87064e451aa234d2190849d3fc007fe9606e338c0c69524eb

See more details on using hashes here.

File details

Details for the file dxfeed-0.3.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: dxfeed-0.3.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 730.3 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Linux/5.3.0-1020-azure

File hashes

Hashes for dxfeed-0.3.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 c19688ff4508e580772e49435af939852545dd586ec08504d0abdeaffeff26a6
MD5 1a59505069a80bd6d2db384ef096e347
BLAKE2b-256 793b3157f3ed820c2671cab8c6e9717d13625fd90650b8e56b2b6186d61d6f92

See more details on using hashes here.

File details

Details for the file dxfeed-0.3.0-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: dxfeed-0.3.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 734.9 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Linux/5.3.0-1020-azure

File hashes

Hashes for dxfeed-0.3.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 fdfa9ec8213aa81884e3829a25fe6b37e682f00d7c461fc192ea7b6500b735ea
MD5 89178370c6797f2b153281d457855f4b
BLAKE2b-256 48a70a4142c38c925b59a03ab5c814bbe557b579c09884da2c2c8f497eb9b121

See more details on using hashes here.

File details

Details for the file dxfeed-0.3.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: dxfeed-0.3.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 730.4 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Linux/5.3.0-1020-azure

File hashes

Hashes for dxfeed-0.3.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 b3095ab13d87b8aa2051dcdccbfe9c6cebb3cb6e75f1eed7141bfc4dac490785
MD5 08fadae7da2a9d73816a60ffcb3671f0
BLAKE2b-256 095162be0a48a6a18d6a3e03e98ed690753675d8079cf630ea27c8aca22e4016

See more details on using hashes here.

File details

Details for the file dxfeed-0.3.0-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: dxfeed-0.3.0-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 739.5 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.7.7 Linux/5.3.0-1020-azure

File hashes

Hashes for dxfeed-0.3.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8fef998916830f7a9aedd9afee584dd86129e1bf1e44733c2aa2d5db758bfe98
MD5 0d3daf35eb8f34b32275292ef817fd4e
BLAKE2b-256 4da059affb5d23a256fe69be8322af2fae03d716eb30b24fbb195aa19001ec5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page