{"id":20069780,"url":"https://github.com/lebedov/nseindia_lob","last_synced_at":"2025-05-05T19:32:50.242Z","repository":{"id":10008406,"uuid":"12044475","full_name":"lebedov/nseindia_lob","owner":"lebedov","description":"National Stock Exchange of India Limit Order Book Simulation","archived":false,"fork":false,"pushed_at":"2020-10-01T15:07:52.000Z","size":452,"stargazers_count":36,"open_issues_count":0,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T03:27:15.106Z","etag":null,"topics":["limit-order-book","simulation","stock-market"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lebedov.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-11T23:52:59.000Z","updated_at":"2024-11-06T10:08:51.000Z","dependencies_parsed_at":"2022-09-15T20:13:29.792Z","dependency_job_id":null,"html_url":"https://github.com/lebedov/nseindia_lob","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/lebedov%2Fnseindia_lob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebedov%2Fnseindia_lob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebedov%2Fnseindia_lob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lebedov%2Fnseindia_lob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lebedov","download_url":"https://codeload.github.com/lebedov/nseindia_lob/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252562997,"owners_count":21768383,"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":["limit-order-book","simulation","stock-market"],"created_at":"2024-11-13T14:16:10.426Z","updated_at":"2025-05-05T19:32:49.831Z","avatar_url":"https://github.com/lebedov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. -*- rst -*-\n\nNational Stock Exchange of India Limit Order Book Simulation \n============================================================\nThis package implements a limit order book that simulates the \nprocessing of limit/market orders on India's National Stock Exchange (NSE).\n\nRequirements\n------------\nThe code requires the following software for installation (older versions may\nwork, but haven't been tested):\n\n* Python 2.7 or later.\n* `cython \u003chttp://www.cython.org/\u003e`_ 0.19.1 or later.\n* `numpy \u003chttp://www.numpy.org/\u003e`_ 1.7.0 or later.\n* `pandas \u003chttp://pandas.pydata.org/\u003e`_ 0.10 or later.\n* `odict \u003chttps://github.com/bluedynamics/odict/\u003e`_ 1.5.0 or later.\n* `rbtree \u003chttps://bitbucket.org/bcsaller/rbtree/\u003e`_ 0.9.0 or later.\n\nInstallation\n------------\nBuild the extension by running: ::\n\n    python setup.py build_ext --inplace\n\nRunning the Simulation\n----------------------\nTo run the simulation, invoke the simulation script with a specified firm name,\noutput directory, and list of input files. For example: ::\n\n     python lob.py INCI ./output INCI-orders-03092013.csv.gz INCI-orders-03102013.csv.gz\n     \nA sample data file (``EXAMPLE-orders.csv``) is included. A script for launching\nthe code on a Sun Grid Engine cluster is also included; the script requires the\n`drmaa-python \u003chttp://drmaa-python.github.io/\u003e`_ package. To use the script, replace\nthe listed security names accordingly.\n\nInput File Format\n-----------------\nThe simulation requires input files in CSV format comprising the following\ncolumns with the indicated byte lengths. The input file may be compressed with\ngzip.\n\nrecord indicator (2)\n  Ignored.\nsegment (4)\n  Ignored.\norder number (16)\n  8 left-most digits are date YYYYMMDD, followed by 00000001-99999999.\ntransaction date (10)\n  MM/DD/YYYY\ntransaction time (14)\n  HH:MM:SS.XXXXXX, where XXXXXX is microseconds.\nbuy/sell indicator (1)\n  Must be either 'B' or 'S'.\nactivity type (1)\n  Must be 1 (order add), 3, (order cancel), or 4 (order modify).\nsymbol (10)\n  Firm identifier.\ninstrument (6)\n  Ignored.\nexpiry date (10)\n  MM/DD/YYYY\nstrike price (variable)\n  Integer.\noption type (2)\n  Ignored.\nvolume disclosed (variable)\n  Integer.\nvolume original (variable)\n  Integer.\nlimit price (variable)\n  Float.\ntrigger price (variable)\n  Float.\nmarket flag (1)\n  'Y' for market order, 'N' for limit order.\nstop loss flag (1)\n  'Y' for stop loss order, 'N' for regular lot order.\nImmediate-or-Cancel (IOC) flag (1)\n  'Y' for IOC, 'N' for non-IOC.\nspread/combination type (1)\n  Ignored.\nalgo indicator (1)\n  Ignored.\nclient identity flag (1)\n  Ignored.\n\nMethodology and Implementation\n------------------------------\nThe limit order book is implemented as two red-black trees of queues\ncorresponding to different buy and sell price levels. The use of red-black trees\naccelerates determination of the bid and ask prices at any step of the\nsimulation. Further acceleration is achieved by compiling the simulation with Cython.\n\nOrder processing is restricted to the orders with the first futures expiration date\nobserved during processing; all other orders are ignored.\n\nSubmitted orders may be add requests, modification requests, or cancellation\nrequests. Both market and limit orders are supported; during processing, the\nformer are discarded if they fail to match any orders already in the\nbook. Residual volume for IOC orders is discarded.  Orders that have explicitly\ndisclosed (i.e., non-zero) volumes are assumed to be hidden; if any such orders\nin a price level queue, they are matched against a new incoming order AFTER\norders with zero disclosed volume.\n\nDaily stats are accumulated during the simulation and are reset when the date\nassociated with the processed orders changes. \n\nAuthor\n------\nThe code was written by Lev Givon in 2012-2013 for Prof.\nCostis Maglaras at Columbia Unversity's Business School.\n\nLicense\n-------\nSee included LICENSE file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebedov%2Fnseindia_lob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flebedov%2Fnseindia_lob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flebedov%2Fnseindia_lob/lists"}