{"id":13691327,"url":"https://github.com/KxSystems/kdb-taq","last_synced_at":"2025-05-02T15:31:45.676Z","repository":{"id":77768906,"uuid":"89848816","full_name":"KxSystems/kdb-taq","owner":"KxSystems","description":"Latest source files for the kdb+taq package","archived":false,"fork":false,"pushed_at":"2024-12-12T11:40:50.000Z","size":14,"stargazers_count":17,"open_issues_count":5,"forks_count":131,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-24T10:55:53.314Z","etag":null,"topics":["kdb","kdb-taq","nyse","nyse-taq","q","quotes","taq"],"latest_commit_sha":null,"homepage":"https://code.kx.com/q","language":"q","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KxSystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-04-30T12:14:48.000Z","updated_at":"2025-03-15T23:33:37.000Z","dependencies_parsed_at":"2023-03-27T16:18:11.214Z","dependency_job_id":null,"html_url":"https://github.com/KxSystems/kdb-taq","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fkdb-taq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fkdb-taq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fkdb-taq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KxSystems%2Fkdb-taq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KxSystems","download_url":"https://codeload.github.com/KxSystems/kdb-taq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252062883,"owners_count":21688615,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kdb","kdb-taq","nyse","nyse-taq","q","quotes","taq"],"created_at":"2024-08-02T17:00:43.405Z","updated_at":"2025-05-02T15:31:45.666Z","avatar_url":"https://github.com/KxSystems.png","language":"q","funding_links":[],"categories":["Frameworks"],"sub_categories":[],"readme":"# kdb+taq\n\nkdb-taq is a tool for processing and analyzing historical NYSE Daily TAQ (Trade and Quote) data using kdb+/q. This repository contains scripts and utilities to parse, load, and query TAQ datasets efficiently.\n\n## Prerequisites\n\n- [kdb+](https://kx.com/kdb-personal-edition-download/) installed on your machine\n- NYSE Daily TAQ files from [ftp.nyse.com](ftp.nyse.com)\n\n## Getting Started\n\nFollow the steps below to set up and process a TAQ file:\n\n### 1. Download a Sample TAQ File\n\nObtain TAQ data files from the NYSE FTP link. For example:\n\n```\nwget https://ftp.nyse.com/Historical%20Data%20Samples/DAILY%20TAQ/EQY_US_ALL_TRADE_20240702.gz\n```\n\nThese files are ~2GB each so may take significant time to download.\n\n### 2. Clone the Repository\n\nClone the kdb-taq repository to your server:\n\n```\ngit clone https://github.com/KxSystems/kdb-taq.git\ncd kdb-taq\n```\n\n### 3. Prepare the Data\n\nCreate a source directory and move the downloaded TAQ file to this and decompress it:\n\n```\nmkdir SRC\nmv /path/to/EQY_US_ALL_TRADE_20240702.gz SRC/\ngzip -d SRC/*\n```\n\n### 4. Process the TAQ Data\n\nRun the tq.q script to process the data. Replace SRC with the full path to the source directory if necessary:\n```\nq tq.q -s 8 SRC\n```\n\nThe -s option specifies the number of threads (optional).\n\n### 5. Load the Processed Data\n\nLoad the data into the kdb+ environment:\n```\nq)\\l tq\n```\n\n### 6. Query the Data\n\nYou can now query the loaded data. For example runnning `meta` to see the table schema and datatypes:\n\n```\nq)meta trade\n\nc                                 | t f a\n----------------------------------| -----\ndate                              | d    \nTime                              | n    \nExchange                          | c    \nSymbol                            | s   p\nSaleCondition                     | s    \nTradeVolume                       | i    \nTradePrice                        | e    \nTradeStopStockIndicator           | b    \nTradeCorrectionIndicator          | h    \nSequenceNumber                    | i    \nTradeId                           | C    \nSourceofTrade                     | c    \nTradeReportingFacility            | b    \nParticipantTimestamp              | n    \nTradeReportingFacilityTRFTimestamp| n    \nTradeThroughExemptIndicator       | b   \n```\nAnd run aggregations on the data, for example get the number of trades and the max prices for each hour:\n```\nq)select numTrade:count i,maxPrice:max TradePrice by Time.hh from trade\n\nhh| numTrade maxPrice\n--| -------------------\n1 | 14019    15.0399   \n2 | 28475    15.04391  \n3 | 28535    15.04839  \n4 | 194690   7465      \n5 | 122619   3880      \n6 | 117835   7475      \n7 | 281648   7460      \n8 | 676191   7458.8    \n9 | 7657888  611225.6  \n10| 11303243 611071.8  \n11| 8726594  610600    \n12| 7114388  610980    \n13| 7039454  611065    \n14| 7512397  611679.9  \n15| 16510252 613149.4  \n16| 385603   612600.2  \n17| 145800   7460      \n18| 121943   610668    \n19| 96918    610668    \n20| 6655     8662.955\n\n```\n\n## Changelog\nDetailed update history can be found in [CHANGELOG.md](CHANGELOG.md).\n\n## Best Practices for Integration\n\nYou are welcome to download and use this code according to the terms of the licence.\n\n[KX](kx.com) recommends you do not link your application to this repository,\nwhich would expose your application to various risks:\n\n- This is not a high-availability hosting service\n- Updates to the repo may break your application\n- Code refactoring might return 404s to your application\n\n### Recommendation:\nInstead, download code and subject it to the version control and regression testing\nyou use for your application.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKxSystems%2Fkdb-taq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKxSystems%2Fkdb-taq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKxSystems%2Fkdb-taq/lists"}