{"id":19779377,"url":"https://github.com/ranjanrak/go-sqlcandlestick","last_synced_at":"2025-04-30T21:31:43.515Z","repository":{"id":48157476,"uuid":"516618710","full_name":"ranjanrak/go-sqlcandlestick","owner":"ranjanrak","description":"Tiny go package for serving candlestick chart for any relational database.","archived":false,"fork":false,"pushed_at":"2022-07-23T09:00:49.000Z","size":11,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T04:51:09.382Z","etag":null,"topics":["candlestick","relational-databases"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ranjanrak.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}},"created_at":"2022-07-22T05:14:19.000Z","updated_at":"2024-12-11T08:12:45.000Z","dependencies_parsed_at":"2022-09-10T06:14:06.309Z","dependency_job_id":null,"html_url":"https://github.com/ranjanrak/go-sqlcandlestick","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjanrak%2Fgo-sqlcandlestick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjanrak%2Fgo-sqlcandlestick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjanrak%2Fgo-sqlcandlestick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ranjanrak%2Fgo-sqlcandlestick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ranjanrak","download_url":"https://codeload.github.com/ranjanrak/go-sqlcandlestick/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251785453,"owners_count":21643482,"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":["candlestick","relational-databases"],"created_at":"2024-11-12T05:34:32.650Z","updated_at":"2025-04-30T21:31:43.222Z","avatar_url":"https://github.com/ranjanrak.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-sqlcandlestick\n\n[![Run Tests](https://github.com/ranjanrak/go-sqlcandlestick/actions/workflows/go-test.yml/badge.svg)](https://github.com/ranjanrak/go-sqlcandlestick/actions/workflows/go-test.yml)\n[![Go Reference](https://pkg.go.dev/badge/github.com/ranjanrak/go-sqlcandlestick.svg)](https://pkg.go.dev/github.com/ranjanrak/go-sqlcandlestick)\n\nTiny go package for serving candlestick chart for relational database.\n\n## Installation\n\n```\ngo get -u github.com/ranjanrak/go-sqlcandlestick\n```\n\n## Usage\n\n```go\npackage main\nimport (\n\t\"log\"\n\n\tsqlcandlestick \"github.com/ranjanrak/go-sqlcandlestick\"\n)\n\nfunc main() {\n    client, err := sqlcandlestick.New(sqlcandlestick.ClientParam{\n                    DriverName: sqlcandlestick.Clickhouse,\n                    DSN: \"tcp://127.0.0.1:9000?debug=true\"})\n    if err != nil {\n        log.Fatalf(\"Error connecting to db: %v\", err)\n    }\n    // Prepare sql statement\n    queryStatement := `SELECT date,\n                        open,\n                        close\n                        max(price) AS high,\n                        min(price) AS low\n                        FROM candle_data\n                        GROUP BY date\n                        ORDER BY date ASC`\n\n    // Serve the candlestick chart\n    client.ServeChart(queryStatement, \"\", nil)\n}\n```\n\n### Default candlestick chart\n\n![image](https://user-images.githubusercontent.com/29432131/180370745-73637dbc-a020-440e-973d-ead2bf5089ec.png)\n\n## Create your own candlestick pattern\n\nYou can create your own candlestick chart types and pass the chart config to `ServeChart(..., chart *charts.Kline)`.\nFew example chart config are shown under [examples](https://github.com/ranjanrak/go-sqlcandlestick/tree/main/examples) folder.\n\n1. Candlestick OCLH chart along with volume movement\n   ![image](https://user-images.githubusercontent.com/29432131/180378371-8665436f-3bb1-48d5-9dd9-e4b748e89a3d.png)\n\n2. Candlestick OCLH chart with EMA and SMA lines\n   ![image](https://user-images.githubusercontent.com/29432131/180597744-36ec1cdc-10d8-4992-923d-f3fd3333d3cc.png)\n\n### Run unit tests\n\n```\ngo test -v\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franjanrak%2Fgo-sqlcandlestick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Franjanrak%2Fgo-sqlcandlestick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Franjanrak%2Fgo-sqlcandlestick/lists"}