{"id":29434474,"url":"https://github.com/milesibastos/b3","last_synced_at":"2025-07-13T02:30:32.653Z","repository":{"id":42807498,"uuid":"270062285","full_name":"milesibastos/b3","owner":"milesibastos","description":"Market Data | B3","archived":false,"fork":false,"pushed_at":"2022-03-26T20:49:42.000Z","size":36,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-08-03T20:22:52.923Z","etag":null,"topics":["b3","bovespa","exchange","market","stock"],"latest_commit_sha":null,"homepage":"https://b3-2020.now.sh","language":"JavaScript","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/milesibastos.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":"2020-06-06T18:05:13.000Z","updated_at":"2023-02-10T13:51:47.000Z","dependencies_parsed_at":"2022-09-01T14:22:21.022Z","dependency_job_id":null,"html_url":"https://github.com/milesibastos/b3","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/milesibastos/b3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesibastos%2Fb3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesibastos%2Fb3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesibastos%2Fb3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesibastos%2Fb3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/milesibastos","download_url":"https://codeload.github.com/milesibastos/b3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/milesibastos%2Fb3/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265080622,"owners_count":23708215,"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":["b3","bovespa","exchange","market","stock"],"created_at":"2025-07-13T02:30:28.768Z","updated_at":"2025-07-13T02:30:32.564Z","avatar_url":"https://github.com/milesibastos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Market Data | B3\n\n- [Market Data | B3](http://www.b3.com.br/en_us/market-data-and-indices/data-services/market-data/)\n- [Historical Quotes](http://www.b3.com.br/en_us/market-data-and-indices/data-services/market-data/historical-data/equities/historical-quotes/)\n- [FILE LAYOUT – HISTORICAL QUOTATIONS](http://www.b3.com.br/data/files/65/50/AD/26/29C8B51095EE46B5790D8AA8/HistoricalQuotations_B3.pdf)\n\n## Historical Quotations\n\n- YEAR: 2020\n  - https://b3-2020.now.sh\n  - http://bvmf.bmfbovespa.com.br/InstDados/SerHist/COTAHIST_A2020.ZIP\n- YEAR: 2019\n  - https://b3-2019.now.sh\n  - http://bvmf.bmfbovespa.com.br/InstDados/SerHist/COTAHIST_A2019.ZIP\n- YEAR: 2018\n  - https://b3-2018.now.sh\n  - http://bvmf.bmfbovespa.com.br/InstDados/SerHist/COTAHIST_A2018.ZIP\n\n## The purpose of this API is to return a result as:\n\n```bash\n$ wget -nc -O - http://bvmf.bmfbovespa.com.br/InstDados/SerHist/COTAHIST_A2020.ZIP | gunzip - | gzip - \u003e COTAHIST_A2020.gz\n$ zgrep -E [0-9]+PETR4[[:space:]]+ COTAHIST_A2020.gz\n012020010202PETR4       010PETROBRAS   PN  EJ  N2   R$  000000000305100000000030700000000003031000000000305700000000030700000000003069000000000307064405000000000037774500000000115477749300000000000000009999123100000010000000000000BRPETRACNPR6196\n...\n012020060502PETR4       010PETROBRAS   PN      N2   R$  000000000222900000000023030000000002206000000000223200000000022100000000002210000000000221327382000000000114137700000000254771647800000000000000009999123100000010000000000000BRPETRACNPR6196\n```\n\n## GET: `/api/ticker/:ticker`\n\n```bash\n$ curl https://b3-2020.now.sh/api/ticker/PETR4\n[\n  \"012020010202PETR4       010PETROBRAS   PN  EJ  N2   R$  000000000305100000000030700000000003031000000000305700000000030700000000003069000000000307064405000000000037774500000000115477749300000000000000009999123100000010000000000000BRPETRACNPR6196\",\n  ...\n  \"012020060502PETR4       010PETROBRAS   PN      N2   R$  000000000222900000000023030000000002206000000000223200000000022100000000002210000000000221327382000000000114137700000000254771647800000000000000009999123100000010000000000000BRPETRACNPR6196\"\n]\n```\n\n## GET: `/api/ticker/:ticker/:iso-date`\n\n```bash\n$ curl https://b3-2020.now.sh/api/ticker/PETR4/2020-06-01\n[\n  \"012020060102PETR4       010PETROBRAS   PN      N2   R$  000000000201500000000020560000000002000000000000203500000000020330000000002033000000000203402047000000000086579500000000176231966700000000000000009999123100000010000000000000BRPETRACNPR6196\"\n]\n\n$ curl https://b3-2020.now.sh/api/ticker/PETR4/$(date +%F)\n```\n\n## Mapping text to object sample\n\nHow to mapping text to object is beyond the scope of this project. But here's an example doing it based on [file layout](http://www.b3.com.br/data/files/65/50/AD/26/29C8B51095EE46B5790D8AA8/HistoricalQuotations_B3.pdf)\n\n```js\nconst fetch = require(\"node-fetch\");\n\ntest(\"map row to object\", async () =\u003e {\n  const data = await fetch(\n    \"https://b3-2020.now.sh/api/ticker/PETR4/2020-06-01\"\n  ).then((response) =\u003e response.json());\n\n  const dataset = data.map((row) =\u003e ({\n    date: new Date(`${row.slice(2, 6)}-${row.slice(6, 8)}-${row.slice(8, 10)}`),\n    ticker: row.slice(12, 12 + 12).trim(),\n    open: Number(`${row.slice(56, 67)}.${row.slice(67, 69)}`),\n    high: Number(`${row.slice(69, 80)}.${row.slice(80, 82)}`),\n    low: Number(`${row.slice(82, 93)}.${row.slice(93, 95)}`),\n    close: Number(`${row.slice(108, 119)}.${row.slice(119, 121)}`),\n  }));\n\n  const expected = [\n    {\n      date: new Date(\"2020-06-01\"),\n      ticker: \"PETR4\",\n      open: 20.15,\n      high: 20.56,\n      low: 20,\n      close: 20.33,\n    },\n  ];\n\n  expect(dataset).toEqual(expect.arrayContaining(expected));\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesibastos%2Fb3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilesibastos%2Fb3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilesibastos%2Fb3/lists"}