Skip to main content

A wrapper of kdb and sql for convenient trade data management.

Project description

*** IMPORTANT NOTICE ***

This package is not in a usable stage. It is only uploaded for convenience of developing and testing.

Postgreslq Initialization

CREATE DATABASE trade_data;
CREATE USER tradedbadmin WITH PASSWORD 'trade_password';
GRANT ALL PRIVILEGES ON DATABASE trade_data TO tradedbadmin;
\connect trade_data;
GRANT ALL ON SCHEMA public TO tradedbadmin;

Add the following lines in the pg_hba.conf file to allow password authentication for the tradedbadmin role.

# trade database
host    all            tradedbadmin     0.0.0.0/0               scram-sha-256
host    all            tradedbadmin     ::/0                    scram-sha-256

KDB+ Initialization

get license

Request a 64-bit license from Kx Systems. Fill the form then the system will send an email with the license file and a base64 key (Either can be used to license the product).

Server side (Linux system)

  1. Put the executable q and license in desired folder, say /opt/l64 directory.
  2. Create a folder to store the data, say /opt/data directory.
  3. Set the environment variable QLIC to the directory where the license file is stored. And QHOME to the data directory.
  4. Run the q executable with the following command:
    $ q -p 5000 -s 1 -w 100 -t 1000 -T 1000 -U /opt/l64/trade.q
    
    • -p 5000: This sets the port number for the kdb+ process. In this case, the port number is 5000.

    • -s 1: This sets the number of secondary threads. In this case, it's set to 1.

    • -w 100: This sets the workspace heap size. In this case, it's set to 100 MB.

    • -t 1000: This sets the timer interval in milliseconds. In this case, it's set to 1000 milliseconds, or 1 second.

    • -T 1000: This sets the timeout in seconds for client queries. In this case, it's set to 1000 seconds.

    • -U /opt/l64/trade.q: This sets the access control list file. In this case, the file is located at /opt/l64/trade.q. This file contains a list of usernames and passwords for clients that are allowed to connect to the kdb+ process.

MetaData Initialization

Allowed instruments types are given in "Instrument Types" section of meta_enumerations.md.

Data Initialization for Instrument Type(s)

from trade_database_manager.manager import MetadataSql

metadatalib = MetadataSql()
metadatalib.initialize(for_inst_types="CB")

This will try to create two tables, instruments and instruments_cb in the database if not yet exists. The instruments table will store the common information of all instruments, and the instruments_cb table will store the type-specific information of the instruments of type CB.

The table fields are listed in the data_organization.md file.

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

trade_database_manager-0.0.12.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

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

trade_database_manager-0.0.12-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file trade_database_manager-0.0.12.tar.gz.

File metadata

  • Download URL: trade_database_manager-0.0.12.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for trade_database_manager-0.0.12.tar.gz
Algorithm Hash digest
SHA256 012fe5064129a69d1e4e8f72d799419968b00f8d179db2eac51f15c95e4cc85d
MD5 9f7fe3a805310baaaba6df7873dce33d
BLAKE2b-256 2fe2cc8c17513a18f1935954649a85a2cfc771732a9e63b8911509435f5a6dc2

See more details on using hashes here.

File details

Details for the file trade_database_manager-0.0.12-py3-none-any.whl.

File metadata

File hashes

Hashes for trade_database_manager-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 76b1163fd57cc63d39447f6e0e0a639e81ddfcf0e29d4106fa87d82a36621720
MD5 fceb709f77d6105814a60edd63902549
BLAKE2b-256 fd32c3e6d253194288abc1730bc75c67fa76e35f0deab09244f797841247449c

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