Skip to main content

txtrader-monitor

This module is a stand-alone package for the monitor component of the txtrader trading api manager

Installation

pip install txtrader-monitor

Configuration

The following configuration variables are required:

TXTRADER_HOST
TXTRADER_USERNAME
TXTRADER_PASSWORD
TXTRADER_TCP_PORT
TXTRADER_API_ACCOUNT

There are 2 ways to provide the variables:

passed as a python dict into the constructor API(config={'TXTRADER_HOST': 'localhost', ...})

set as environment variables

Example Code


from txtrader_monitor import Monitor
import json
from sys import stderr

# print status channel messages to stderr
def status_callback(channel, data):
    stderr.write(f"{channel} {data}\n")
    return True

# print json execution to stdout
def execution_data_callback(channel, message):
    print(message)
    return False 

# init with execution-notification and execution-data options enabled
# attach callback funcitions to channels
# and run until a callback returns False

Monitor(
    options={'execution-data':1},
    callbacks={
        '*': None, 
        'STATUS': status_callback, 
        'EXECUTION_DATA': execution_data_callback
    }
).run()

Example Use:

(txtrader-monitor) mkrueger@vesta:~/src/txtrader-monitor$ python examples/example.py 2>/dev/null | jq .
{
  "ORDER_ID": "9b94c305-b9-001a-3",
  "ORIGINAL_ORDER_ID": "9b94c305-b9-001a",
  "AVG_PRICE": 125.08,
  "BUYORSELL": "Buy",
  "CURRENCY": "USD",
  "CURRENT_STATUS": "COMPLETED",
  "DISP_NAME": "IBM",
  "EXCHANGE": "NYS",
  "EXIT_VEHICLE": "DEMOEUR",
  "FILL_ID": "1549-1323056",
  "ORDER_RESIDUAL": 25,
  "ORIGINAL_PRICE": 0,
  "ORIGINAL_VOLUME": 100,
  "PRICE": 125.08,
  "PRICE_TYPE": "Market",
  "TIME_STAMP": "202008171148032300",
  "TIME_ZONE": "America/New_York",
  "MARKET_TRD_DATE": "2020-08-17",
  "TRD_TIME": "11:48:02",
  "VOLUME": 75,
  "VOLUME_TRADED": 75,
  "CUSIP": "459200101",
  "ACCOUNT": "REALTICKDEMO.REALTICK.DEMO31.TRADING"
}

Metadata

Release files for txtrader-monitor 1.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for txtrader-monitor 1.1.8
File Size Uploaded
txtrader-monitor-1.1.8.tar.gz 8.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for txtrader-monitor 1.1.8
File Interpreter ABI Platform
txtrader_monitor-1.1.8-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 18.4 kB

Release files / txtrader-monitor-1.1.8.tar.gz

Download URL txtrader-monitor-1.1.8.tar.gz
Size 8.2 kB
Tags Source
SHA-256 checksum
How to use checksums
90dd4d7e58ee61e91463e124c9594c45164b6a0f8e5a63ab591da737a802f32b
BLAKE2b-256 checksum
How to use checksums
231ab33169ad812d72223d1532cca66b70efdea4c4e81f28759ccc624b0d7ecf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.3

Release files / txtrader_monitor-1.1.8-py2.py3-none-any.whl

Download URL txtrader_monitor-1.1.8-py2.py3-none-any.whl
Size 10.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a02e54b87ef8d48f43a4c235f529ca16a7fe6d44cfd8cdd7032fd6547b3ba6d0
BLAKE2b-256 checksum
How to use checksums
eec7433b2eb67acb5d5137cf059ebcc71bbd860f06c03befe11f690d56dcdbc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.1.8 This release

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.31

2 release files

1.0.29

2 release files

1.0.26

2 release files

1.0.25

2 release files

1.0.24

2 release files

1.0.23

2 release files

1.0.22

2 release files

1.0.21

2 release files

1.0.11

2 release files

1.0.10

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

0.0.8

2 release files

0.0.7

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page