{"id":15937955,"url":"https://github.com/xilinjia/stitcher","last_synced_at":"2025-07-21T10:32:38.029Z","repository":{"id":119519565,"uuid":"485412803","full_name":"XilinJia/Stitcher","owner":"XilinJia","description":"Stitches and back-adjust futures data into continuous contract","archived":false,"fork":false,"pushed_at":"2022-06-06T17:50:13.000Z","size":192,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T07:37:52.314Z","etag":null,"topics":["csv","data-science","futures","futures-historical-data","futures-market","julia","julialang","trading","trading-algorithms","trading-strategies"],"latest_commit_sha":null,"homepage":"","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XilinJia.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-25T14:47:34.000Z","updated_at":"2025-01-21T18:07:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"77c76949-2358-4f1b-bec4-c7252ecd3b42","html_url":"https://github.com/XilinJia/Stitcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/XilinJia/Stitcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XilinJia%2FStitcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XilinJia%2FStitcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XilinJia%2FStitcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XilinJia%2FStitcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XilinJia","download_url":"https://codeload.github.com/XilinJia/Stitcher/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XilinJia%2FStitcher/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266285452,"owners_count":23905352,"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":["csv","data-science","futures","futures-historical-data","futures-market","julia","julialang","trading","trading-algorithms","trading-strategies"],"created_at":"2024-10-07T05:20:25.374Z","updated_at":"2025-07-21T10:32:38.012Z","avatar_url":"https://github.com/XilinJia.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# What it is\n\nStitcher is a utility writen in Julia for constructing continuous contract data needed for analysing trading instruments of either financial or commodity futures.  The continuous contract can be used for devising or backtesting of trading strategies.  Stitcher takes historical data of individual contracts in CSV format, selects the trading data of the contract of most interests on any given trading day, thus forming a new linage of trading history, then back-adjust prices to eliminate prices gaps on changes of actual contracts, outputs the data in the same CSV format.\n\n# How it works\n\nThe historical data of individual contracts can be provided in separate files or a lumpsum file.  The names of the files should contain \"Contract\" and end with \".csv\".\n\nThe files need to have at least these columns:\n\n\"Date\",\"Open\",\"High\",\"Low\",\"Close\",\"Open_Interest\",\"Contract\"\n\nThey can have other columns, and the extra columns will just pass through without touch.\n\n\"Date\" should be String in the format of \"yyyy-mm-dd\", like \"2010-03-24\".\n\n\"Open\",\"High\",\"Low\",\"Close\" should be floating point numbers\n\nThe column of \"Contract\" notes the name of the contract, for instance, \"F2015\", \"K2015\" etc.  The actual name given is not of a concern to Stitcher as long as they are consistent duing one batch of processing.\n\nSo on any given trading day, there are various contracts being traded.  Stitcher selects the contract with the highest \"Open_Interest\" on that day.  If the name of the column \"Open_Interest\" is not such, you can specify it with argument as \"openInterest = :Interest\" (if your column is denominated as \"Interest\").  Anyhow, the openInterest column should be floating point numbers.\n\nFunction Stitch takes the following arguments, with defaults specified:\n\nInstr=\"\".  By default, Stitch uses the current directory as the working directory for inputs and outputs.  If you specify Instr=\"Gold\", then it uses the subdirectory of \"Data/Gold\" as the working directory.\n\nStartDate=\"2010-01-01\" and EndDate=\"2050-12-31\" are to specify the date range of the output file.  Dates outside of this range in the input files are dropped.\n\nAdjMethod=\"M\" specifies the method to back adjust price data due to gaps.  The default uses multiplication (or division) method.  If you specify otherwise, it will use addition (or subtraction) method (note: this can generate negative prices which can be not proper for trading analysis).\n\nFinally, openInterest::Symbol=:Open_Interest has been addressed above.\n\nOn outputs, there are three files:\n\nStitched.csv is the stitched data but not back adjusted.\n\nRoll.csv contains only the dates with contract changes.\n\nStitchedAdjM.csv (or StitchedAdjA.csv) is the final stitched and adjusted data.\n\n# How to use it\n\nStitcher is compatible with Julia 1.7.2.\n\nAs prerequisites, it requires three Julia packages: Dates, CSV, DataFrames\n\nTest data are provided under Data subdirectory.\n\nTo run the test, do:\n\n$ julia\n\njulia\u003e using DataRoutines\n\njulia\u003e cd(\"Data\")\n\njulia\u003e Stitch()\n\n# License\n\nStitcher is provided under MIT License: https://opensource.org/licenses/MIT\n\n# Used Libraries and their licenses\n\n[Julia](https://julialang.org/)\n\n[CSV](https://juliapackages.com/p/csv)\n\n[DataFrames](https://juliapackages.com/p/dataframes)\n\n# No warrantee and No guarrantee\n\nThe author hereby provides no warrantee of the utility and no guarantee for trading success.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxilinjia%2Fstitcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxilinjia%2Fstitcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxilinjia%2Fstitcher/lists"}